# HG changeset patch # User Pascal Bellard # Date 1385294871 0 # Node ID 86ae53480b995bcf2337fa4079abad7ed42fb799 # Parent c469506f11ceb6e7e53ef83aab9308de65320955 Backout 03d0b5dd9213 diff -r c469506f11ce -r 86ae53480b99 etc/init.d/bootopts.sh --- a/etc/init.d/bootopts.sh Wed Oct 30 18:28:16 2013 +0100 +++ b/etc/init.d/bootopts.sh Sun Nov 24 12:07:51 2013 +0000 @@ -18,6 +18,36 @@ # Parse /proc/cmdline for boot options. echo "Checking for SliTaz cmdline options..." +# Default user account without password (uid=1000). In live mode the option +# user=name can be used, but user must be added before home= to have home dir. +# This option is not handled by a loop and case like others and has no +# effect on an installed system. +if ! grep -q "100[0-9]:100" /etc/passwd; then + if fgrep -q "user=" /proc/cmdline; then + USER=$(cat /proc/cmdline | sed 's/.*user=\([^ ]*\).*/\1/') + # Avoid usage of an existing system user or root. + if grep -q ^$USER /etc/passwd; then + USER=tux + fi + else + USER=tux + fi + echo -n "Configuring user and group: $USER..." + adduser -D -s /bin/sh -g "SliTaz User" -G users -h /home/$USER $USER + passwd -d $USER >/dev/null + status + # Audio and cdrom group. + addgroup $USER audio + addgroup $USER cdrom + addgroup $USER video + addgroup $USER tty + # Slim default user. + if [ -f /etc/slim.conf ]; then + sed -i s/"default_user .*"/"default_user $USER"/\ + /etc/slim.conf + fi +fi + for opt in $(cat /proc/cmdline) do case $opt in @@ -151,36 +181,6 @@ esac done -# Default user account without password (uid=1000). In live mode the option -# user=name can be used, but user must be added before home= to have home dir. -# This option is not handled by a loop and case like others and has no -# effect on an installed system. -if ! grep -q "100[0-9]:100" /etc/passwd; then - if fgrep -q "user=" /proc/cmdline; then - USER=$(cat /proc/cmdline | sed 's/.*user=\([^ ]*\).*/\1/') - # Avoid usage of an existing system user or root. - if grep -q ^$USER /etc/passwd; then - USER=tux - fi - else - USER=tux - fi - echo -n "Configuring user and group: $USER..." - adduser -D -s /bin/sh -g "SliTaz User" -G users -h /home/$USER $USER - passwd -d $USER >/dev/null - status - # Audio and cdrom group. - addgroup $USER audio - addgroup $USER cdrom - addgroup $USER video - addgroup $USER tty - # Slim default user. - if [ -f /etc/slim.conf ]; then - sed -i s/"default_user .*"/"default_user $USER"/\ - /etc/slim.conf - fi -fi - # If no default WM fallback to Openbox (we never know). if [ ! -f /etc/X11/wm.default ]; then echo "openbox" > /etc/X11/wm.default