Merging casper 1.199.
[live-boot-grml.git] / scripts / live-bottom / 10adduser
index 7498476..c7adad2 100755 (executable)
@@ -58,6 +58,28 @@ 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 ! grep -q "${USERNAME}" /root/etc/sudoers
@@ -95,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