OSDN Git Service

Fix: terminal not being installed when one was not selected.
authornatemaia <natemaia10@gmail.com>
Wed, 16 Oct 2019 00:46:59 +0000 (17:46 -0700)
committernatemaia <natemaia10@gmail.com>
Wed, 16 Oct 2019 07:56:29 +0000 (00:56 -0700)
archlabs-installer

index bd132a9..ac757a6 100755 (executable)
@@ -5,7 +5,7 @@
 # Some ideas and code reworked from other resources
 # AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due
 
-VER=2.0.78
+VER=2.0.79
 
 # bulk default values {
 
@@ -23,12 +23,12 @@ RUN=/run/archiso/bootmnt/arch/boot # path for live system /boot
 VM="$(dmesg | grep -i hypervisor)" # system running in a virtual machine
 export DIALOGOPTS="--cr-wrap"      # see `man dialog`
 
-BASE_PKGS="base-devel xorg xorg-drivers sudo git gvfs gtk3 libmad libmatroska tumbler "
+BASE_PKGS="base base-devel xorg xorg-drivers sudo git gvfs gtk3 libmad libmatroska tumbler "
 BASE_PKGS+="playerctl pulseaudio pulseaudio-alsa pavucontrol pamixer scrot xdg-user-dirs "
 BASE_PKGS+="ffmpeg gstreamer gst-libav gst-plugins-base gst-plugins-good bash-completion "
 
-AL_BASE_PKGS="archlabs-icons archlabs-fonts archlabs-themes archlabs-baph "
-AL_BASE_PKGS+="archlabs-wallpapers archlabs-scripts archlabs-skel-base"
+AL_BASE_PKGS="archlabs-keyring archlabs-icons archlabs-fonts archlabs-themes "
+AL_BASE_PKGS+="archlabs-baph archlabs-wallpapers archlabs-scripts archlabs-skel-base"
 
 WM_BASE_PKGS="arandr nitrogen polkit-gnome network-manager-applet "
 WM_BASE_PKGS+="volumeicon xclip exo laptop-detect xdotool compton wmctrl feh "
@@ -60,7 +60,7 @@ declare -A WM_SESSIONS=(
 declare -A WM_EXT=(
 [dwm]='' [gnome]='' [cinnamon]='gnome-terminal' [plasma]='kdebase-meta'
 [awesome]='archlabs-skel-awesome' [bspwm]='archlabs-skel-bspwm' [fluxbox]='archlabs-skel-fluxbox'
-[i3-gaps]='archlabs-skel-i3-gaps' [openbox]='archlabs-skel-openbox' [xfce4]='archlabs-skel-xfce4 xfce4-goodies'
+[i3-gaps]='archlabs-skel-i3-gaps' [openbox]='archlabs-skel-openbox archlabs-skel-xfce4' [xfce4]='archlabs-skel-xfce4 xfce4-goodies'
 ) # }
 
 # files offered for editing after install is complete {
@@ -1359,11 +1359,12 @@ install_user()
        fi
 
        [[ $MYSHELL != 'bash' ]] && rm -rf "$MNT/home/$NEWUSER/.bash"*
+       [[ $MYSHELL != 'zsh' ]] && rm -rf "$MNT/home/$NEWUSER/.z"*
 
        # remove some commands from ~/.xprofile when using KDE or Gnome as the login session
        if [[ $LOGIN_WM =~ (startkde|gnome-session) || ($LOGIN_TYPE != 'xinit' && $WM_PKGS =~ (plasma|gnome)) ]]; then
                sed -i '/super/d; /nitrogen/d; /compton/d' "$MNT/home/$NEWUSER/.xprofile" "$MNT/root/.xprofile"
-       elif [[ $INSTALL_WMS == 'dwm' ]]; then # and dwm
+       elif [[ $LOGIN_WM == 'dwm' ]]; then # and dwm
                sed -i '/super/d; /compton/d' "$MNT/home/$NEWUSER/.xprofile" "$MNT/root/.xprofile"
        fi
 
@@ -1379,6 +1380,17 @@ install_login()
        echo "Setting up $LOGIN_TYPE"
        case $LOGIN_TYPE in
                ly|sddm|gdm|lightdm)
+                       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
+                               [Desktop Entry]
+                               Encoding=UTF-8
+                               Name=Dwm
+                               Comment=Dynamic Window Manager
+                               Exec=dwm
+                               Type=XSession
+                               EOF
+                       fi
                        rm -rf "$serv" "$MNT/home/$NEWUSER/.xinitrc"
                        chrun "systemctl enable $LOGIN_TYPE.service" 2>$ERR
                        errshow 1 "systemctl enable $LOGIN_TYPE.service"
@@ -1417,12 +1429,12 @@ install_packages()
 
        [[ $KERNEL != 'linux' ]] && rmpkg+='linux '
 
-       if [[ $INSTALL_WMS == 'dwm' ]]; then
-               inpkg+="nitrogen polkit-gnome xclip gnome-keyring dunst feh "
+       if [[ $INSTALL_WMS == 'dwm' ]]; then # dwm only needs a very limited package set
+               inpkg+="nitrogen polkit-gnome gnome-keyring dunst "
        else
-               [[ $INSTALL_WMS =~ ^(plasma|gnome|cinnamon)$ ]] || inpkg+="archlabs-ksuperkey "
+               [[ $INSTALL_WMS =~ (plasma|gnome|cinnamon) ]] || inpkg+="archlabs-ksuperkey "
                [[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps|fluxbox) ]] && inpkg+="$WM_BASE_PKGS "
-               [[ $inpkg =~ (term|gnome|xfce|plasma|cinnamon|rxvt|tilda|tilix|sakura) ]] || inpkg+="xterm "
+               [[ $inpkg =~ (term|plasma|rxvt|tilda|tilix|sakura) || $INSTALL_WMS =~ (gnome|plasma|xfce4) ]] || inpkg+="xterm "
        fi
 
        # update and install crucial packages first to avoid issues
@@ -2142,8 +2154,8 @@ live()
                die 1
        else
                clear
-               pacman -Syyu --noconfirm || die 1
-               pacman -S $AL_BASE_PKGS $WM_BASE_PKGS xorg-xinit xorg-server --needed --noconfirm || die 1
+               pacman -Syyu archlinux-keyring --needed --noconfirm || die 1
+               pacman -S $AL_BASE_PKGS xorg-xinit xorg-server --needed --noconfirm || die 1
                for ses; do
                        case "$ses" in
                                dwm)
@@ -2153,7 +2165,10 @@ live()
                                                git clone https://git.suckless.org/$i /root/suckless/$i && cd /root/suckless/$i && make PREFIX=/usr install
                                        done
                                        ;;
-                               i3-gaps|oepnbox|fluxbox|bspwm|xfce4|gnome|plasma|cinnamon|awesome)
+                               i3-gaps|oepnbox|fluxbox|bspwm|awesome)
+                                       pacman -S "$ses" $WM_BASE_PKGS ${WM_EXT[$ses]} xterm --needed --noconfirm || die 1
+                                       ;;
+                               gnome|plasma|cinnamon|xfce4)
                                        pacman -S "$ses" ${WM_EXT[$ses]} xterm --needed --noconfirm || die 1
                                        ;;
                                *) echo "error: invalid session for -l, --live, see -h, --help"; die 1 ;;
@@ -2163,7 +2178,7 @@ live()
                rm -rf "/var/cache/pacman/pkg/"*
                cp -rfT /etc/skel /root || die 1
                sed -i "/exec/ c exec ${WM_SESSIONS[$ses]}" /root/.xinitrc
-               printf "\n%s has been set as the login session in /root/.xinitrc, to start the session simply run\n\n\tstartx\n\n" "${WM_SESSIONS[$ses]}"
+               printf "\n%s has been set as the login session in ~/.xinitrc, to start the session simply run\n\n\tstartx\n\n" "${WM_SESSIONS[$ses]}"
                die 0
        fi
 }