# HG changeset patch # User Aleksej Bobylev # Date 1456347438 -7200 # Node ID 23d89ddc30adb4e1aeeb866160323299258ebd72 # Parent 09aba02ed71ac16b8b130d06b456a65416291f06 /etc/init.d/bootopts.sh: make sure selected user has a home (thanks Alanyih) diff -r 09aba02ed71a -r 23d89ddc30ad etc/init.d/bootopts.sh --- a/etc/init.d/bootopts.sh Mon Feb 15 12:33:39 2016 +0100 +++ b/etc/init.d/bootopts.sh Wed Feb 24 22:57:18 2016 +0200 @@ -22,18 +22,17 @@ # 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 +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 +if ! grep -q '100[0-9]:100' /etc/passwd; then # Make sure we have users applications.conf if [ ! -f '/etc/skel/.config/slitaz/applications.conf' -a \ -f '/etc/slitaz/applications.conf' ]; then @@ -55,6 +54,12 @@ fi fi +# Make sure selected user has home +if [ ! -d /home/$USER ]; then + cp -a /etc/skel /home/$USER + chown -R $USER:users /home/$USER +fi + for opt in $(cat /proc/cmdline); do case $opt in eject)