Remove root autologin when no login type is chosen

This commit is contained in:
natemaia 2019-11-13 19:47:53 -08:00
parent d326b0fbf4
commit 869a6a6ee7

View File

@ -1370,9 +1370,10 @@ install_user()
install_login() install_login()
{ {
local serv="$MNT/etc/systemd/system/getty@tty1.service.d" local serv="$MNT/etc/systemd/system/getty@tty1.service.d"
echo "Setting up $LOGIN_TYPE"
case $LOGIN_TYPE in case $LOGIN_TYPE in
ly|sddm|gdm|lightdm) ly|sddm|gdm|lightdm)
echo "Setting up $LOGIN_TYPE"
if [[ $LOGIN_WM == *dwm* ]]; then # dwm doesn't include an xsession file for display managers if [[ $LOGIN_WM == *dwm* ]]; then # dwm doesn't include an xsession file for display managers
mkdir -p "$MNT/usr/share/xsessions" mkdir -p "$MNT/usr/share/xsessions"
cat > "$MNT/usr/share/xsessions/dwm.desktop" <<- EOF cat > "$MNT/usr/share/xsessions/dwm.desktop" <<- EOF
@ -1390,6 +1391,7 @@ install_login()
${LOGIN_TYPE}_config ${LOGIN_TYPE}_config
;; ;;
xinit) xinit)
echo "Setting up $LOGIN_TYPE"
if [[ $INSTALL_WMS ]]; then if [[ $INSTALL_WMS ]]; then
sed -i "/exec/ c exec ${LOGIN_WM}" "$MNT/home/$NEWUSER/.xinitrc" sed -i "/exec/ c exec ${LOGIN_WM}" "$MNT/home/$NEWUSER/.xinitrc"
elif [[ -e $MNT/home/$NEWUSER/.xinitrc ]]; then elif [[ -e $MNT/home/$NEWUSER/.xinitrc ]]; then
@ -1397,15 +1399,18 @@ install_login()
return 0 return 0
fi fi
if [[ $AUTOLOGIN ]]; then if [[ $AUTOLOGIN ]]; then
sed -i "s/root/${NEWUSER}/g" $serv/autologin.conf sed -i "s/root/${NEWUSER}/g" "$serv/autologin.conf"
cat > "$MNT/home/$NEWUSER/$LOGINRC" <<- EOF cat > "$MNT/home/$NEWUSER/$LOGINRC" <<- EOF
# automatically run startx when logging in on tty1 # automatically run startx when logging in on tty1
[ \$XDG_VTNR -eq 1 ] && exec startx [ \$XDG_VTNR -eq 1 ] && exec startx
EOF EOF
else else
rm -rf $serv rm -rf "$serv"
fi fi
;; ;;
*)
rm -rf "$serv"
;;
esac esac
} }