Add awesome config session from @elenapan, pull output from background process if needed rather than blank looping

This commit is contained in:
natemaia 2019-04-29 22:57:17 -07:00
parent 4c6c9775e5
commit 593097408f

View File

@ -11,10 +11,10 @@ MNT="/mnt" # install mountpoint
ANS="/tmp/ans" # dialog answer file
# --------------------------------------------- #
# ------------------------------------------------------ #
# if you manually mount your partitions then you
# need to set these values to avoid issues.
# --------------------------------------------- #
# need to set these values to avoid using the mount menu.
# ------------------------------------------------------ #
# root partition, eg/ /dev/sda2
ROOT_PART=''
@ -34,13 +34,7 @@ BOOTLDR=''
# this will need to be 'boot' however a popular one for grub is 'boot/efi'
BOOTDIR='boot'
# swap partition or file path
SWAP_PART=''
# swap size, only used when creating a swapfile
SWAP_SIZE=''
# --------------------------------------------- #
# ------------------------------------------------------ #
# bulk default values {
@ -88,6 +82,9 @@ FORMATTED='' # partitions we formatted and should allow skipping
AUTO_ROOT_PART='' # root value from auto partition
AUTO_BOOT_PART='' # boot value from auto partition
SWAP_PART='' # swap partition or file path
SWAP_SIZE='' # swap size, only used when creating a swapfile
# iso base, pacstrap when running the installer from a stock arch iso
ISO_BASE="b43-firmware b43-fwcutter broadcom-wl clonezilla dhclient dhcpcd ethtool wpa_supplicant "
ISO_BASE+="exfat-utils f2fs-tools gptfdisk vim hdparm ipw2100-fw ipw2200-fw nfs-utils nilfs-utils ntfs-3g "
@ -121,29 +118,18 @@ export DIALOGOPTS="--cr-wrap"
# giant ugly variable container :P {
# RAM in the system in MB
SYS_MEM="$(awk '/MemTotal/ {
print int($2 / 1024)"M"
}' /proc/meminfo)"
SYS_MEM="$(awk '/MemTotal/ {print int($2 / 1024) "M"}' /proc/meminfo)"
# locales from /etc/locale.gen
LOCALES="$(awk '/\.UTF-8/ {
gsub(/# .*|#/, "")
if ($1) {
print $1 " - "
}
}' /etc/locale.gen)"
LOCALES="$(awk '/\.UTF-8/ {gsub(/# .*|#/, ""); if ($1) {print $1 " - "}}' /etc/locale.gen)"
# linux console keyboard mappings
CMAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' | awk '{
gsub(/\.map\.gz|.*\//, "")
print $1 " - "
}' | sort)"
CMAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' | awk '{gsub(/\.map\.gz|.*\//, ""); print $1 " - "}' | sort)"
# terminal size definitions
# {
[[ $LINES ]] || LINES=$(tput lines)
[[ $COLUMNS ]] || COLUMNS=$(tput cols)
SHL=$((LINES - 20)) # }
SHL=$((LINES - 20))
# associative arrays
# {
@ -162,6 +148,7 @@ declare -A WM_SESSIONS=(
[dwm]='dwm'
[i3-gaps]='i3'
[bspwm]='bspwm'
[awesome]='awesome'
[plasma]='startkde'
[xfce4]='startxfce4'
[gnome]='gnome-session'
@ -174,6 +161,7 @@ declare -A WM_SESSIONS=(
declare -A WM_EXT=(
[dwm]=''
[gnome]=''
[awesome]='awesome'
[plasma]='kdebase-meta'
[bspwm]='sxhkd archlabs-skel-bspwm rofi archlabs-polybar'
[fluxbox]='archlabs-skel-fluxbox archlabs-polybar jgmenu rofi lxmenu-data'
@ -585,8 +573,9 @@ select_sessions()
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[*]}")" \
awesome "A customized Awesome WM session created by @elanapan" "$(ofn awesome "${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[*]}")" \
dwm "A fork of dwm, with more layouts and features" "$(ofn dwm "${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[*]}")" \
@ -1340,8 +1329,12 @@ install_main()
install_base()
{
if [[ $RSYNC_PID || $MIRROR_PID ]]; then
clear
printf "\nOne or more background install processes are still running, grabbing their output...\n"
sleep 2
while kill -0 "$RSYNC_PID" 2>/dev/null || kill -0 "$MIRROR_PID" 2>/dev/null; do
clear; printf "\nOne or more background install processes are still running...\n"; sleep 1
tail -n 1 /tmp/bg_out
sleep 0.5
done
trap - EXIT
unset RSYNC_PID MIRROR_PID
@ -1353,10 +1346,10 @@ install_base()
else
mkdir -p /etc/pacman.d/mirrorlist
install_mirrorlist "/etc/pacman.d/mirrorlist"
pacstrap $MNT base $ISO_BASE 2>$ERR
pacstrap "$MNT" base $ISO_BASE 2>$ERR
errshow 1 "pacstrap $MNT base $KERNEL $ISO_BASE"
mkdir -p $MNT/etc/pacman.d/mirrorlist
cp -f "/etc/pacman.d/mirrorlist" "$MNT/etc/pacman.d/mirrorlist"
mkdir -p "$MNT/etc/pacman.d/mirrorlist"
cp -f /etc/pacman.d/mirrorlist "$MNT/etc/pacman.d/mirrorlist"
chrun "pacman -Syyu --noconfirm && pacman -S $BASE_PKGS --needed --noconfirm"
fi
@ -1482,13 +1475,14 @@ install_user()
chrun "chpasswd <<< '$NEWUSER:$USER_PASS'" 2>$ERR
errshow 1 "set $NEWUSER password"
if [[ $USER_PKGS == *neovim* ]]; then
if [[ $USER_PKGS == *neovim* && -d $MNT/home/$NEWUSER/.vim ]]; then
mkdir -p $MNT/home/$NEWUSER/.config/nvim
cp -fv $MNT/home/$NEWUSER/.vimrc $MNT/home/$NEWUSER/.config/nvim/init.vim
cp -rfv $MNT/home/$NEWUSER/.vim/colors $MNT/home/$NEWUSER/.config/nvim/colors
fi
[[ $INSTALL_WMS == *dwm* ]] && install_suckless
[[ $INSTALL_WMS == *awesome* ]] && install_awesome
[[ $LOGIN_WM =~ (startkde|gnome-session) ]] && sed -i '/super/d' $MNT/home/$NEWUSER/.xprofile /root/.xprofile
return 0
@ -1545,6 +1539,19 @@ position=30%,end 50%,end
EOF
}
install_awesome()
{
if chrun "git clone https://github.com/elenapan/archlabs-awesome /home/$NEWUSER/archlabs-awesome"; then
cp -rT "/mnt/home/$NEWUSER/archlabs-awesome" "/mnt/home/$NEWUSER"
cp -rT "/mnt/home/$NEWUSER/archlabs-awesome" /mnt/etc/skel
rm -rf "/home/$NEWUSER/"{.git,archlabs-awesome,screenshots}
printf "You will need to instal pamac seperately if needed using: 'baph -i pamac-aur'\n"
sleep 3
else
printf "failed to clone awesome config repo\n"
fi
}
install_packages()
{
local rmpkg=""
@ -1592,7 +1599,6 @@ install_packages()
install_suckless()
{
mkdir -pv $MNT/home/$NEWUSER/suckless
for i in dwm dmenu st; do
if chrun "git clone https://git.suckless.org/$i /home/$NEWUSER/suckless/$i"; then
chrun "cd /home/$NEWUSER/suckless/$i; make PREFIX=/usr install; make clean; rm config.h"
@ -1660,7 +1666,7 @@ install_background()
yesno "Background Install" "\nSome parts of the install can be done in the background now, base unpack, mirrorlist sort, system update, and base packages.\n\nDo you want to start the background process?\n" || return 0
rsync -a /run/archiso/sfs/airootfs/ $MNT/ &
RSYNC_PID=$!
( install_mirrorlist "$MNT/etc/pacman.d/mirrorlist" && chrun "pacman -Syyu $BASE_PKGS --needed --noconfirm" >/dev/null 2>&1 ) &
( install_mirrorlist "$MNT/etc/pacman.d/mirrorlist" && chrun "pacman -Syyu $BASE_PKGS --needed --noconfirm" >> /tmp/bg_out 2>&1 ) &
MIRROR_PID=$!
trap "kill $RSYNC_PID 2>/dev/null; kill $MIRROR_PID 2>/dev/null" EXIT
fi