From f9a3310a0a0cf818649c2b0335bca69a2d536bd0 Mon Sep 17 00:00:00 2001 From: r00t Date: Tue, 23 Dec 2014 14:59:46 -0500 Subject: [PATCH] oh, why the hell not. --- extra/build.conf.sample | 4 ++++ lib/mk.chroot.sh | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/extra/build.conf.sample b/extra/build.conf.sample index 63c7acf..d31d87f 100644 --- a/extra/build.conf.sample +++ b/extra/build.conf.sample @@ -90,6 +90,10 @@ REGUSR="${UXNAME}" # $6$aBcDeFgHiJ$Yh342vFH7MOjPNu9InFymD1Dd42i5cFsr1cTWdpKGNIkbRGR/ZKQDRPJ1ZeeGb7y894Tfh3iWZIJKu3phlsqQ1 REGUSR_PASS="" +# Same exact thing as REGUSR_PASS, but for the root password (i.e. if no password hash is +# specified, password login will be disabled). +ROOT_PASS="" + # Do we have enough horsepower on the build system to jack up the resources we throw at building? # Enabling this will give absolute CPU preference to building the kernels and do make-time # enhancements/optimizations (i.e. use the maximum number of CPU cores detected). diff --git a/lib/mk.chroot.sh b/lib/mk.chroot.sh index cf8870c..736cc21 100755 --- a/lib/mk.chroot.sh +++ b/lib/mk.chroot.sh @@ -213,9 +213,15 @@ EOF if [ -n "${REGUSR_PASS}" ]; then ${CHROOTCMD} ${i}/ "echo ${REGUSR}:${REGUSR_PASS} | chpasswd -e" >> "${LOGFILE}.${FUNCNAME}" 2>&1 + else + sed -i -e "s/^${REGUSR}::/${REGUSR}:!:/g" ${i}/etc/shadow + fi + if [ -n "${ROOT_PASS}" ]; + then + ${CHROOTCMD} ${i}/ "echo ${root}:${ROOT_PASS} | chpasswd -e" >> "${LOGFILE}.${FUNCNAME}" 2>&1 + else + sed -i -e 's/^root::/root:!:/g' ${i}/etc/shadow fi - # COMMENT THIS LINE IF YOU WANT TO SET A ROOT PASSWORD - sed -i -e 's/^root::/root:!:/g' ${i}/etc/shadow # The following is supposed to do the same as the above, but "cleaner". However, it currently fails with "execv() failed: No such file or directory" ##${CHROOTCMD} ${i}/ usermod -L root >> "${LOGFILE}.${FUNCNAME}" 2>&1 echo "Done."