Tweaks to live session setup

This commit is contained in:
natemaia 2020-06-22 17:12:47 -07:00
parent 5727b5902b
commit c848e2c446

View File

@ -6,7 +6,7 @@
# AIF, Calamares, and the Arch Wiki.. Credit where credit is due
# shellcheck disable=SC2086,SC2046,SC2254,SC2164
VER=2.1.59
VER=2.1.60
# default values {
@ -36,13 +36,11 @@ CMAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' | awk '{gsub(/\.map\.gz|.*
export DIALOGOPTS="--cr-wrap"
# }
# package arrays {
# package arrays built later from user selections
typeset -a SES_PKGS USER_PKGS
# }
# packages installed specific to archlabs, installed when any session is chosen {
typeset -a BASE_PKGS=(
"alsa-firmware"
@ -216,8 +214,6 @@ declare -A PKG_EXT=(
[zathura]='zathura-pdf-poppler'
) # }
# }
# commands used to install each bootloader, however most get modified during runtime {
declare -A BCMDS=(
[efistub]='efibootmgr -v -d /dev/sda -p 1 -c -l'
@ -227,12 +223,6 @@ declare -A BCMDS=(
[systemd-boot]='bootctl --path=/boot install'
) # }
# sessions that provide their own super bind and set the wallpaper {
declare WM_PKG_SES='openbox|bspwm|i3-gaps|fluxbox|jwm|awesome'
declare SELF_CONTAINED='plasma|gnome|cinnamon|deepin'
declare SELF_CONTAINED_SES='startplasma-x11|gnome-session|startdde|cinnamon-session'
# }
# executable name for each wm/de used in ~/.xinitrc {
declare -A WM_SESSIONS=(
[awesome]='awesome'
@ -1923,7 +1913,7 @@ install_cleanup()
[[ $LOGIN_WM == 'dwm' ]] && sed -i '/super/d; /picom/d' "$MNT/home/$user/.xprofile" "$MNT/root/.xprofile"
# remove some commands from ~/.xprofile when using self contained sessions
if [[ $LOGIN_WM =~ ($SELF_CONTAINED_SES) || ($LOGIN_TYPE != 'xinit' && $INSTALL_WMS =~ ($SELF_CONTAINED)) ]]; then
if [[ $LOGIN_WM =~ (startplasma-x11|gnome-session|startdde|cinnamon-session) || ($LOGIN_TYPE != 'xinit' && $INSTALL_WMS =~ (plasma|gnome|cinnamon|deepin)) ]]; then
sed -i '/super/d; /nitrogen/d; /picom/d' "$MNT/home/$user/.xprofile" "$MNT/root/.xprofile"
fi
@ -2012,7 +2002,7 @@ install_packages()
if [[ $INSTALL_WMS ]]; then
inpkg+=("${BASE_PKGS[@]}")
[[ $INSTALL_WMS =~ ($WM_PKG_SES) ]] && inpkg+=("${WM_PKGS[@]}")
[[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps|fluxbox|jwm|awesome) ]] && inpkg+=("${WM_PKGS[@]}")
fi
for i in ${LOGIN_PKGS[$LOGIN_TYPE]}; do
@ -3113,32 +3103,50 @@ live()
elif ! net_connect; then
msg "Not Connected" "\nRunning live requires an active internet connection to install packages.\n\nExiting..\n" 2
die 1
elif (( $(awk '/MemTotal/ {print int($2 * 1024 / 1000 / 1000)}' /proc/meminfo) < 4704)); then
msg "Not Enough Memory" "\nLive session requires at least 4.5G of system memory for installing packages.\n\nExiting..\n" 2
die 1
fi
m=$(awk '/MemTotal/ {print int($2 / 1000)}' /proc/meminfo)
case "$ses" in
plasma)
if (( m < 6650 )); then
msg "Not Enough Memory" "\nLive session requires at least 6.5G of system memory for installing packages.\n\nExiting..\n" 2
die 1
fi
s="6G"
;;
*)
if (( m < 4600 )); then
msg "Not Enough Memory" "\nLive session requires at least 4.5G of system memory for installing packages.\n\nExiting..\n" 2
die 1
fi
s="4G"
;;
esac
clear
echo "Sorting mirrorlist"
if ! mount /run/archiso/cowspace -o remount,size=4G; then
msg "Remount Fail" "\nUnable to remount root with a larger copy-on-write space, this is needed for installing packages.\n\nExiting..\n" 2
die 1
fi
install_mirrorlist
[[ -f /etc/pacman.d/mirrorlist.bak ]] || { echo "Sorting mirrorlist"; install_mirrorlist; }
al_repo "/etc/pacman.conf"
pacman -Syyu --noconfirm || die 1
tput cnorm
pacman -Syyu --noconfirm || exit 1
rm -rf /var/cache/pacman/pkg/* # */
pacman -S ${BASE_PKGS[*]} xorg-xinit --needed --noconfirm || die 1
pacman -S ${BASE_PKGS[*]} xorg-xinit --needed --noconfirm || exit 1
rm -rf /var/cache/pacman/pkg/* # */
case "$ses" in
$WM_PKG_SES)
pacman -S "$ses" ${WM_PKGS[*]} ${WM_EXT[$ses]} --needed --noconfirm || die 1
openbox|bspwm|i3-gaps|fluxbox|jwm|awesome)
pacman -S "$ses" ${WM_PKGS[*]} ${WM_EXT[$ses]} --needed --noconfirm || exit 1
;;
$SELF_CONTAINED)
pacman -S "$ses" ${WM_EXT[$ses]} --needed --noconfirm || die 1
gnome|cinnamon|deepin)
pacman -S "$ses" ${WM_EXT[$ses]} --needed --noconfirm || exit 1
;;
plasma)
pacman -S "$ses" --needed --noconfirm || exit 1
;;
dwm)
pacman -S git make gcc pkgconf --needed --noconfirm || die 1
pacman -S git make gcc pkgconf --needed --noconfirm || exit 1
install_suckless "/root" nochroot
;;
esac
@ -3147,7 +3155,7 @@ live()
cp -rfT /etc/skel /root
install_tearfree "/etc/X11/xorg.conf.d"
case "$ses" in
$SELF_CONTAINED)
plasma|gnome|cinnamon|deepin)
sed -i '/super/d; /nitrogen/d; /picom/d' /root/.xprofile
;;
dwm)
@ -3157,8 +3165,8 @@ live()
rm -f /root/.zlogin
echo -e "pulseaudio &\n(sleep 1; pamixer --unmute --set-volume 50) &" >> /root/.xprofile
sed -i "/exec/ c exec ${WM_SESSIONS[$ses]}" /root/.xinitrc
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
printf "\n%s has been set as the login session in ~/.xinitrc, to start it run\n\n\tstartx\n\n" "$ses"
exit 0
}
usage()