upstream 00f2ea2b8 as of 2018-09-02
[automated-distro-installer] / fai / config / scripts / DEMO / 10-misc
index 45f0573865aec1b486ce070bb84288a047ee6325..42f47494164fcbb569472457b139ef586748738f 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/bash
 
-# (c) Thomas Lange, 2001-2013, lange@debian.org
+# (c) Thomas Lange, 2001-2017, lange@debian.org
 
 error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
 
@@ -14,11 +14,26 @@ if ifclass UBUNTU; then
      $ROOTCMD addgroup --system sambashare || true
 fi
 
-# add a demo user account
-if ! $ROOTCMD getent passwd demo ; then
-    $ROOTCMD adduser --disabled-login --gecos "fai demo user" demo
-    $ROOTCMD usermod -p "$ROOTPW" demo
-    for g in $groups; do
-       $ROOTCMD adduser demo $g
-    done
+# add additional user account
+if [ -n "$username" ]; then
+    if ! $ROOTCMD getent passwd $username ; then
+       $ROOTCMD adduser --disabled-login --gecos "$username user" $username
+       $ROOTCMD usermod -p "$USERPW" $username
+       userdir=$($ROOTCMD getent passwd "$username" | cut -d: -f6 )
+
+       # disable xfce question about default or empty panel
+       if [ -f $target/etc/xdg/xfce4/panel/default.xml ]; then
+           xfdir=$userdir/.config/xfce4/xfconf/xfce-perchannel-xml
+           if [ ! -d $target/xfdir ]; then
+               $ROOTCMD mkdir -p $xfdir
+               $ROOTCMD cp /etc/xdg/xfce4/panel/default.xml $xfdir/xfce4-panel.xml
+               # group name is the same as user name
+               $ROOTCMD chown -R $username.$username $userdir/.config
+           fi
+       fi
+
+       for g in $groups; do
+           $ROOTCMD adduser $username $g
+       done
+    fi
 fi