This commit is contained in:
Luk 2024-12-21 18:16:11 +08:00
parent 12997de734
commit b9bfb34a17
2 changed files with 51 additions and 43 deletions

View File

@ -34,3 +34,11 @@ else
echo "--- Nothing changed." echo "--- Nothing changed."
fi fi
echo echo
echo "::*** Config home with standard init files? [y] for yes, [anything else] for no"
read -p "***:: " ConfigHome
if [ "$ConfigHome" = "y" ]
then
source /faronear/sysconfig/nixhome-config.sh /faronear/sysconfig/nixhome $NewUser
fi
echo

View File

@ -34,13 +34,13 @@ echo "::*** Configure root home"
source /faronear/sysconfig/nixhome-config.sh /faronear/sysconfig/nixhome root source /faronear/sysconfig/nixhome-config.sh /faronear/sysconfig/nixhome root
echo echo
echo "::*** Change root password? [y] for yes, [anything else] for omit:" # echo "::*** Change root password? [y] for yes, [anything else] for omit:"
read -p "***:: " ChangeRootPassword # read -p "***:: " ChangeRootPassword
if [ "$ChangeRootPassword" == 'y' ] # if [ "$ChangeRootPassword" == 'y' ]
then # then
passwd # passwd
fi # fi
echo # echo
echo "::*** Configure /etc/sudoers to includedir /etc/sudoers.d" echo "::*** Configure /etc/sudoers to includedir /etc/sudoers.d"
#sed -i "s|%sudo\s\+ALL=(ALL:ALL)\sALL|%sudo\tALL=(ALL:ALL) NOPASSWD:ALL|g" /etc/sudoers # allow all users in %sudo group to sudo without password #sed -i "s|%sudo\s\+ALL=(ALL:ALL)\sALL|%sudo\tALL=(ALL:ALL) NOPASSWD:ALL|g" /etc/sudoers # allow all users in %sudo group to sudo without password
@ -66,16 +66,16 @@ then
echo echo
fi fi
echo "::*** Set [new hostname] or [leave blank] for no change" # echo "::*** Set [new hostname] or [leave blank] for no change"
read -p "***:: " NewHostname # read -p "***:: " NewHostname
if [ $NewHostname ] # if [ $NewHostname ]
then # then
sed -i "s|\b`hostname`\b|$NewHostname|g" /etc/hosts # echo "127.0.0.1 $NewHostname" >> /etc/hosts # sed -i "s|\b`hostname`\b|$NewHostname|g" /etc/hosts # echo "127.0.0.1 $NewHostname" >> /etc/hosts
hostnamectl set-hostname $NewHostname # hostnamectl set-hostname $NewHostname
else # else
echo '--- Nothing changed.' # echo '--- Nothing changed.'
fi # fi
echo # echo
echo "::*** Configure autostart" echo "::*** Configure autostart"
if [ -f /etc/rc.local ] if [ -f /etc/rc.local ]
@ -93,33 +93,33 @@ chmod +x /faronear/autostart.sh
echo 'Autostart is set to /faronear/autostart.sh. Run "systemctl start/stop/status rc-local" to manage it.' echo 'Autostart is set to /faronear/autostart.sh. Run "systemctl start/stop/status rc-local" to manage it.'
echo echo
echo "::*** Configure locales: [y] for yes, [anything else] for no change:" # echo "::*** Configure locales: [y] for yes, [anything else] for no change:"
read -p "***:: " ConfigLocales # read -p "***:: " ConfigLocales
if [ "$ConfigLocales" == 'y' ] # if [ "$ConfigLocales" == 'y' ]
then # then
dpkg-reconfigure locales # dpkg-reconfigure locales
fi # fi
echo # echo
echo "::*** Add a new user [[$NewUser]]? [y] for yes, [anything else] for no change:" # echo "::*** Add a new user [[$NewUser]]? [y] for yes, [anything else] for no change:"
read -p "***:: " AddNewUser # read -p "***:: " AddNewUser
if [ "$AddNewUser" == 'y' ] # if [ "$AddNewUser" == 'y' ]
then # then
source /faronear/sysconfig/debian-add-user.sh $NewUser # source /faronear/sysconfig/debian-add-user.sh $NewUser
source /faronear/sysconfig/nixhome-config.sh /faronear/sysconfig/nixhome $NewUser # source /faronear/sysconfig/nixhome-config.sh /faronear/sysconfig/nixhome $NewUser
echo # echo
echo "::*** Enable xfce autologin [/etc/lightdm/lightdm.conf]: [y] for autologin as [[$NewUser]] or [anything else] for no change:" # echo "::*** Enable xfce autologin [/etc/lightdm/lightdm.conf]: [y] for autologin as [[$NewUser]] or [anything else] for no change:"
read -p "***:: " XfceAutologin # read -p "***:: " XfceAutologin
if [ "$XfceAutologin" == "y" ] # if [ "$XfceAutologin" == "y" ]
then # then
sed -i "s/^.*autologin-user=.*$/autologin-user=$NewUser/g" /etc/lightdm/lightdm.conf # sed -i "s/^.*autologin-user=.*$/autologin-user=$NewUser/g" /etc/lightdm/lightdm.conf
sed -i "s/^.*autologin-user-timeout=.*$/autologin-user-timeout=0/g" /etc/lightdm/lightdm.conf # sed -i "s/^.*autologin-user-timeout=.*$/autologin-user-timeout=0/g" /etc/lightdm/lightdm.conf
echo "--- Successfully configured autologin as [[$NewUser]]" # echo "--- Successfully configured autologin as [[$NewUser]]"
else # else
echo '--- Nothing changed.' # echo '--- Nothing changed.'
fi # fi
fi # fi
echo # echo
echo "::*** Debian System Setup Completed." echo "::*** Debian System Setup Completed."