Shorten some main function names, remove specifics for user wm configs
This commit is contained in:
parent
ba91ed8b79
commit
529166b83c
@ -19,43 +19,43 @@ readonly DBG="/tmp/debuglog" # Built-in error log
|
|||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
if [[ $CURRENT_MENU != "main" ]]; then
|
if [[ $CURRENT_MENU != "main" ]]; then
|
||||||
|
SELECTED=1
|
||||||
|
CURRENT_MENU="main"
|
||||||
if [[ $SAVED ]]; then
|
if [[ $SAVED ]]; then
|
||||||
SELECTED=$((SAVED + 1))
|
SELECTED=$((SAVED + 1))
|
||||||
unset SAVED
|
unset SAVED
|
||||||
else
|
|
||||||
SELECTED=1
|
|
||||||
fi
|
fi
|
||||||
CURRENT_MENU="main"
|
elif (( SELECTED < 8 )); then
|
||||||
elif (( SELECTED < 9 )); then
|
|
||||||
((SELECTED++)) # increment the highlighted menu item
|
((SELECTED++)) # increment the highlighted menu item
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tput civis
|
tput civis
|
||||||
SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||||
--title " $_PrepTitle " --default-item $SELECTED --menu "$_PrepBody" 0 0 0 \
|
--title " $_PrepTitle " --default-item $SELECTED \
|
||||||
"1" "$_PrepShowDev" "2" "$_PrepParts" "3" "$_PrepLUKS" "4" "$_PrepLVM" \
|
--menu "$_PrepBody" 0 0 0 \
|
||||||
"5" "$_PrepMount" "6" "$_PrepConfig" "7" "Check Choices" "8" "$_PrepInstall" \
|
"1" "$_PrepShowDev" "2" "$_PrepParts" \
|
||||||
"9" "$_Done")
|
"3" "$_PrepLUKS" "4" "$_PrepLVM" \
|
||||||
|
"5" "$_PrepMount" "6" "$_PrepConfig" \
|
||||||
|
"7" "Check Choices" "8" "$_PrepInstall")
|
||||||
|
|
||||||
# if trying to install the system, make sure the partitions are mounted
|
|
||||||
# and that the needed config variables and user variables have been set up
|
|
||||||
if [[ $SELECTED ]]; then
|
if [[ $SELECTED ]]; then
|
||||||
if [[ $SELECTED -eq 8 || $SELECTED -eq 6 ]]; then
|
if (( SELECTED == 8 )); then
|
||||||
{ [[ $SELECTED -eq 8 ]] && preinstall_checks 1 || preinstall_checks; } || return 1
|
preinstall_checks 1 || return 1
|
||||||
elif [[ ($SELECTED -eq 2 || $SELECTED -eq 5) && $WARN != true ]]; then
|
elif (( SELECTED == 6 )); then
|
||||||
|
preinstall_checks || return 1
|
||||||
|
elif (( SELECTED == 2 || SELECTED == 5 )) && [[ $WARN != true ]]; then
|
||||||
msgbox "$_PrepTitle" "$_WarnMount" && WARN=true
|
msgbox "$_PrepTitle" "$_WarnMount" && WARN=true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# setting $SELECTED to ($SELECTED - 1) when failing keeps the highlight
|
|
||||||
case $SELECTED in
|
case $SELECTED in
|
||||||
1) device_tree ;;
|
1) device_tree ;;
|
||||||
2) partition || SELECTED=1 ;;
|
2) partition || SELECTED=$((SELECTED - 1)) ;;
|
||||||
3) luks_menu || SELECTED=2 ;;
|
3) luks_menu || SELECTED=$((SELECTED - 1)) ;;
|
||||||
4) lvm_menu || SELECTED=3 ;;
|
4) lvm_menu || SELECTED=$((SELECTED - 1)) ;;
|
||||||
5) select_partitions || SELECTED=4 ;;
|
5) mnt_menu || SELECTED=$((SELECTED - 1)) ;;
|
||||||
6) configure_settings || SELECTED=5 ;;
|
6) cfg_menu || SELECTED=$((SELECTED - 1)) ;;
|
||||||
7) display_settings ;;
|
7) show_cfg ;;
|
||||||
8) install ;;
|
8) install ;;
|
||||||
*) yesno "$_CloseInst" "$_CloseInstBody" "Exit" "Back" && die
|
*) yesno "$_CloseInst" "$_CloseInstBody" "Exit" "Back" && die
|
||||||
esac
|
esac
|
||||||
|
@ -39,22 +39,22 @@ declare -g MKINIT_HOOKS="shutdown"
|
|||||||
|
|
||||||
# match the wm name with the actual session name used for xinit
|
# match the wm name with the actual session name used for xinit
|
||||||
declare -gA WM_SESSIONS=(
|
declare -gA WM_SESSIONS=(
|
||||||
[i3-gaps]='i3'
|
|
||||||
[dwm]='dwm'
|
[dwm]='dwm'
|
||||||
[openbox]='openbox-session'
|
[i3-gaps]='i3'
|
||||||
[bspwm]='bspwm'
|
[bspwm]='bspwm'
|
||||||
[xfce4]='startxfce4'
|
[xfce4]='startxfce4'
|
||||||
[gnome]='gnome-session'
|
[gnome]='gnome-session'
|
||||||
|
[openbox]='openbox-session'
|
||||||
[cinnamon]='cinnamon-session'
|
[cinnamon]='cinnamon-session'
|
||||||
)
|
)
|
||||||
|
|
||||||
# additional packages installed for the given window manager
|
# additional packages installed for the given window manager
|
||||||
declare -gA WM_EXT=(
|
declare -gA WM_EXT=(
|
||||||
[bspwm]="sxhkd libmpdclient archlabs-skel-bspwm jsoncpp archlabs-screenlock archlabs-polybar rofi"
|
|
||||||
[gnome]="gnome-extra"
|
[gnome]="gnome-extra"
|
||||||
|
[bspwm]="sxhkd libmpdclient archlabs-skel-bspwm jsoncpp archlabs-screenlock archlabs-polybar rofi"
|
||||||
[i3-gaps]="i3status perl-anyevent-i3 libmpdclient archlabs-skel-i3-gaps jsoncpp archlabs-screenlock archlabs-polybar rofi"
|
[i3-gaps]="i3status perl-anyevent-i3 libmpdclient archlabs-skel-i3-gaps jsoncpp archlabs-screenlock archlabs-polybar rofi"
|
||||||
[xfce4]="xfce4-goodies xfce4-pulseaudio-plugin archlabs-skel-xfce4"
|
[xfce4]="xfce4-goodies xfce4-pulseaudio-plugin archlabs-skel-xfce4"
|
||||||
[openbox]="archlabs-obkey obconf archlabs-kickshaw tint2 archlabs-oblogout jgmenu archlabs-skel-openbox tint2 archlabs-skippy-xd conky thunar termite libmpdclient jsoncpp archlabs-screenlock archlabs-paranoid archlabs-polybar rofi zenity"
|
[openbox]="archlabs-obkey obconf archlabs-kickshaw archlabs-oblogout jgmenu archlabs-skel-openbox tint2 archlabs-skippy-xd conky libmpdclient jsoncpp archlabs-screenlock archlabs-paranoid archlabs-polybar rofi zenity"
|
||||||
)
|
)
|
||||||
|
|
||||||
# files the user can edit during the final stage of install
|
# files the user can edit during the final stage of install
|
||||||
@ -73,73 +73,94 @@ declare -gA EDIT_FILES=(
|
|||||||
|
|
||||||
# }
|
# }
|
||||||
|
|
||||||
msgbox()
|
show_cfg()
|
||||||
{
|
{
|
||||||
tput civis
|
local cmd mnt pkgs
|
||||||
dialog --cr-wrap --backtitle "$BT" --title " $1 " --msgbox "$2\n" 0 0
|
cmd="${BCMDS[$BOOTLDR]}"
|
||||||
|
mnt="${BMNTS[$SYS-$BOOTLDR]}"
|
||||||
|
msgbox "$_PrepTitle" "
|
||||||
|
|
||||||
|
---------- PARTITION CONFIGURATION ------------
|
||||||
|
|
||||||
|
Root: ${ROOT_PART:-None}
|
||||||
|
Boot: ${BOOT_PART:-${BOOT_DEVICE:-None}}
|
||||||
|
|
||||||
|
Swap: ${SWAP_PART:-None}
|
||||||
|
Size: ${SWAP_SIZE:-None}
|
||||||
|
|
||||||
|
Extra: ${EXTRA_MNTS:-${EXTRA_MNT:-None}}
|
||||||
|
Hooks: ${MKINIT_HOOKS:-None}
|
||||||
|
|
||||||
|
LVM: ${LVM:-None}
|
||||||
|
LUKS: ${LUKS:-None}
|
||||||
|
|
||||||
|
|
||||||
|
---------- BOOTLOADER CONFIGURATION -----------
|
||||||
|
|
||||||
|
Loader: ${BOOTLDR:-None}
|
||||||
|
Mount: ${mnt:-None}
|
||||||
|
Command: ${cmd:-None}
|
||||||
|
|
||||||
|
|
||||||
|
------------ SYSTEM CONFIGURATION -------------
|
||||||
|
|
||||||
|
Locale: ${LOCALE:-None}
|
||||||
|
Keymap: ${KEYMAP:-None}
|
||||||
|
Hostname: ${HOSTNAME:-None}
|
||||||
|
Timezone: ${ZONE:-None}/${SUBZONE:-None}
|
||||||
|
|
||||||
|
|
||||||
|
------------ LOGIN CONFIGURATION --------------
|
||||||
|
|
||||||
|
User: ${NEWUSER:-None}
|
||||||
|
Shell: ${MYSHELL:-None}
|
||||||
|
Session: ${LOGIN_WM:-None}
|
||||||
|
Autologin: ${AUTOLOGIN:-None}
|
||||||
|
Management: ${LOGIN_TYPE:-None}
|
||||||
|
|
||||||
|
|
||||||
|
------------ PACKAGES AND MIRRORS -------------
|
||||||
|
|
||||||
|
Kernel: ${KERNEL:-None}
|
||||||
|
Sessions: ${INSTALL_WMS:-None}
|
||||||
|
Mirrors: ${MIRROR_CMD:-None}
|
||||||
|
Packages: $(print4 "${PACKAGES:-None}")
|
||||||
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
menubox()
|
cfg_menu()
|
||||||
{
|
{
|
||||||
local title="$1"
|
tput cnorm
|
||||||
local body="$2"
|
if ! HOSTNAME="$(getinput "$_ConfHost" "$_HostNameBody" "${DIST,,}")"; then
|
||||||
local h=$3
|
|
||||||
local w=$4
|
|
||||||
local n=$5
|
|
||||||
shift 5
|
|
||||||
local response
|
|
||||||
if ! response="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " --menu "$body" $h $w $n "$@")"; then
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
printf "%s" "$response"
|
|
||||||
}
|
|
||||||
|
|
||||||
checkbox()
|
tput civis
|
||||||
{
|
if ! LOCALE="$(menubox "$_ConfLocale" "$_LocaleBody" 25 70 20 $LOCALES)"; then
|
||||||
local title="$1"
|
|
||||||
local body="$2"
|
|
||||||
local h=$3
|
|
||||||
local w=$4
|
|
||||||
local n=$5
|
|
||||||
shift 5
|
|
||||||
local response
|
|
||||||
if ! response="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " --checklist "$body" $h $w $n "$@")"; then
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
printf "%s" "$response"
|
|
||||||
}
|
|
||||||
|
|
||||||
getinput()
|
select_timezone || return 1
|
||||||
{
|
user_creation || return 1
|
||||||
local answer
|
|
||||||
if ! answer="$(dialog --cr-wrap --max-input 63 --stdout --no-cancel --backtitle "$BT" --title " $1 " --inputbox "$2" 0 0 "$3")" || [[ $answer == '' ]]; then
|
tput civis
|
||||||
|
if ! MYSHELL="$(menubox "$_ShellTitle" "$_ShellBody" 0 0 0 '/usr/bin/zsh' '-' '/bin/bash' '-' '/usr/bin/mksh' '-')"; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
printf "%s" "$answer"
|
|
||||||
}
|
|
||||||
|
|
||||||
infobox()
|
if ! KERNEL="$(menubox "$_KernelTitle" "$_KernelBody" 0 0 0 'linux' '-' 'linux-lts' '-')"; then
|
||||||
{
|
return 1
|
||||||
local sec="$3"
|
|
||||||
tput civis
|
|
||||||
dialog --cr-wrap --backtitle "$BT" --title " $1 " --infobox "$2\n" 0 0
|
|
||||||
sleep ${sec:-2}
|
|
||||||
}
|
|
||||||
|
|
||||||
yesno()
|
|
||||||
{
|
|
||||||
# usage: yesno <title> <text> [<yes_label> <no_label> [<no>]]
|
|
||||||
# three options: one --default-no and custom labels, one just custom labels, and one basic.
|
|
||||||
tput civis
|
|
||||||
if [[ $# -eq 5 && $5 == "no" ]]; then
|
|
||||||
dialog --cr-wrap --backtitle "$BT" --defaultno --title " $1 " \
|
|
||||||
--yes-label "$3" --no-label "$4" --yesno "$2\n" 0 0
|
|
||||||
elif [[ $# -eq 4 ]]; then
|
|
||||||
dialog --cr-wrap --backtitle "$BT" --title " $1 " --yes-label "$3" \
|
|
||||||
--no-label "$4" --yesno "$2\n" 0 0
|
|
||||||
else
|
|
||||||
dialog --cr-wrap --backtitle "$BT" --title " $1 " --yesno "$2\n" 0 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
select_mirrorcmd || return 1
|
||||||
|
|
||||||
|
yesno "$_DevelTitle" "$_DevelBody" && BASEDEV=true || BASEDEV=false
|
||||||
|
|
||||||
|
select_wm_or_de || return 1
|
||||||
|
select_packages || return 1
|
||||||
|
|
||||||
|
export CONFIG_DONE=true
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
select_language()
|
select_language()
|
||||||
@ -199,13 +220,10 @@ user_creation()
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local user
|
local user pass pass2 rpass rpass2
|
||||||
user="$(awk -F'~' '{print $1}' <<< "$values")"
|
user="$(awk -F'~' '{print $1}' <<< "$values")"
|
||||||
local pass pass2
|
|
||||||
pass="$(awk -F'~' '{print $2}' <<< "$values")"
|
pass="$(awk -F'~' '{print $2}' <<< "$values")"
|
||||||
pass2="$(awk -F'~' '{print $3}' <<< "$values")"
|
pass2="$(awk -F'~' '{print $3}' <<< "$values")"
|
||||||
|
|
||||||
local rpass rpass2
|
|
||||||
rpass="$(awk -F'~' '{print $5}' <<< "$values")"
|
rpass="$(awk -F'~' '{print $5}' <<< "$values")"
|
||||||
rpass2="$(awk -F'~' '{print $6}' <<< "$values")"
|
rpass2="$(awk -F'~' '{print $6}' <<< "$values")"
|
||||||
|
|
||||||
@ -213,7 +231,9 @@ user_creation()
|
|||||||
[[ $rpass == "" && $rpass2 == "" ]] && { rpass="$pass"; rpass2="$pass2"; }
|
[[ $rpass == "" && $rpass2 == "" ]] && { rpass="$pass"; rpass2="$pass2"; }
|
||||||
|
|
||||||
# make sure a username was entered and that the passwords match
|
# make sure a username was entered and that the passwords match
|
||||||
if [[ ${#user} -eq 0 || $user =~ \ |\' || $user =~ [^a-z0-9] || $pass == "" || "$pass" != "$pass2" || "$rpass" != "$rpass2" ]]; then
|
if [[ ${#user} -eq 0 || $user =~ \ |\' || $user =~ [^a-z0-9] ||
|
||||||
|
$pass == "" || "$pass" != "$pass2" || "$rpass" != "$rpass2" ]]
|
||||||
|
then
|
||||||
if [[ $pass == "" || "$pass" != "$pass2" || "$rpass" != "$rpass2" ]]; then
|
if [[ $pass == "" || "$pass" != "$pass2" || "$rpass" != "$rpass2" ]]; then
|
||||||
# password was left empty or doesn't match
|
# password was left empty or doesn't match
|
||||||
if [[ $pass == "" ]]; then
|
if [[ $pass == "" ]]; then
|
||||||
@ -330,7 +350,7 @@ select_wm_or_de()
|
|||||||
done
|
done
|
||||||
|
|
||||||
# choose how to log in
|
# choose how to log in
|
||||||
select_login_method || return 1
|
select_login || return 1
|
||||||
|
|
||||||
# choose which WM/DE to start at login, only for xinit
|
# choose which WM/DE to start at login, only for xinit
|
||||||
if [[ $LOGIN_TYPE == 'xinit' ]]; then
|
if [[ $LOGIN_TYPE == 'xinit' ]]; then
|
||||||
@ -352,7 +372,7 @@ select_wm_or_de()
|
|||||||
declare -g PACKAGES="$WM_PACKAGES"
|
declare -g PACKAGES="$WM_PACKAGES"
|
||||||
}
|
}
|
||||||
|
|
||||||
select_login_method()
|
select_login()
|
||||||
{
|
{
|
||||||
if ! LOGIN_TYPE="$(menubox "$_WMLogin" "$_LoginTypeBody" 0 0 0 \
|
if ! LOGIN_TYPE="$(menubox "$_WMLogin" "$_LoginTypeBody" 0 0 0 \
|
||||||
"xinit" "Console login without a display manager" \
|
"xinit" "Console login without a display manager" \
|
||||||
@ -378,11 +398,11 @@ select_packages()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
tput civis
|
tput civis
|
||||||
SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_Packages " \
|
||||||
--title " $_Packages " --default-item $SELECTED --menu "$_PackageMenu" 0 0 0 \
|
--default-item $SELECTED --menu "$_PackageMenu" 0 0 0 \
|
||||||
"1" "Web Browsers" "2" "Text Editors" "3" "Terminal Emulators" \
|
"1" "Browsers" "2" "Editors" "3" "Terminals" \
|
||||||
"4" "Music and Video Players" "5" "Mail and Chat" "6" "Office and Editing" \
|
"4" "Multimedia" "5" "Chat/Mail" "6" "Professional" \
|
||||||
"7" "Management and Fonts" "8" "Miscellaneous" "9" "$_Done")
|
"7" "System" "8" "Miscellaneous" "9" "$_Done")
|
||||||
|
|
||||||
if [[ $SELECTED -lt 9 ]]; then
|
if [[ $SELECTED -lt 9 ]]; then
|
||||||
case $SELECTED in
|
case $SELECTED in
|
||||||
@ -457,96 +477,6 @@ select_mirrorcmd()
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
display_settings()
|
|
||||||
{
|
|
||||||
local cmd mnt pkgs
|
|
||||||
cmd="${BCMDS[$BOOTLDR]}"
|
|
||||||
mnt="${BMNTS[$SYS-$BOOTLDR]}"
|
|
||||||
msgbox "$_PrepTitle" "
|
|
||||||
|
|
||||||
---------- PARTITION CONFIGURATION ------------
|
|
||||||
|
|
||||||
Root: ${ROOT_PART:-None}
|
|
||||||
Boot: ${BOOT_PART:-${BOOT_DEVICE:-None}}
|
|
||||||
|
|
||||||
Swap: ${SWAP_PART:-None}
|
|
||||||
Size: ${SWAP_SIZE:-None}
|
|
||||||
|
|
||||||
Extra: ${EXTRA_MNTS:-${EXTRA_MNT:-None}}
|
|
||||||
Hooks: ${MKINIT_HOOKS:-None}
|
|
||||||
|
|
||||||
LVM: ${LVM:-None}
|
|
||||||
LUKS: ${LUKS:-None}
|
|
||||||
|
|
||||||
|
|
||||||
---------- BOOTLOADER CONFIGURATION -----------
|
|
||||||
|
|
||||||
Loader: ${BOOTLDR:-None}
|
|
||||||
Mount: ${mnt:-None}
|
|
||||||
Command: ${cmd:-None}
|
|
||||||
|
|
||||||
|
|
||||||
------------ SYSTEM CONFIGURATION -------------
|
|
||||||
|
|
||||||
Locale: ${LOCALE:-None}
|
|
||||||
Keymap: ${KEYMAP:-None}
|
|
||||||
Hostname: ${HOSTNAME:-None}
|
|
||||||
Timezone: ${ZONE:-None}/${SUBZONE:-None}
|
|
||||||
|
|
||||||
|
|
||||||
------------ LOGIN CONFIGURATION --------------
|
|
||||||
|
|
||||||
User: ${NEWUSER:-None}
|
|
||||||
Shell: ${MYSHELL:-None}
|
|
||||||
Session: ${LOGIN_WM:-None}
|
|
||||||
Autologin: ${AUTOLOGIN:-None}
|
|
||||||
Management: ${LOGIN_TYPE:-None}
|
|
||||||
|
|
||||||
|
|
||||||
------------ PACKAGES AND MIRRORS -------------
|
|
||||||
|
|
||||||
Kernel: ${KERNEL:-None}
|
|
||||||
Sessions: ${INSTALL_WMS:-None}
|
|
||||||
Mirrors: ${MIRROR_CMD:-None}
|
|
||||||
Packages: $(print4 "${PACKAGES:-None}")
|
|
||||||
"
|
|
||||||
}
|
|
||||||
|
|
||||||
configure_settings()
|
|
||||||
{
|
|
||||||
tput cnorm
|
|
||||||
if ! HOSTNAME="$(getinput "$_ConfHost" "$_HostNameBody" "${DIST,,}")"; then
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
tput civis
|
|
||||||
if ! LOCALE="$(menubox "$_ConfLocale" "$_LocaleBody" 25 70 20 $LOCALES)"; then
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
select_timezone || return 1
|
|
||||||
user_creation || return 1
|
|
||||||
|
|
||||||
tput civis
|
|
||||||
if ! MYSHELL="$(menubox "$_ShellTitle" "$_ShellBody" 0 0 0 '/usr/bin/zsh' '-' '/bin/bash' '-' '/usr/bin/mksh' '-')"; then
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! KERNEL="$(menubox "$_KernelTitle" "$_KernelBody" 0 0 0 'linux' '-' 'linux-lts' '-')"; then
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
select_mirrorcmd || return 1
|
|
||||||
|
|
||||||
yesno "$_DevelTitle" "$_DevelBody" && BASEDEV=true || BASEDEV=false
|
|
||||||
|
|
||||||
select_wm_or_de || return 1
|
|
||||||
select_packages || return 1
|
|
||||||
|
|
||||||
export CONFIG_DONE=true
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
edit_configs()
|
edit_configs()
|
||||||
{
|
{
|
||||||
if [[ $CURRENT_MENU != "edit" ]]; then
|
if [[ $CURRENT_MENU != "edit" ]]; then
|
||||||
@ -561,9 +491,10 @@ edit_configs()
|
|||||||
|
|
||||||
SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||||
--title " $_EditTitle " --default-item $SELECTED --menu "$_EditBody" 0 0 0 \
|
--title " $_EditTitle " --default-item $SELECTED --menu "$_EditBody" 0 0 0 \
|
||||||
"1" "$exitstr" "2" "Keyboard" "3" "Locale" "4" "Hostname" \
|
"1" "$exitstr" "2" "${EDIT_FILES[2]}" "3" "${EDIT_FILES[3]}" \
|
||||||
"5" "Sudoers" "6" "Mkinitcpio.conf" "7" "Fstab" "8" "Crypttab" \
|
"4" "${EDIT_FILES[4]}" "5" "${EDIT_FILES[5]}" "6" "${EDIT_FILES[6]}" \
|
||||||
"9" "${BOOTLDR^}" "10" "Pacman.conf" "11" "${LOGIN_TYPE^}")
|
"7" "${EDIT_FILES[7]}" "8" "${EDIT_FILES[8]}" "9" "${EDIT_FILES[9]}" \
|
||||||
|
"10" "${EDIT_FILES[10]}" "11" "${EDIT_FILES[11]}")
|
||||||
|
|
||||||
if [[ ! $SELECTED || $SELECTED -eq 1 ]]; then
|
if [[ ! $SELECTED || $SELECTED -eq 1 ]]; then
|
||||||
[[ $DEBUG == true && -r $DBG ]] && vim $DBG
|
[[ $DEBUG == true && -r $DBG ]] && vim $DBG
|
||||||
@ -590,6 +521,78 @@ edit_configs()
|
|||||||
msgbox "$_ErrTitle" "$_NoFileErr"
|
msgbox "$_ErrTitle" "$_NoFileErr"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
edit_system_configs
|
edit_configs
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# dialog helper functions
|
||||||
|
|
||||||
|
msgbox()
|
||||||
|
{
|
||||||
|
tput civis
|
||||||
|
dialog --cr-wrap --backtitle "$BT" --title " $1 " --msgbox "$2\n" 0 0
|
||||||
|
}
|
||||||
|
|
||||||
|
menubox()
|
||||||
|
{
|
||||||
|
local title="$1"
|
||||||
|
local body="$2"
|
||||||
|
local h=$3
|
||||||
|
local w=$4
|
||||||
|
local n=$5
|
||||||
|
shift 5
|
||||||
|
local response
|
||||||
|
if ! response="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " --menu "$body" $h $w $n "$@")"; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
printf "%s" "$response"
|
||||||
|
}
|
||||||
|
|
||||||
|
checkbox()
|
||||||
|
{
|
||||||
|
local title="$1"
|
||||||
|
local body="$2"
|
||||||
|
local h=$3
|
||||||
|
local w=$4
|
||||||
|
local n=$5
|
||||||
|
shift 5
|
||||||
|
local response
|
||||||
|
if ! response="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " --checklist "$body" $h $w $n "$@")"; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
printf "%s" "$response"
|
||||||
|
}
|
||||||
|
|
||||||
|
getinput()
|
||||||
|
{
|
||||||
|
local answer
|
||||||
|
if ! answer="$(dialog --cr-wrap --max-input 63 --stdout --no-cancel --backtitle "$BT" --title " $1 " --inputbox "$2" 0 0 "$3")" || [[ $answer == '' ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
printf "%s" "$answer"
|
||||||
|
}
|
||||||
|
|
||||||
|
infobox()
|
||||||
|
{
|
||||||
|
local sec="$3"
|
||||||
|
tput civis
|
||||||
|
dialog --cr-wrap --backtitle "$BT" --title " $1 " --infobox "$2\n" 0 0
|
||||||
|
sleep ${sec:-2}
|
||||||
|
}
|
||||||
|
|
||||||
|
yesno()
|
||||||
|
{
|
||||||
|
# usage: yesno <title> <text> [<yes_label> <no_label> [<no>]]
|
||||||
|
# three options: one --default-no and custom labels, one just custom labels, and one basic.
|
||||||
|
tput civis
|
||||||
|
if [[ $# -eq 5 && $5 == "no" ]]; then
|
||||||
|
dialog --cr-wrap --backtitle "$BT" --defaultno --title " $1 " \
|
||||||
|
--yes-label "$3" --no-label "$4" --yesno "$2\n" 0 0
|
||||||
|
elif [[ $# -eq 4 ]]; then
|
||||||
|
dialog --cr-wrap --backtitle "$BT" --title " $1 " --yes-label "$3" \
|
||||||
|
--no-label "$4" --yesno "$2\n" 0 0
|
||||||
|
else
|
||||||
|
dialog --cr-wrap --backtitle "$BT" --title " $1 " --yesno "$2\n" 0 0
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,12 +189,6 @@ create_user()
|
|||||||
chrun "chpasswd <<< '$NEWUSER:$USER_PASS'"
|
chrun "chpasswd <<< '$NEWUSER:$USER_PASS'"
|
||||||
chrun "chown -Rf $NEWUSER:users /home/$NEWUSER"
|
chrun "chown -Rf $NEWUSER:users /home/$NEWUSER"
|
||||||
|
|
||||||
# remove configs for window managers that were never installed
|
|
||||||
[[ $INSTALL_WMS =~ i3-gaps ]] || rm -rf $MNT/home/$NEWUSER/.config/i3
|
|
||||||
[[ $INSTALL_WMS =~ bspwm ]] || rm -rf $MNT/home/$NEWUSER/.config/{bspwm,sxhkd}
|
|
||||||
[[ $INSTALL_WMS =~ openbox ]] || rm -rf $MNT/home/$NEWUSER/.config/{openbox,skippy-xd,jgmenu,conky,tint2}
|
|
||||||
[[ $INSTALL_WMS =~ (openbox|i3-gaps|bspwm) ]] || rm -rf $MNT/home/$NEWUSER/.config/polybar
|
|
||||||
|
|
||||||
# for neovim set up ~/.config/nvim
|
# for neovim set up ~/.config/nvim
|
||||||
if [[ $PACKAGES =~ neovim ]]; then
|
if [[ $PACKAGES =~ neovim ]]; then
|
||||||
mkdir -p $MNT/home/$NEWUSER/.config/nvim
|
mkdir -p $MNT/home/$NEWUSER/.config/nvim
|
||||||
@ -315,15 +309,18 @@ package_operations()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# for only gnome or cinnamon we don't need the xfce provided stuff
|
# for only gnome or cinnamon we don't need the xfce provided stuff
|
||||||
[[ $INSTALL_WMS =~ (gnome|cinnamon) ]] && rmpkg+=" $(pacman -Qssq 'xfce4*' 2>/dev/null)"
|
[[ $INSTALL_WMS =~ (gnome|cinnamon) ]] &&
|
||||||
|
rmpkg+=" $(pacman -Qssq 'xfce4*' 2>/dev/null)"
|
||||||
|
|
||||||
# when not using grub bootloader remove it's package and configurations
|
# when not using grub bootloader remove it's package and configurations
|
||||||
if [[ $BOOTLDR != 'grub' ]]; then
|
if [[ $BOOTLDR != 'grub' ]]; then
|
||||||
rmpkg+=" grub"
|
rmpkg+=" grub"
|
||||||
rm -f $MNT/etc/default/grub
|
rm -f $MNT/etc/default/grub
|
||||||
find $MNT/boot/ -name 'grub*' -exec rm -rf '{}' \; >/dev/null 2>&1
|
find $MNT/boot/ -name 'grub*' -exec rm -rf '{}' \; >/dev/null 2>&1
|
||||||
elif [[ $BOOTLDR != 'syslinux' ]]; then
|
fi
|
||||||
|
|
||||||
# do the same when not using syslinux as the bootloader
|
# do the same when not using syslinux as the bootloader
|
||||||
|
if [[ $BOOTLDR != 'syslinux' ]]; then
|
||||||
find $MNT/boot/ -name 'syslinux*' -exec rm -rf '{}' \; >/dev/null 2>&1
|
find $MNT/boot/ -name 'syslinux*' -exec rm -rf '{}' \; >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -333,7 +330,7 @@ package_operations()
|
|||||||
if [[ $BASEDEV == true ]]; then
|
if [[ $BASEDEV == true ]]; then
|
||||||
chrun "pacman -S iputils --noconfirm" 2>/dev/null
|
chrun "pacman -S iputils --noconfirm" 2>/dev/null
|
||||||
chrun "pacman -S base-devel git --needed --noconfirm" 2>/dev/null
|
chrun "pacman -S base-devel git --needed --noconfirm" 2>/dev/null
|
||||||
elif [[ $BASEDEV == false && $INSTALL_WMS =~ dwm ]]; then
|
elif [[ $INSTALL_WMS =~ dwm ]]; then
|
||||||
chrun "pacman -S iputils git make --noconfirm" 2>/dev/null
|
chrun "pacman -S iputils git make --noconfirm" 2>/dev/null
|
||||||
else
|
else
|
||||||
# iputils is needed and should always be installed
|
# iputils is needed and should always be installed
|
||||||
|
@ -17,7 +17,7 @@ readonly LOCALES="$(awk '/\.UTF-8/ { gsub(/# .*|#/, "")
|
|||||||
readonly CMAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' |
|
readonly CMAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' |
|
||||||
awk '{gsub(/\.map\.gz|.*\//, ""); print $1 " -"}')"
|
awk '{gsub(/\.map\.gz|.*\//, ""); print $1 " -"}')"
|
||||||
|
|
||||||
select_partitions()
|
mnt_menu()
|
||||||
{
|
{
|
||||||
# prepare partition list PARTS for dialog
|
# prepare partition list PARTS for dialog
|
||||||
lvm_detect
|
lvm_detect
|
||||||
|
Reference in New Issue
Block a user