OSDN Git Service

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