Auto adjust root size for live and only allow one session

This commit is contained in:
natemaia 2019-10-18 23:07:40 -07:00
parent d220b79629
commit 2c4b9333f5

View File

@ -2174,38 +2174,28 @@ msg()
live()
{
local e=0
local ses="$1"
if (( $# == 0 )); then
msg "No Session" "\nRunning live requires a session to use.\n\nExiting..\n" 2
clear
die 1
elif ! select_keymap; then
if ! select_keymap; then
clear
die 0
elif ! net_connect; then
msg "Not Connected" "\nRunning live requires an active internet connection.\n\nExiting..\n" 2
die 1
elif (( $(awk '/MemTotal/ {print int($2 / 1024)}' /proc/meminfo) < 4096)); then
msg "Not Enough Memory" "\nRunning live requires at least 4G of system memory.\n\nExiting..\n" 2
die 1
else
clear
mount /run/archiso/cowspace -o remount,size=2G
install_mirrorlist "/etc/pacman.d/mirrorlist"
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)
pacman -S git --needed --noconfirm || die 1
install_suckless "/root" nochroot
;;
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 ;;
esac
done
pacman -S $AL_BASE_PKGS xterm xorg-xinit xorg-server --needed --noconfirm || die 1
case "$ses" in
i3-gaps|oepnbox|fluxbox|bspwm|awesome) pacman -S "$ses" $WM_BASE_PKGS ${WM_EXT[$ses]} --needed --noconfirm || die 1 ;;
gnome|plasma|cinnamon|xfce4) pacman -S "$ses" ${WM_EXT[$ses]} --needed --noconfirm || die 1 ;;
dwm) { pacman -S git --needed --noconfirm || die 1; }; install_suckless "/root" nochroot ;;
esac
pacman -Scc --noconfirm
rm -rf "/var/cache/pacman/pkg/"*
cp -rfT /etc/skel /root || die 1
@ -2457,7 +2447,11 @@ else
case "$1" in
-d|--debug) debug ;;
-h|--help) usage "$0" ;;
-l|--live) shift; live "$@" ;;
-l|--live)
case "$2" in
gnome|cinnamon|dwm|plasma|xfce4|i3-gaps|oepnbox|fluxbox|bspwm|awesome) live "$2" ;;
*) echo "error: invalid session for -l, --live, see -h, --help"; die 1 ;;
esac ;;
esac
fi