X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=scripts%2Flive-bottom%2F10adduser;h=378f0162230397018e04456a23a6b907474c9fc7;hb=7c815f70054a82bfccf992d9b20d4d56b60f46cc;hp=394f007006e16e18e52132f4cd3adf658d454bf2;hpb=0a854a1e9307affdeaf96cb3ec0c864b171d66ca;p=live-boot-grml.git diff --git a/scripts/live-bottom/10adduser b/scripts/live-bottom/10adduser index 394f007..378f016 100755 --- a/scripts/live-bottom/10adduser +++ b/scripts/live-bottom/10adduser @@ -1,26 +1,32 @@ #!/bin/sh -PREREQ="" -DESCRIPTION="Adding live session user..." +#set -e -. /scripts/live-functions +# initramfs-tools header + +PREREQ="" prereqs() { - echo "$PREREQ" + echo "${PREREQ}" } -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; +case "${1}" in + prereqs) + prereqs + exit 0 + ;; esac -log_begin_msg "$DESCRIPTION" +# live-initramfs header + +. /scripts/live-functions -if [ "${BUILD_SYSTEM}" == "Debian" ]; then +log_begin_msg "Adding live session user..." + +# live-initramfs script + +if [ "${BUILD_SYSTEM}" = "Debian" ]; then user_crypted="8Ab05sVQ4LLps" # as in `echo "live" | mkpasswd -s` else user_crypted="U6aMy0wojraho" # "ubuntu" @@ -35,7 +41,7 @@ set passwd/username $USERNAME set passwd/user-uid 999 EOF -if [ "${BUILD_SYSTEM}" == "Debian" ]; then +if [ "${BUILD_SYSTEM}" = "Debian" ]; then chroot /root /usr/bin/env -i HOME="/root" \ TERM="${TERM}" PATH="/usr/sbin:/usr/bin:/sbin:/bin" \ /usr/lib/user-setup/user-setup-apply > /dev/null @@ -52,8 +58,11 @@ set passwd/username set passwd/user-uid EOF +if [ -z "${NOSUDO}" ] +then + if [ -f /root/etc/sudoers ]; then - if [ "${BUILD_SYSTEM}" == "Ubuntu" ]; then + if [ "${BUILD_SYSTEM}" = "Ubuntu" ]; then grep -q '^%admin' /root/etc/sudoers && sed -i -e '/^%admin/s/ALL$/NOPASSWD: ALL/' /root/etc/sudoers || echo '%admin ALL=(ALL) NOPASSWD: ALL' >> /root/etc/sudoers # XXX - awful hack to stop xscreensaver locking the screen (#7150) @@ -90,6 +99,8 @@ EOF fi fi +fi + if [ -L /root/home/$USERNAME/Examples ]; then chroot /root install -o $USERNAME -g $USERNAME -d /home/$USERNAME/Desktop/ mv /root/home/$USERNAME/Examples /root/home/$USERNAME/Desktop/