X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=scripts%2Flive-bottom%2F10adduser;h=c7adad28d11c23b7680d308b33df1edd1b2a3549;hb=1bad81c0450e84a94dc1d5f4ead9886f15749b80;hp=e5067dd8c8e94ff3cb76da8a5de5fb9f45b3f3b1;hpb=e5ed5f84c8dff7855284b6d37f14da6a2e85f1c5;p=live-boot-grml.git diff --git a/scripts/live-bottom/10adduser b/scripts/live-bottom/10adduser index e5067dd..c7adad2 100755 --- a/scripts/live-bottom/10adduser +++ b/scripts/live-bottom/10adduser @@ -27,7 +27,7 @@ fi . /scripts/live-functions -log_begin_msg "Adding live session user..." +log_begin_msg "Adding live session user" # live-initramfs script @@ -40,12 +40,13 @@ set passwd/root-password-crypted * set passwd/user-password-crypted ${user_crypted} set passwd/user-fullname ${USERFULLNAME} set passwd/username ${USERNAME} -set passwd/user-uid 999 +set passwd/user-uid 1000 EOF 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 + /usr/lib/user-setup/user-setup-apply 2>&1 \ + | grep -v "Shadow passwords are now on" # Clear out debconf database again to avoid confusing ubiquity later. chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null << EOF @@ -57,15 +58,41 @@ set passwd/username set passwd/user-uid EOF +if ! grep -qs "${USERNAME}" /root/etc/passwd +then + echo "The default user (${USERNAME}) is not present," + first_user=$(grep '^[^:]*:[^:]*:[12]\?[0-9][0-9][0-9][0-9]:' /root/etc/passwd | head -1 | cut -f1 -d ':') + if [ -n "${first_user}" ]; + then + echo "setting default user to: ${first_user}." + USERNAME="${first_user}" + really_export USERNAME + else + echo "no other valid users found, disabling autologin." + NOAUTOLOGIN="Yes" + NOXAUTOLOGIN="Yes" + USERNAME="" + really_export NOAUTOLOGIN + really_export NOXAUTOLOGIN + really_export USERNAME + log_end_msg + exit 0 + fi +fi + if [ -z "${NOSUDO}" ] then - if [ -f /root/etc/sudoers ] + if ! grep -q "${USERNAME}" /root/etc/sudoers then echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> /root/etc/sudoers chroot /root sudo -u "${USERNAME}" sh -c "echo 'SU_TO_ROOT_SU=sudo' >> /home/${USERNAME}/.su-to-rootrc" - chroot /root sudo -u "${USERNAME}" gconftool-2 -s -t bool /apps/gksu/sudo-mode true - chroot /root sudo -u "${USERNAME}" gconftool-2 -s -t bool /apps/gksu/display-no-pass-info false + + if [ -x /root/usr/bin/gconftool-2 ] + then + chroot /root sudo -u "${USERNAME}" gconftool-2 -s -t bool /apps/gksu/sudo-mode true + chroot /root sudo -u "${USERNAME}" gconftool-2 -s -t bool /apps/gksu/display-no-pass-info false + fi chroot /root sudo -u "${USERNAME}" sh -c "umask 0077 && mkdir -p /home/${USERNAME}/.kde/share/config && cat > /home/${USERNAME}/.kde/share/config/kdesurc" << EOF [super-user-command] @@ -90,4 +117,14 @@ then mv /root/home/${USERNAME}/Examples /root/home/${USERNAME}/Desktop/ fi +if [ -f /root/home/$USERNAME/examples.desktop ]; then + chroot /root install -o $USERNAME -g $USERNAME -d /home/$USERNAME/Desktop/ + mv /root/home/$USERNAME/examples.desktop /root/home/$USERNAME/Desktop/ +fi + +if [ -e /root/usr/share/applications/live-installer-launcher.desktop ] +then + chroot /root install -D -o ${USERNAME} -g ${USERNAME} /usr/share/applications/live-installer-launcher.desktop /home/${USERNAME}/Desktop/live-installer-launcher.desktop +fi + log_end_msg