Add: mksh as login shell choice. Fix: viewing debug log.

This commit is contained in:
natemaia 2018-12-01 13:50:15 -08:00
parent 8e1b4a6647
commit 678019d663
5 changed files with 50 additions and 45 deletions

View File

@ -32,7 +32,7 @@ declare -Agx EDIT_FILES=(
[8]="/etc/crypttab" [8]="/etc/crypttab"
[9]="/etc/default/grub" [9]="/etc/default/grub"
[10]="/etc/pacman.conf" [10]="/etc/pacman.conf"
[11]="" # login files, left empty, don't know the username yet for /home/USER/FILES [11]="" # empty login files, we don't know /home/USER?/FILES?
) )
prep_for_grub() prep_for_grub()

View File

@ -8,8 +8,7 @@
# shellcheck disable=2154,2034,2153 # shellcheck disable=2154,2034,2153
# mutable globals # mutable globals {
# {
declare -g WARN=false declare -g WARN=false
declare -g AUTOLOGIN=false declare -g AUTOLOGIN=false
@ -38,9 +37,26 @@ declare -g PACKAGES=""
declare -g MYSHELL="" declare -g MYSHELL=""
declare -g MKINIT_HOOKS="shutdown" declare -g MKINIT_HOOKS="shutdown"
# } declare -gA WM_SESSIONS=(
[i3-gaps]='i3'
[dwm]='dwm'
[openbox]='openbox-session'
[bspwm]='bspwm'
[xfce4]='startxfce4'
[gnome]='gnome-session'
[cinnamon]='cinnamon-session'
)
# basic dialog helper functions declare -gA WM_EXT=(
[dwm]="ttf-hack"
[bspwm]="sxhkd"
[gnome]="gnome-extra"
[i3-gaps]="i3status perl-anyevent-i3"
[xfce4]="xfce4-goodies xfce4-pulseaudio-plugin"
[openbox]="archlabs-obkey obconf archlabs-kickshaw tint2 archlabs-skippy-xd conky jgmenu"
)
# }
msgbox() msgbox()
{ {
@ -111,8 +127,6 @@ yesno()
fi fi
} }
# larger specific dialog menus
select_language() select_language()
{ {
tput civis tput civis
@ -289,15 +303,13 @@ select_timezone()
select_wm_or_de() select_wm_or_de()
{ {
declare -g PACKAGES=""
tput civis tput civis
if ! INSTALL_WMS="$(dialog --cr-wrap --stdout --backtitle "$BT" \ if ! INSTALL_WMS="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_WMChoice " --checklist "$_WMChoiceBody\n" 0 0 0 \ --title " $_WMChoice " --checklist "$_WMChoiceBody\n" 0 0 0 \
"openbox" "A lightweight, powerful, and highly configurable stacking window manager" off \
"bspwm" "A tiling window manager that represents windows as the leaves of a binary tree" off \
"i3-gaps" "A fork of i3 window manager with more features including gaps" off \ "i3-gaps" "A fork of i3 window manager with more features including gaps" off \
"dwm" "A customized fork of dwm, with patches and modifications" off \ "dwm" "A customized fork of dwm, with patches and modifications" off \
"openbox" "A lightweight, powerful, and highly configurable stacking window manager" off \
"bspwm" "A tiling window manager that represents windows as the leaves of a binary tree" off \
"gnome" "A desktop environment that aims to be simple and easy to use" off \ "gnome" "A desktop environment that aims to be simple and easy to use" off \
"cinnamon" "A desktop environment combining a traditional desktop layout with modern graphical effects" off \ "cinnamon" "A desktop environment combining a traditional desktop layout with modern graphical effects" off \
"xfce4" "A lightweight and modular desktop environment based on GTK+ 2 and 3" off)"; then "xfce4" "A lightweight and modular desktop environment based on GTK+ 2 and 3" off)"; then
@ -306,24 +318,18 @@ select_wm_or_de()
[[ $INSTALL_WMS ]] || INSTALL_WMS='openbox' [[ $INSTALL_WMS ]] || INSTALL_WMS='openbox'
WM_NUM=$(awk '{print NF}' <<< "$INSTALL_WMS") WM_NUM=$(awk '{print NF}' <<< "$INSTALL_WMS")
WM_PACKAGES="${INSTALL_WMS/dwm/}" # remove dwm as we are compiling from source WM_PACKAGES="${INSTALL_WMS/dwm/}" # remove dwm from package list
WM_PACKAGES="${WM_PACKAGES// / }" # remove double spaces from the string WM_PACKAGES="${WM_PACKAGES// / }" # remove double spaces
# packages needed for the selected WMs/DEs # packages needed for the selected WMs/DEs
for wm in $INSTALL_WMS; do for wm in $INSTALL_WMS; do
LOGIN_CHOICES="${LOGIN_CHOICES}$wm - " LOGIN_CHOICES="${LOGIN_CHOICES}$wm - "
case $wm in WM_PACKAGES+=" ${WM_EXT[$wm]}"
dwm) WM_PACKAGES+=" ttf-hack" ;;
bspwm) WM_PACKAGES+=" sxhkd" ;;
gnome) WM_PACKAGES+=" gnome-extra" ;;
i3-gaps) WM_PACKAGES+=" i3status perl-anyevent-i3" ;;
xfce4) WM_PACKAGES+=" xfce4-goodies xfce4-pulseaudio-plugin" ;;
openbox) WM_PACKAGES+=" archlabs-obkey obconf archlabs-kickshaw tint2 archlabs-skippy-xd conky jgmenu" ;;
esac
done done
if [[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps) ]]; then if [[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps) ]]; then
WM_PACKAGES+=" libmpdclient jsoncpp archlabs-screenlock termite archlabs-oblogout archlabs-polybar archlabs-paranoid rofi thunar" WM_PACKAGES+=" libmpdclient jsoncpp archlabs-screenlock termite archlabs-oblogout"
WM_PACKAGES+=" archlabs-polybar archlabs-paranoid rofi thunar"
elif [[ $INSTALL_WMS =~ xfce4 ]]; then elif [[ $INSTALL_WMS =~ xfce4 ]]; then
WM_PACKAGES+=" archlabs-oblogout archlabs-screenlock archlabs-paranoid" WM_PACKAGES+=" archlabs-oblogout archlabs-screenlock archlabs-paranoid"
fi fi
@ -331,33 +337,28 @@ select_wm_or_de()
# choose how to log in # choose how to log in
select_login_method || return 1 select_login_method || return 1
# choose which WM/DE to start at login # choose which WM/DE to start at login, only for xinit
if [[ $LOGIN_TYPE == 'xinit' ]]; then if [[ $LOGIN_TYPE == 'xinit' ]]; then
if [[ $WM_NUM -eq 1 ]]; then if [[ $WM_NUM -eq 1 ]]; then
LOGIN_WM="$INSTALL_WMS" LOGIN_WM="${WM_SESSIONS[$INSTALL_WMS]}"
else else
if ! LOGIN_WM="$(menubox "$_WMLogin" "$_WMLoginBody" 0 0 0 $LOGIN_CHOICES)"; then if ! LOGIN_WM="$(menubox "$_WMLogin" "$_WMLoginBody" 0 0 0 $LOGIN_CHOICES)"; then
return 1 return 1
else
LOGIN_WM="${WM_SESSIONS[$LOGIN_WM]}"
fi fi
fi fi
case $LOGIN_WM in
i3-gaps) LOGIN_WM='i3' ;;
xfce4) LOGIN_WM='startxfce4' ;;
gnome) LOGIN_WM='gnome-session' ;;
openbox) LOGIN_WM='openbox-session' ;;
cinnamon) LOGIN_WM='cinnamon-session' ;;
esac
# autologin
yesno "$_WMLogin" "$_AutoLoginBody\n" && AUTOLOGIN=true || AUTOLOGIN=false yesno "$_WMLogin" "$_AutoLoginBody\n" && AUTOLOGIN=true || AUTOLOGIN=false
else else
AUTOLOGIN=false AUTOLOGIN=false
fi fi
# add packages to the main package list # add packages to the main package list
PACKAGES="$WM_PACKAGES" if [[ $MYSHELL == *mksh ]]; then
return 0 declare -g PACKAGES="mksh $WM_PACKAGES"
else
declare -g PACKAGES="$WM_PACKAGES"
fi
} }
select_login_method() select_login_method()
@ -530,7 +531,7 @@ configure_system_settings()
user_creation || return 1 user_creation || return 1
tput civis tput civis
if ! MYSHELL="$(menubox "$_ShellTitle" "$_ShellBody" 0 0 0 '/bin/zsh' '-' '/bin/bash' '-')"; then if ! MYSHELL="$(menubox "$_ShellTitle" "$_ShellBody" 0 0 0 '/usr/bin/zsh' '-' '/bin/bash' '-' '/usr/bin/mksh' '-')"; then
return 1 return 1
fi fi
@ -576,7 +577,7 @@ edit_system_configs()
"9" "${BOOTLDR^}" "10" "Pacman.conf" "11" "${LOGIN_TYPE^}") "9" "${BOOTLDR^}" "10" "Pacman.conf" "11" "${LOGIN_TYPE^}")
if [[ ! $SELECTED || $SELECTED -eq 1 ]]; then if [[ ! $SELECTED || $SELECTED -eq 1 ]]; then
[[ $DEBUG == true ]] && more $DEBUG [[ $DEBUG == true && -r $DBG ]] && more $DBG
# when die() is passed 127 as the exit code it will issue `systemctl -i reboot` # when die() is passed 127 as the exit code it will issue `systemctl -i reboot`
die 127 die 127
else else
@ -589,7 +590,11 @@ edit_system_configs()
vim -O $existing_files vim -O $existing_files
else else
for f in $existing_files; do for f in $existing_files; do
if hash nano >/dev/null 2>&1; then nano $f; else vi $f; fi if hash nano >/dev/null 2>&1; then
nano "$f"
else
vi "$f"
fi
done done
fi fi
else else

View File

@ -240,9 +240,9 @@ EOF
# automatic startx for login shells # automatic startx for login shells
case $MYSHELL in case $MYSHELL in
/bin/bash) local loginrc=".bash_profile" ;; *bash) local loginrc=".bash_profile" ;;
/usr/bin/zsh) local loginrc=".zprofile" ;; *zsh) local loginrc=".zprofile" ;;
/usr/bin/mksh) local loginrc=".profile" ;; *mksh) local loginrc=".profile" ;;
esac esac
# add the shell login file to the edit list after install # add the shell login file to the edit list after install

View File

@ -128,7 +128,7 @@ luks_default()
cryptsetup open $LUKS_PART "$LUKS_NAME" <<< "$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")" 2>$ERR cryptsetup open $LUKS_PART "$LUKS_NAME" <<< "$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")" 2>$ERR
echeck "cryptsetup open $LUKS_PART $LUKS_NAME" echeck "cryptsetup open $LUKS_PART $LUKS_NAME"
LUKS=' encrypted' export LUKS=' encrypted'
luks_show luks_show
return 0 return 0
} }

View File

@ -149,10 +149,10 @@ system_checks()
[[ $(whoami) == "root" ]] || { infobox "$_ErrTitle" "$_NotRoot\n$_Exit" && die 1; } [[ $(whoami) == "root" ]] || { infobox "$_ErrTitle" "$_NotRoot\n$_Exit" && die 1; }
grep -qw 'lm' /proc/cpuinfo || { infobox "$_ErrTitle" "$_Not64Bit\n$_Exit" && die 1; } grep -qw 'lm' /proc/cpuinfo || { infobox "$_ErrTitle" "$_Not64Bit\n$_Exit" && die 1; }
if ! curl -s --head 'https://www.archlinux.org/mirrorlist/all/' | head -n 1 | grep -q '200'; then if ! curl -s --head 'https://www.archlinux.org/mirrorlist/all/' | sed '1q' | grep -qw '200'; then
if [[ $(systemctl is-active NetworkManager) == "active" ]] && hash nmtui >/dev/null 2>&1; then if [[ $(systemctl is-active NetworkManager) == "active" ]] && hash nmtui >/dev/null 2>&1; then
tput civis; nmtui-connect tput civis; nmtui-connect
if curl -s --head 'https://www.archlinux.org/mirrorlist/all/' | head -n 1 | grep -q '200'; then if curl -s --head 'https://www.archlinux.org/mirrorlist/all/' | sed '1q' | grep -qw '200'; then
export HAS_NETWORK=true export HAS_NETWORK=true
else else
infobox "$_ErrTitle" "$_NoNetwork" 3 infobox "$_ErrTitle" "$_NoNetwork" 3