Require passing in which session to use for live

This commit is contained in:
natemaia 2019-09-02 16:36:57 -07:00
parent 2d9a96c64b
commit b0f6091391

View File

@ -14,7 +14,7 @@
# will result in "My Distro Linux" used where needed # will result in "My Distro Linux" used where needed
: ${DIST="ArchLabs"} : ${DIST="ArchLabs"}
VER="2.0.67" # installer version VER="2.0.68" # installer version
MNT="/mnt" # install mountpoint MNT="/mnt" # install mountpoint
ANS="/tmp/ans" # dialog answer file ANS="/tmp/ans" # dialog answer file
@ -559,18 +559,17 @@ select_keymap()
select_sessions() select_sessions()
{ {
LOGIN_CHOICES='' LOGIN_CHOICES=''
dlg INSTALL_WMS check "Sessions" "$_sessions\n" \ dlg INSTALL_WMS check "Sessions" "$_sessions\n" \
i3-gaps "A fork of i3wm with more features including gaps" "$(ofn i3-gaps "${INSTALL_WMS[*]}")" \
openbox "A lightweight, powerful, and highly configurable stacking wm" "$(ofn openbox "${INSTALL_WMS[*]}")" \ openbox "A lightweight, powerful, and highly configurable stacking wm" "$(ofn openbox "${INSTALL_WMS[*]}")" \
awesome "A customized Awesome WM session created by @elanapan" "$(ofn awesome "${INSTALL_WMS[*]}")" \ i3-gaps "A fork of i3wm with more features including gaps" "$(ofn i3-gaps "${INSTALL_WMS[*]}")" \
dwm "A dynamic WM for X that manages windows in tiled, floating, or monocle layouts" "$(ofn dwm "${INSTALL_WMS[*]}")" \ dwm "A dynamic WM for X that manages windows in tiled, floating, or monocle layouts" "$(ofn dwm "${INSTALL_WMS[*]}")" \
bspwm "A tiling wm that represents windows as the leaves of a binary tree" "$(ofn bspwm "${INSTALL_WMS[*]}")" \ bspwm "A tiling wm that represents windows as the leaves of a binary tree" "$(ofn bspwm "${INSTALL_WMS[*]}")" \
xfce4 "A lightweight and modular desktop environment based on gtk+2/3" "$(ofn xfce4 "${INSTALL_WMS[*]}")" \
awesome "A customized Awesome WM session created by @elanapan" "$(ofn awesome "${INSTALL_WMS[*]}")" \
fluxbox "A lightweight and highly-configurable window manager" "$(ofn fluxbox "${INSTALL_WMS[*]}")" \ fluxbox "A lightweight and highly-configurable window manager" "$(ofn fluxbox "${INSTALL_WMS[*]}")" \
gnome "A desktop environment that aims to be simple and easy to use" "$(ofn gnome "${INSTALL_WMS[*]}")" \
cinnamon "A desktop environment combining traditional desktop with modern effects" "$(ofn cinnamon "${INSTALL_WMS[*]}")" \
plasma "A kde software project currently comprising a full desktop environment" "$(ofn plasma "${INSTALL_WMS[*]}")" \ plasma "A kde software project currently comprising a full desktop environment" "$(ofn plasma "${INSTALL_WMS[*]}")" \
xfce4 "A lightweight and modular desktop environment based on gtk+2/3" "$(ofn xfce4 "${INSTALL_WMS[*]}")" gnome "A desktop environment that aims to be simple and easy to use" "$(ofn gnome "${INSTALL_WMS[*]}")" \
cinnamon "A desktop environment combining traditional desktop with modern effects" "$(ofn cinnamon "${INSTALL_WMS[*]}")"
[[ $INSTALL_WMS ]] || return 0 [[ $INSTALL_WMS ]] || return 0
@ -719,9 +718,9 @@ part_menu()
"cfdisk" "Curses based variant of fdisk" \ "cfdisk" "Curses based variant of fdisk" \
"parted" "GNU partition editor" \ "parted" "GNU partition editor" \
"fdisk" "Dialog-driven creation and manipulation of partitions" \ "fdisk" "Dialog-driven creation and manipulation of partitions" \
"done" "Return to the main menu" || return 0 "done" "Return to the main menu"
if [[ $choice == 'done' ]]; then if [[ -z $choice || $choice == 'done' ]]; then
return 0 return 0
elif [[ $choice == 'shrink' ]]; then elif [[ $choice == 'shrink' ]]; then
part_shrink "$device" part_shrink "$device"
@ -2258,7 +2257,7 @@ dlg()
shift 4 # shift off args assigned above shift 4 # shift off args assigned above
# adjust $n when passed a large list # adjust n when passed a large list
local l=$((LINES - 20)) local l=$((LINES - 20))
(( ($# / 2) > l )) && n=$l (( ($# / 2) > l )) && n=$l
@ -2302,10 +2301,20 @@ live()
net_connect || { msg "Not Connected" "\nRunning live requires an active internet connection.\n\nExiting..\n" 2; die 1; } net_connect || { msg "Not Connected" "\nRunning live requires an active internet connection.\n\nExiting..\n" 2; die 1; }
trap - INT trap - INT
pacman -Syyu --noconfirm || die 1 pacman -Syyu --noconfirm || die 1
pacman -S $AL_BASE_PKGS $WM_BASE_PKGS archlabs-skel-openbox openbox xterm xorg-xinit xorg-server --needed --noconfirm || die 1 pacman -S $AL_BASE_PKGS $WM_BASE_PKGS xorg-xinit xorg-server --needed --noconfirm || die 1
case "$1" in
dwm) pacman -S git --needed --noconfirm || die 1
mkdir -pv /root/suckless
for i in dwm dmenu st; do
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) pacman -S "$1" ${WM_EXT[$1]} xterm --needed --noconfirm ;;
*) echo "error: invalid session for -l, --live, see -h, --help"; die 1 ;;
esac
pacman -Scc --noconfirm # these get back some space pacman -Scc --noconfirm # these get back some space
rm -rf /var/cache/pacman/pkg/* rm -rf /var/cache/pacman/pkg/*
cp -rfT /etc/skel /root || die 1 cp -rfT /etc/skel /root || die 1
sed -i "/exec/ c exec ${WM_SESSIONS[$1]}" /root/.xinitrc
startx startx
die 0 die 0
} }
@ -2514,10 +2523,31 @@ if (( UID != 0 )); then
elif ! grep -qwm 1 'lm' /proc/cpuinfo; then elif ! grep -qwm 1 'lm' /proc/cpuinfo; then
msg "Not x86_64 Architecture" "\nThis installer only supports x86_64 architectures.\n\nExiting..\n" 2 msg "Not x86_64 Architecture" "\nThis installer only supports x86_64 architectures.\n\nExiting..\n" 2
die 1 die 1
elif [[ $1 =~ (-h|--help) ]]; then
cat <<-EOF
usage: $0 [-hdl] [session]
options:
-h, --help print this message and exit
-d, --debug enable debugging and log to $DBG
-l, --live install and setup a live session
sessions:
i3-gaps - A fork of i3wm with more features including gaps
openbox - A lightweight, powerful, and highly configurable stacking wm
dwm - A dynamic WM for X that manages windows in tiled, floating, or monocle layouts
awesome - A customized Awesome WM session created by @elanapan
bspwm - A tiling wm that represents windows as the leaves of a binary tree
fluxbox - A lightweight and highly-configurable window manager
gnome - A desktop environment that aims to be simple and easy to use
cinnamon - A desktop environment combining traditional desktop with modern effects
plasma - A kde software project currently comprising a full desktop environment
xfce4 - A lightweight and modular desktop environment based on gtk+2/3
EOF
elif [[ $1 =~ (-d|--debug) ]]; then elif [[ $1 =~ (-d|--debug) ]]; then
debug debug
elif [[ $1 =~ (-l|--live) ]]; then elif [[ $1 =~ (-l|--live) ]]; then
live live "$@"
fi fi
# trap ^C to perform cleanup # trap ^C to perform cleanup