X-Git-Url: https://git.grml.org/?a=blobdiff_plain;f=autoconfig.functions;h=15712552313ca93310b0cea3f2314696ab560003;hb=1ac0b894ab02aeff8bdedef36cd0056e0846d2a9;hp=c0c1111b4f9c23ffbbb631421af3e94a08f065a9;hpb=975698c289322e14b730adaae36a907b30fc251e;p=grml-autoconfig.git diff --git a/autoconfig.functions b/autoconfig.functions index c0c1111..1571255 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -1444,6 +1444,31 @@ fi } # }}} +# {{{ configure root password +config_rootpw(){ +if checkbootparam 'rootpw' ; then + ROOT_PASSWD='' + ROOT_PASSWD="$(getbootparam 'rootpw' 2>>$DEBUG)" + einfo "Bootoption rootpw found, trying to set password for user root." + + if [ -z "$ROOT_PASSWD" ] ; then + ewarn "No password given for user root. Please set one with rootpw=" ; eend 0 + else + # chpasswd sucks, seriously. + if chpasswd --help 2>&1 | grep -q -- '-m,' ; then + echo "root:$ROOT_PASSWD" | chpasswd -m + else + echo "root:$ROOT_PASSWD" | chpasswd + fi + fi + + eindent + ewarn 'Warning: please change the password for user root as soon as possible!' + eoutdent +fi +} +# }}} + # {{{ autostart of x11vnc config_vnc(){