fai-config/scripts/DEMO/10-misc

40 lines
1.1 KiB
Bash
Executable File

#! /bin/bash
# (c) Thomas Lange, 2001-2017, lange@debian.org
error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
ifclass XORG && {
fcopy -M /etc/X11/xorg.conf
}
if ifclass UBUNTU; then
groups="adm cdrom sudo dip plugdev lpadmin sambashare"
$ROOTCMD addgroup --system lpadmin || true
$ROOTCMD addgroup --system sambashare || true
fi
# 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