Fix dwm issue causing liveuser account to not be swapped

This commit is contained in:
natemaia 2018-08-25 23:34:42 -07:00
parent b21247ae85
commit a47c562f16

View File

@ -14,7 +14,7 @@
# immutable variables { # immutable variables {
readonly DIST="Archlabs" # Linux distributor readonly DIST="Archlabs" # Linux distributor
readonly VER="1.6.48" # Installer version readonly VER="1.6.50" # Installer version
readonly LIVE="liveuser" # Live session user readonly LIVE="liveuser" # Live session user
readonly TRN="/usr/share/archlabs-installer" # Translation path readonly TRN="/usr/share/archlabs-installer" # Translation path
readonly MNT="/mnt/install" # Install mountpoint readonly MNT="/mnt/install" # Install mountpoint
@ -1839,6 +1839,18 @@ update_system() {
return 0 return 0
} }
setup_dwm() {
echo -e "\nSetting up dwm..\n\n"
mkdir -pv $MNT/home/$LIVE/suckless
for prog in dwm st dmenu; do
echo -e "\nInstalling $prog..\n"
git clone https://bitbucket.org/natemaia/$prog $MNT/home/$LIVE/suckless/$prog
chroot_cmd "cd /home/$LIVE/suckless/$prog && sudo make clean install && make clean"
echo -e "\n$prog has been installed..
\nSee /home/$NEWUSER/suckless/$prog to customize and rebuild\n"
done
}
install_packages() { install_packages() {
tput civis tput civis
@ -1846,7 +1858,9 @@ install_packages() {
local pkgs="$WM_PACKAGES" local pkgs="$WM_PACKAGES"
# add lightdm packages if chosen # add lightdm packages if chosen
[[ $LOGIN_TYPE == 'lightdm' ]] && pkgs="$pkgs lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice" if [[ $LOGIN_TYPE == 'lightdm' ]]; then
pkgs="$pkgs lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice"
fi
# add extra packages # add extra packages
[[ $EXTRA_PACKAGES != "" ]] && pkgs="$pkgs $EXTRA_PACKAGES" [[ $EXTRA_PACKAGES != "" ]] && pkgs="$pkgs $EXTRA_PACKAGES"
@ -1856,16 +1870,7 @@ install_packages() {
REMOVE_PKGS="$(pacman -Qssq 'xfce4*' 2>/dev/null)" REMOVE_PKGS="$(pacman -Qssq 'xfce4*' 2>/dev/null)"
fi fi
if [[ $INSTALL_WMS =~ dwm ]]; then [[ $INSTALL_WMS =~ dwm ]] && setup_dwm
echo -e "\nSetting up dwm..\n\n"
mkdir -pv $MNT/home/$NEWUSER/suckless
for prog in dwm st dmenu; do
echo -e "\nInstalling $prog..\n"
git clone https://bitbucket.org/natemaia/$prog $MNT/home/$NEWUSER/suckless/$prog
chroot_cmd "cd /home/$NEWUSER/suckless/$prog && make clean install && make clean"
echo -e "\n$prog has been installed..\n\nSee /home/$NEWUSER/suckless/$prog to customize and rebuild\n"
done
fi
local pkgcmd="pacman -S $pkgs --needed --noconfirm" local pkgcmd="pacman -S $pkgs --needed --noconfirm"
@ -1886,6 +1891,7 @@ setup_lightdm() {
chroot_cmd 'systemctl enable lightdm.service && systemctl set-default graphical.target' chroot_cmd 'systemctl enable lightdm.service && systemctl set-default graphical.target'
local cfg="$MNT/etc/lightdm/lightdm-gtk-greeter.conf" local cfg="$MNT/etc/lightdm/lightdm-gtk-greeter.conf"
sed -i '/#background=/ c background=/usr/share/backgrounds/archlabs/archlabs.jpg' $cfg sed -i '/#background=/ c background=/usr/share/backgrounds/archlabs/archlabs.jpg' $cfg
sed -i '/#theme-name=/ c theme-name=ArchLabs-dARK' $cfg sed -i '/#theme-name=/ c theme-name=ArchLabs-dARK' $cfg
sed -i '/#icon-theme-name=/ c icon-theme-name=ArchLabs-Light' $cfg sed -i '/#icon-theme-name=/ c icon-theme-name=ArchLabs-Light' $cfg
@ -1910,15 +1916,6 @@ create_user() {
chroot_cmd "echo 'root:$ROOT_PASS' | chpasswd" chroot_cmd "echo 'root:$ROOT_PASS' | chpasswd"
echo -e "$_UserSetBody" echo -e "$_UserSetBody"
swap_livuser
chroot_cmd "echo '$NEWUSER:$USER_PASS' | chpasswd"
chroot_cmd "chown -Rf $NEWUSER:users /home/$NEWUSER"
setup_user_home
return 0
}
swap_livuser() {
# edit the required files in /etc/ to swap the liveuser account name # edit the required files in /etc/ to swap the liveuser account name
sed -i "s/${LIVE}/${NEWUSER}/g" $MNT/etc/{group,gshadow,passwd,shadow} sed -i "s/${LIVE}/${NEWUSER}/g" $MNT/etc/{group,gshadow,passwd,shadow}
@ -1926,16 +1923,17 @@ swap_livuser() {
local groups="rfkill,wheel,network,lp,storage,power,video,audio,lp,autologin" local groups="rfkill,wheel,network,lp,storage,power,video,audio,lp,autologin"
if [[ $AUTOLOGIN == true && $LOGIN_TYPE == 'lightdm' ]]; then if [[ $AUTOLOGIN == true && $LOGIN_TYPE == 'lightdm' ]]; then
# add the nopasswdlogin group for lightdm autologin
groups="$groups,nopasswdlogin" groups="$groups,nopasswdlogin"
elif [[ $AUTOLOGIN == true ]]; then elif [[ $AUTOLOGIN == true ]]; then
# setup autologin on tty1 with systemd + xinit
sed -i "s/${LIVE}/${NEWUSER}/g" $MNT/etc/systemd/system/getty@tty1.service.d/autologin.conf sed -i "s/${LIVE}/${NEWUSER}/g" $MNT/etc/systemd/system/getty@tty1.service.d/autologin.conf
fi fi
chroot_cmd "mv -f /home/$LIVE /home/$NEWUSER" 2>$ERR chroot_cmd "mv -f /home/$LIVE /home/$NEWUSER"
chroot_cmd "usermod -aG $groups $NEWUSER" 2>$ERR chroot_cmd "usermod -aG $groups $NEWUSER"
chroot_cmd "echo '$NEWUSER:$USER_PASS' | chpasswd"
chroot_cmd "chown -Rf $NEWUSER:users /home/$NEWUSER"
setup_user_home
return 0 return 0
} }
@ -1944,7 +1942,6 @@ setup_user_home() {
sed -i "s/${LIVE}/${NEWUSER}/g" $user_home/.config/gtk-3.0/bookmarks \ sed -i "s/${LIVE}/${NEWUSER}/g" $user_home/.config/gtk-3.0/bookmarks \
$user_home/.mozilla/firefox/{archlabs.default/prefs.js,archlabs.default/sessionstore.js} $user_home/.mozilla/firefox/{archlabs.default/prefs.js,archlabs.default/sessionstore.js}
rm -rf $user_home/.config/awesome
if [[ $AUTOLOGIN == true ]]; then if [[ $AUTOLOGIN == true ]]; then
if [[ $LOGIN_TYPE == 'lightdm' ]]; then if [[ $LOGIN_TYPE == 'lightdm' ]]; then