X-Git-Url: https://iankelling.org/git/?p=automated-distro-installer;a=blobdiff_plain;f=fai%2Fconfig%2Fscripts%2FDEMO%2F10-misc;h=42f47494164fcbb569472457b139ef586748738f;hp=45f0573865aec1b486ce070bb84288a047ee6325;hb=bc3037fe2075e33b0035fc0689f44a60381638f9;hpb=2773c14668a490a1254a63541e1ef9fd3377104b diff --git a/fai/config/scripts/DEMO/10-misc b/fai/config/scripts/DEMO/10-misc index 45f0573..42f4749 100755 --- a/fai/config/scripts/DEMO/10-misc +++ b/fai/config/scripts/DEMO/10-misc @@ -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