slitaz-boot-scripts diff etc/init.d/bootopts.sh @ rev 338
/etc/init.d/rcS: tazpkg does not support /var/run symlink
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Nov 26 15:37:00 2013 +0000 (2013-11-26) |
parents | 5195a3bc63bf |
children | e147902153c1 |
line diff
1.1 --- a/etc/init.d/bootopts.sh Wed Oct 30 18:24:28 2013 +0100 1.2 +++ b/etc/init.d/bootopts.sh Tue Nov 26 15:37:00 2013 +0000 1.3 @@ -18,6 +18,36 @@ 1.4 # Parse /proc/cmdline for boot options. 1.5 echo "Checking for SliTaz cmdline options..." 1.6 1.7 +# Default user account without password (uid=1000). In live mode the option 1.8 +# user=name can be used, but user must be added before home= to have home dir. 1.9 +# This option is not handled by a loop and case like others and has no 1.10 +# effect on an installed system. 1.11 +if ! grep -q "100[0-9]:100" /etc/passwd; then 1.12 + if fgrep -q "user=" /proc/cmdline; then 1.13 + USER=$(cat /proc/cmdline | sed 's/.*user=\([^ ]*\).*/\1/') 1.14 + # Avoid usage of an existing system user or root. 1.15 + if grep -q ^$USER /etc/passwd; then 1.16 + USER=tux 1.17 + fi 1.18 + else 1.19 + USER=tux 1.20 + fi 1.21 + echo -n "Configuring user and group: $USER..." 1.22 + adduser -D -s /bin/sh -g "SliTaz User" -G users -h /home/$USER $USER 1.23 + passwd -d $USER >/dev/null 1.24 + status 1.25 + # Audio and cdrom group. 1.26 + addgroup $USER audio 1.27 + addgroup $USER cdrom 1.28 + addgroup $USER video 1.29 + addgroup $USER tty 1.30 + # Slim default user. 1.31 + if [ -f /etc/slim.conf ]; then 1.32 + sed -i s/"default_user .*"/"default_user $USER"/\ 1.33 + /etc/slim.conf 1.34 + fi 1.35 +fi 1.36 + 1.37 for opt in $(cat /proc/cmdline) 1.38 do 1.39 case $opt in 1.40 @@ -151,36 +181,6 @@ 1.41 esac 1.42 done 1.43 1.44 -# Default user account without password (uid=1000). In live mode the option 1.45 -# user=name can be used, but user must be added before home= to have home dir. 1.46 -# This option is not handled by a loop and case like others and has no 1.47 -# effect on an installed system. 1.48 -if ! grep -q "100[0-9]:100" /etc/passwd; then 1.49 - if fgrep -q "user=" /proc/cmdline; then 1.50 - USER=$(cat /proc/cmdline | sed 's/.*user=\([^ ]*\).*/\1/') 1.51 - # Avoid usage of an existing system user or root. 1.52 - if grep -q ^$USER /etc/passwd; then 1.53 - USER=tux 1.54 - fi 1.55 - else 1.56 - USER=tux 1.57 - fi 1.58 - echo -n "Configuring user and group: $USER..." 1.59 - adduser -D -s /bin/sh -g "SliTaz User" -G users -h /home/$USER $USER 1.60 - passwd -d $USER >/dev/null 1.61 - status 1.62 - # Audio and cdrom group. 1.63 - addgroup $USER audio 1.64 - addgroup $USER cdrom 1.65 - addgroup $USER video 1.66 - addgroup $USER tty 1.67 - # Slim default user. 1.68 - if [ -f /etc/slim.conf ]; then 1.69 - sed -i s/"default_user .*"/"default_user $USER"/\ 1.70 - /etc/slim.conf 1.71 - fi 1.72 -fi 1.73 - 1.74 # If no default WM fallback to Openbox (we never know). 1.75 if [ ! -f /etc/X11/wm.default ]; then 1.76 echo "openbox" > /etc/X11/wm.default