Ensure if no terminal or desktops chosen add xterm to the package list

This commit is contained in:
natemaia 2019-01-20 16:37:16 -08:00
parent d93b0f529c
commit 1029c6f7dc

View File

@ -8,7 +8,7 @@
# Some ideas and code reworked from other resources
# AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due
VER="2.0.0" # version
VER="2.0.1" # version
DIST="ArchLabs" # distributor
MNT="/mnt" # mountpoint
@ -30,6 +30,7 @@ LOGIN_TYPE="" # login manager can be lightdm or xinit
INSTALL_WMS="" # space separated list of chosen wm/de
KERNEL="linux" # can be linux, linux-lts, linux-zen, or linux-hardened
MYSHELL="" # login shell for root and the primary user
LOGINRC="" # login shell rc file
PACKAGES="" # list of all packages to install including WM_PKGS
USER_PKGS="" # packages selected by the user during install
WM_PKGS="" # full list of packages added during wm/de choice
@ -310,7 +311,12 @@ cfg_menu()
{
tput civis
MYSHELL="$(menubox "$_ShellTitle" "$_ShellBody" '/usr/bin/zsh' '-' '/bin/bash' '-' '/usr/bin/mksh' '-')"
[[ $MYSHELL ]] || return 1
case $MYSHELL in
"/bin/bash") LOGINRC=".bash_profile" ;;
"/usr/bin/mksh") LOGINRC=".profile" ;;
"/usr/bin/zsh") LOGINRC=".zprofile" ;;
*) return 1 ;;
esac
tput cnorm
HOSTNAME="$(getinput "$_ConfHost" "$_HostNameBody" "${DIST,,}")"
[[ $HOSTNAME ]] || return 1
@ -477,18 +483,6 @@ select_sessions()
select_login || return 1
if [[ $LOGIN_TYPE == 'xinit' ]]; then
if [[ $WM_NUM -eq 1 ]]; then
LOGIN_WM="${WM_SESSIONS[$INSTALL_WMS]}"
else
LOGIN_WM="$(menubox "$_WMLogin" "$_WMLoginBody" $LOGIN_CHOICES)" || return 1
LOGIN_WM="${WM_SESSIONS[$LOGIN_WM]}"
fi
yesno "$_WMLogin" "$_AutoLoginBody\n" && AUTOLOGIN=true || AUTOLOGIN=false
else
AUTOLOGIN=false
fi
# add unique wm packages to main package list
for i in $WM_PKGS; do
[[ $PACKAGES == *$i* ]] || PACKAGES+=" ${WM_PKGS# }"
@ -503,12 +497,23 @@ select_login()
"xinit" "Console login without a display manager" \
"lightdm" "Lightweight display manager with a gtk greeter")"
if [[ $LOGIN_TYPE == "" ]]; then
return 1
elif [[ $LOGIN_TYPE == 'lightdm' ]]; then
WM_PKGS+=" lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice"
EDIT_FILES[login]="/etc/lightdm/lightdm.conf /etc/lightdm/lightdm-gtk-greeter.conf"
AUTOLOGIN=false
else
if [[ $WM_NUM -eq 1 ]]; then
LOGIN_WM="${WM_SESSIONS[$INSTALL_WMS]}"
else
LOGIN_WM="$(menubox "$_WMLogin" "$_WMLoginBody" $LOGIN_CHOICES)" || return 1
LOGIN_WM="${WM_SESSIONS[$LOGIN_WM]}"
fi
local msg="\nPicking yes will create the following files:\n - /home/$NEWUSER/$LOGINRC (run 'startx' when logging in on tty1)\n - /etc/systemd/system/getty@tty1.service.d/autologin.conf (login $NEWUSER without password)\n\nTo disable autologin remove these files."
yesno "$_WMLogin" "$_AutoLoginBody\n$msg\n" && AUTOLOGIN=true || AUTOLOGIN=false
PACKAGES="${PACKAGES// lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice/}"
WM_PKGS="${WM_PKGS// lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice/}"
WM_PKGS+=" xorg-xinit"
@ -1418,7 +1423,7 @@ install_base()
sleep 1
elif [[ $(lspci | grep ' VGA ' | grep 'Intel') != "" ]]; then
printf "Creating intel GPU 'TearFree' config in /etc/X11/xorg.conf.d/20-intel.conf\n"
cat >$MNT/etc/X11/xorg.conf.d/20-intel.conf <<EOF
cat > $MNT/etc/X11/xorg.conf.d/20-intel.conf <<EOF
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
@ -1522,6 +1527,28 @@ create_user()
cp -rfv $MNT/home/$NEWUSER/.vim/colors $MNT/home/$NEWUSER/.config/nvim/colors
fi
if [[ $MYSHELL == '/usr/bin/mksh' ]]; then
cat >> $MNT/home/$NEWUSER/.mkshrc << EOF
# colors in less (manpager)
export LESS_TERMCAP_mb=$'\e[01;31m'
export LESS_TERMCAP_md=$'\e[01;31m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[01;44;33m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[01;32m'
export EDITOR=$([[ $USER_PKGS == *neovim* ]] && printf "n")vim
# source shell configs
for f in "\$HOME/.mksh/"*?.sh; do
. "\$f"
done
al-info
EOF
fi
[[ $INSTALL_WMS == *dwm* ]] && suckless_install
[[ $LOGIN_WM =~ (startkde|gnome-session) ]] && sed -i '/super/d' $HOME/.xprofile /root/.xprofile
@ -1536,46 +1563,12 @@ setup_xinit()
printf "exec %s\n" "$LOGIN_WM" >> $MNT/home/$NEWUSER/.xinitrc
fi
# automatic startx for login shells
local loginrc
case $MYSHELL in
"/bin/bash")
loginrc=".bash_profile"
;;
"/usr/bin/mksh")
loginrc=".profile"
cat >> $MNT/home/$NEWUSER/.mkshrc << EOF
# colors in less (manpager)
export LESS_TERMCAP_mb=$'\e[01;31m'
export LESS_TERMCAP_md=$'\e[01;31m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[01;44;33m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[01;32m'
export EDITOR=vim
export MANWIDTH=100
# source shell configs
for f in "\$HOME/.mksh/"*?.sh; do
. "\$f"
done
al-info
EOF
;;
*)
loginrc=".zprofile"
esac
[[ ${EDIT_FILES[login]} == *"$loginrc"* ]] || EDIT_FILES[login]+=" /home/$NEWUSER/$loginrc"
[[ ${EDIT_FILES[login]} == *"$LOGINRC"* ]] || EDIT_FILES[login]+=" /home/$NEWUSER/$LOGINRC"
if [[ $AUTOLOGIN == true ]]; then
sed -i "s/root/${NEWUSER}/g" $SERVICE/autologin.conf
cat > $MNT/home/$NEWUSER/$loginrc << EOF
# ~/$loginrc
cat > $MNT/home/$NEWUSER/$LOGINRC << EOF
# ~/$LOGINRC
# sourced by $(basename $MYSHELL) when used as a login shell
# automatically run startx when logging in on tty1
@ -1619,14 +1612,11 @@ login_manager()
# remove unneeded shell files from installation
case $MYSHELL in
"/bin/bash")
rm -rf $MNT/home/$NEWUSER/.{zsh,mksh}* $MNT/root/.{zsh,mksh}*
;;
rm -rf $MNT/home/$NEWUSER/.{zsh,mksh}* $MNT/root/.{zsh,mksh}* ;;
"/usr/bin/mksh")
rm -rf $MNT/home/$NEWUSER/.{zsh,bash}* $MNT/home/$NEWUSER/.inputrc $MNT/root/.{zsh,bash}* $MNT/root/.inputrc
;;
rm -rf $MNT/home/$NEWUSER/.{zsh,bash}* $MNT/home/$NEWUSER/.inputrc $MNT/root/.{zsh,bash}* $MNT/root/.inputrc ;;
"/usr/bin/zsh")
rm -rf $MNT/home/$NEWUSER/.{bash,mksh}* $MNT/home/$NEWUSER/.inputrc $MNT/root/.{bash,mksh}* $MNT/root/.inputrc
;;
rm -rf $MNT/home/$NEWUSER/.{bash,mksh}* $MNT/home/$NEWUSER/.inputrc $MNT/root/.{bash,mksh}* $MNT/root/.inputrc ;;
esac
if [[ $LOGIN_TYPE == 'lightdm' ]]; then
@ -1665,7 +1655,6 @@ package_operations()
local inpkg="$BASE_PKGS $PACKAGES $USER_PKGS"
[[ $MYSHELL == *mksh* ]] && inpkg+=" mksh"
[[ $BOOTLDR == 'grub' ]] && inpkg+=" grub"
if [[ $KERNEL == 'linux-lts' ]]; then
inpkg+=" linux-lts"; rmpkg+=" linux"
@ -1675,6 +1664,14 @@ package_operations()
inpkg+=" linux-hardened"; rmpkg+=" linux"
fi
[[ $BOOTLDR == 'grub' ]] || rmpkg+=" grub os-prober"
[[ $BOOTLDR == 'refind-efi' ]] || rmpkg+=" refind-efi"
if ! [[ $inpkg =~ (term|urxvt|tilix|alacritty|sakura|tilda|gnome|xfce|plasma|cinnamon) ]] && [[ $INSTALL_WMS != *dwm* ]]
then
inpkg+=" xterm"
fi
[[ $MYSHELL == '/usr/bin/zsh' ]] && inpkg+=" zsh-completions zsh-history-substring-search"
[[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps|dwm) ]] && inpkg+=" $WM_BASE_PKGS"
[[ $INSTALL_WMS =~ ^(plasma|gnome|cinnamon)$ ]] || inpkg+=" archlabs-ksuperkey"