# Hook addon for user password stuff cpifexists /etc/login.defs /etc cpifexists /usr/sbin/tcospasswd /usr/sbin TCOS_ROOT_PASSWD_GEN="root:$(/usr/sbin/tcospasswd root)" # the root password by default is "root" root_shadow="root:$(/usr/sbin/tcospasswd root):13562:0:99999:7:::" if [ ! -z ${TCOS_ROOT_PASSWD} ]; then # generate shadow hash TCOS_ROOT_PASSWD_GEN="root:$(/usr/sbin/tcospasswd ${TCOS_ROOT_PASSWD})" fi # create /etc/tcospasswd if exists tcosmonitor secret passwd and change hash if [ -e /etc/tcos/secrets/tcosmonitor-secret ]; then secret1="$(cat /etc/tcos/secrets/tcosmonitor-secret | awk -F":" '{print $1}')" secret2="$(cat /etc/tcos/secrets/tcosmonitor-secret | awk -F":" '{print $2}')" secret2_passwd="$(/usr/sbin/tcospasswd $secret2)" echo "$secret1:$secret2_passwd" > $DESTDIR/etc/tcospasswd TCOS_ROOT_PASSWD_GEN="root:${secret2_passwd}" fi root_shadow="${TCOS_ROOT_PASSWD_GEN}:13562:0:99999:7:::" # create /etc/passwd /etc/shadow and /etc/group cat << EOF >> $DESTDIR/etc/passwd root:x:0:0:root:/root:/bin/sh daemon:x:1:1:daemon:/usr/sbin:/bin/sh bin:x:2:2:bin:/bin:/bin/sh sys:x:3:3:sys:/dev:/bin/sh lp:x:7:7:lp:/var/spool/lpd:/bin/sh proxy:x:13:13:proxy:/bin:/bin/sh nobody:x:65534:65534:nobody:/nonexistent:/bin/sh sshd:x:105:65534::/var/run/sshd:/bin/false EOF # default password for root user is "root" cat << EOF >> $DESTDIR/etc/shadow ${root_shadow} daemon:*:13250:0:99999:7::: bin:*:13250:0:99999:7::: sys:*:13250:0:99999:7::: lp:*:13250:0:99999:7::: nobody:*:13250:0:99999:7::: sshd:!:13250:0:99999:7::: EOF cat << EOF >> $DESTDIR/etc/group root:x:0: daemon:x:1: bin:x:2: sys:x:3: adm:x:4: tty:x:5: disk:x:6: lp:x:7: kmem:x:15: audio:x:29:pulse users:x:100: ssh:x:109: EOF