You've already forked al-installer
Split main dialogs to their own lib file, add checklist function, split package choices to menu style
This commit is contained in:
@ -1,582 +1,19 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# vim:fdm=marker:fmr={,}
|
||||
# shellcheck disable=2154,2034,2153
|
||||
|
||||
# This program is free software, provided under the GNU GPL
|
||||
# Written by Nathaniel Maia for use in Archlabs
|
||||
# Some ideas and code has been taken from other installers
|
||||
# AIF, Cnichi, Calamares, The Arch Wiki.. Credit where credit is due
|
||||
|
||||
# set -n
|
||||
|
||||
# shellcheck disable=2154,2034,2153
|
||||
|
||||
# globals {
|
||||
|
||||
# immutable values
|
||||
readonly VER="1.7.17" # Installer version
|
||||
# immutable globals
|
||||
readonly VER="1.7.18" # Installer version
|
||||
readonly DIST="ArchLabs" # Linux distributor
|
||||
readonly MNT="/mnt/install" # Install mountpoint
|
||||
readonly ERR="/tmp/errlog" # Built-in error log
|
||||
readonly DBG="/tmp/debuglog" # Built-in error log
|
||||
|
||||
# mutable values
|
||||
declare -g WARN=false
|
||||
declare -g AUTOLOGIN=false
|
||||
declare -g CONFIG_DONE=false
|
||||
declare -g SEPERATE_BOOT=false
|
||||
declare -g HAS_NETWORK=false
|
||||
|
||||
declare -g BT="$DIST Installer - (x86_64) - Version $VER"
|
||||
declare -g ROOT_PART=""
|
||||
declare -g BOOT_DEVICE=""
|
||||
declare -g BOOT_PART=""
|
||||
declare -g BOOTLDR=""
|
||||
declare -g EXTRA_MNT=""
|
||||
declare -g EXTRA_MNTS=""
|
||||
declare -g SWAP_PART=""
|
||||
declare -g SWAP_SIZE=""
|
||||
declare -g NEWUSER=""
|
||||
declare -g USER_PASS=""
|
||||
declare -g ROOT_PASS=""
|
||||
declare -g LOGIN_WM=""
|
||||
declare -g LOGIN_TYPE=""
|
||||
declare -g INSTALL_WMS=""
|
||||
declare -g KERNEL=""
|
||||
declare -g WM_PACKAGES=""
|
||||
declare -g PACKAGES=""
|
||||
declare -g MYSHELL=""
|
||||
declare -g MKINIT_HOOKS="shutdown"
|
||||
|
||||
# }
|
||||
|
||||
select_language() {
|
||||
tput civis
|
||||
local lang
|
||||
local title="\nLanguage - sprache - taal - språk - lingua - idioma - nyelv - língua\n"
|
||||
lang=$(menubox "Select Language" "$title" 0 0 0 \
|
||||
"1" "English (en_**)" "2" "Español (es_ES)" \
|
||||
"3" "Português [Brasil] (pt_BR)" "4" "Português (pt_PT)" \
|
||||
"5" "Français (fr_FR)" "6" "Russkiy (ru_RU)" \
|
||||
"7" "Italiano (it_IT)" "8" "Nederlands (nl_NL)" \
|
||||
"9" "Magyar (hu_HU)" "10" "Chinese (zh_CN)")
|
||||
|
||||
local srcdir="/usr/share/archlabs/installer/lang"
|
||||
src $srcdir/english.trans
|
||||
FONT="ter-i16n"
|
||||
|
||||
case $lang in
|
||||
1) LOC="en_US.UTF-8" ;;
|
||||
2) src $srcdir/spanish.trans && LOC="es_ES.UTF-8" ;;
|
||||
3) src $srcdir/p_brasil.trans && LOC="pt_BR.UTF-8" ;;
|
||||
4) src $srcdir/portuguese.trans && LOC="pt_PT.UTF-8" ;;
|
||||
5) src $srcdir/french.trans && LOC="fr_FR.UTF-8" ;;
|
||||
6) src $srcdir/russian.trans && LOC="ru_RU.UTF-8" FONT="LatKaCyrHeb-16" ;;
|
||||
7) src $srcdir/italian.trans && LOC="it_IT.UTF-8" ;;
|
||||
8) src $srcdir/dutch.trans && LOC="nl_NL.UTF-8" ;;
|
||||
9) src $srcdir/hungarian.trans && LOC="hu_HU.UTF-8" FONT="lat2-16" ;;
|
||||
10) src $srcdir/chinese.trans && LOC="zh_CN.UTF-8" ;;
|
||||
*) die
|
||||
esac
|
||||
|
||||
sed -i "s/#en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen
|
||||
if [[ $LOC != "en_US.UTF-8" ]]; then
|
||||
sed -i "s/#${LOC}/${LOC}/" /etc/locale.gen
|
||||
locale-gen >/dev/null 2>&1
|
||||
fi
|
||||
[[ $TERM == 'linux' ]] && setfont $FONT >/dev/null 2>&1
|
||||
export LANG="$LOC"
|
||||
return 0
|
||||
}
|
||||
|
||||
user_creation() {
|
||||
tput cnorm
|
||||
local values
|
||||
if ! values="$(dialog --stdout --no-cancel --separator '~' --ok-label "Submit" --backtitle "$BT" \
|
||||
--title " $_UserTitle " --insecure --mixedform "$_UserBody" 27 75 10 \
|
||||
"$_Username" 1 1 "" 1 $((${#_Username} + 2)) 71 0 0 \
|
||||
"$_Password" 2 1 "" 2 $((${#_Password} + 2)) 71 0 1 \
|
||||
"$_Password2" 3 1 "" 3 $((${#_Password2} + 2)) 71 0 1 \
|
||||
"$_RootBody" 6 1 "" 6 $((${#_RootBody} + 1)) 71 0 2 \
|
||||
"$_Password" 8 1 "" 8 $((${#_Password} + 2)) 71 0 1 \
|
||||
"$_Password2" 9 1 "" 9 $((${#_Password2} + 2)) 71 0 1 |
|
||||
openssl enc -pbkdf2 -a -salt -pass pass:$SALT)"; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# username doesn't need to be re-encrypted
|
||||
local user
|
||||
user="$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$values" |
|
||||
awk -F'~' '{print $1}')"
|
||||
|
||||
# all of this is a bit hacky, but we don't ever want the passwords to be stored in plain text
|
||||
# so it decrypts the string '$values', gets the field we want, and re-encrypts it
|
||||
local pass pass2
|
||||
pass="$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$values" |
|
||||
awk -F'~' '{print $2}' | openssl enc -pbkdf2 -a -salt -pass pass:$SALT)"
|
||||
pass2="$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$values" |
|
||||
awk -F'~' '{print $3}' | openssl enc -pbkdf2 -a -salt -pass pass:$SALT)"
|
||||
|
||||
local rpass rpass2
|
||||
rpass="$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$values" |
|
||||
awk -F'~' '{print $5}' | openssl enc -pbkdf2 -a -salt -pass pass:$SALT)"
|
||||
rpass2="$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$values" |
|
||||
awk -F'~' '{print $6}' | openssl enc -pbkdf2 -a -salt -pass pass:$SALT)"
|
||||
|
||||
# due to encrypting the string, when empty, once encrypted it wont be empty
|
||||
local empty
|
||||
empty="$(openssl enc -pbkdf2 -a -salt -pass pass:$SALT <<< "")"
|
||||
|
||||
# both root passwords are empty, so use the user passwords instead
|
||||
[[ $rpass == "$empty" && $rpass2 == "$empty" ]] && { rpass="$pass"; rpass2="$pass2"; }
|
||||
|
||||
# make sure a username was entered and that the passwords match
|
||||
if [[ ${#user} -eq 0 || $user =~ \ |\' || $user =~ [^a-z0-9] || $pass == "$empty" || "$pass" != "$pass2" || "$rpass" != "$rpass2" ]]; then
|
||||
if [[ $pass == "$empty" || "$pass" != "$pass2" || "$rpass" != "$rpass2" ]]; then
|
||||
# password was left empty or doesn't match
|
||||
if [[ $pass == "$empty" ]]; then
|
||||
msgbox "$_ErrTitle" "\nUser password CANNOT be left empty.\n$_TryAgain"
|
||||
elif [[ "$rpass" != "$rpass2" ]]; then
|
||||
msgbox "$_ErrTitle" "$_RootPassErr\n$_TryAgain"
|
||||
else
|
||||
msgbox "$_ErrTitle" "$_UserPassErr\n$_TryAgain"
|
||||
fi
|
||||
else # bad username
|
||||
msgbox "$_UserErrTitle" "$_UserErrBody"
|
||||
user=""
|
||||
fi
|
||||
# recursively loop back unless the user cancels
|
||||
user || return 1
|
||||
else
|
||||
export NEWUSER="$user"
|
||||
export USER_PASS="$pass"
|
||||
export ROOT_PASS="$rpass"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
select_keymap() {
|
||||
tput civis
|
||||
if ! KEYMAP="$(menubox "$_PrepLayout" "$_XMapBody" 20 70 12 \
|
||||
'us' 'English' 'cm' 'English' 'gb' 'English' 'au' 'English' 'gh' 'English' \
|
||||
'za' 'English' 'ng' 'English' 'ca' 'French' 'cd' 'French' 'gn' 'French' \
|
||||
'tg' 'French' 'fr' 'French' 'de' 'German' 'at' 'German' 'ch' 'German' \
|
||||
'es' 'Spanish' 'latam' 'Spanish' 'br' 'Portuguese' 'pt' 'Portuguese' 'ma' 'Arabic' \
|
||||
'sy' 'Arabic' 'ara' 'Arabic' 'ua' 'Ukrainian' 'cz' 'Czech' 'ru' 'Russian' \
|
||||
'sk' 'Slovak' 'nl' 'Dutch' 'it' 'Italian' 'hu' 'Hungarian' 'cn' 'Chinese' \
|
||||
'tw' 'Taiwanese' 'vn' 'Vietnamese' 'kr' 'Korean' 'jp' 'Japanese' 'th' 'Thai' \
|
||||
'la' 'Lao' 'pl' 'Polish' 'se' 'Swedish' 'is' 'Icelandic' 'fi' 'Finnish' \
|
||||
'dk' 'Danish' 'be' 'Belgian' 'in' 'Indian' 'al' 'Albanian' 'am' 'Armenian' \
|
||||
'bd' 'Bangla' 'ba' 'Bosnian' 'bg' 'Bulgarian' 'dz' 'Berber' 'mm' 'Burmese' \
|
||||
'hr' 'Croatian' 'gr' 'Greek' 'il' 'Hebrew' 'ir' 'Persian' 'iq' 'Iraqi' \
|
||||
'af' 'Afghani' 'fo' 'Faroese' 'ge' 'Georgian' 'ee' 'Estonian' 'kg' 'Kyrgyz' \
|
||||
'kz' 'Kazakh' 'lt' 'Lithuanian' 'mt' 'Maltese' 'mn' 'Mongolian' 'ro' 'Romanian' \
|
||||
'no' 'Norwegian' 'rs' 'Serbian' 'si' 'Slovenian' 'tj' 'Tajik' 'lk' 'Sinhala' \
|
||||
'tr' 'Turkish' 'uz' 'Uzbek' 'ie' 'Irish' 'pk' 'Urdu' 'mv' 'Dhivehi' \
|
||||
'np' 'Nepali' 'et' 'Amharic' 'sn' 'Wolof' 'ml' 'Bambara' 'tz' 'Swahili' \
|
||||
'ke' 'Swahili' 'bw' 'Tswana' 'ph' 'Filipino' 'my' 'Malay' 'tm' 'Turkmen' \
|
||||
'id' 'Indonesian' 'bt' 'Dzongkha' 'lv' 'Latvian' 'md' 'Moldavian' 'mao' 'Maori' \
|
||||
'by' 'Belarusian' 'az' 'Azerbaijani' 'mk' 'Macedonian' 'kh' 'Khmer' 'epo' 'Esperanto' \
|
||||
'me' 'Montenegrin')"; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# when a matching console map is not available open a selection dialog
|
||||
if [[ $CMAPS == *"$KEYMAP"* ]]; then
|
||||
CMAP="$KEYMAP"
|
||||
else
|
||||
if ! CMAP="$(menubox "$_CMapTitle" "$_CMapBody" 20 70 12 $CMAPS)"; then
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $DISPLAY && $TERM != 'linux' ]]; then
|
||||
setxkbmap $KEYMAP >/dev/null 2>&1
|
||||
else
|
||||
loadkeys $CMAP >/dev/null 2>&1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
select_timezone() {
|
||||
# create associative array for SUBZONES[zone]
|
||||
local f="/usr/share/zoneinfo/zone.tab"
|
||||
declare -A SUBZONES
|
||||
for i in America Australia Asia Atlantic Africa Europe Indian Pacific Arctic Antarctica; do
|
||||
SUBZONES[$i]="$(awk '/'"$i"'\// {gsub(/'"$i"'\//, ""); print $3, $1}' $f)"
|
||||
done
|
||||
|
||||
tput civis
|
||||
if ! ZONE="$(menubox "$_TimeZTitle" "$_TimeZBody" 20 70 10 \
|
||||
'America' '-' 'Australia' '-' 'Asia' '-' 'Atlantic' '-' 'Africa' '-' \
|
||||
'Europe' '-' 'Indian' '-' 'Pacific' '-' 'Arctic' '-' 'Antarctica' '-')"; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! SUBZONE="$(menubox "$_TimeZTitle" "$_TimeSubZBody" 20 70 12 ${SUBZONES[$ZONE]})"; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
yesno "$_TimeZTitle" "$_TimeZQ $ZONE/$SUBZONE?\n" && return 0 || select_timezone
|
||||
}
|
||||
|
||||
select_wm_or_de() {
|
||||
tput civis
|
||||
if ! INSTALL_WMS="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||
--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 \
|
||||
"dwm" "A customized fork of dwm, with patches and modifications" 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 \
|
||||
"xfce4" "A lightweight and modular desktop environment based on GTK+ 2 and 3" off)"; then
|
||||
return 1
|
||||
fi
|
||||
[[ $INSTALL_WMS ]] || INSTALL_WMS='openbox'
|
||||
|
||||
WM_NUM=$(awk '{print NF}' <<< "$INSTALL_WMS")
|
||||
WM_PACKAGES="${INSTALL_WMS/dwm/}" # remove dwm as we are compiling from source
|
||||
WM_PACKAGES="${WM_PACKAGES// / }" # remove double spaces from the string
|
||||
|
||||
# packages needed for the selected WMs/DEs
|
||||
for wm in $INSTALL_WMS; do
|
||||
LOGIN_CHOICES="${LOGIN_CHOICES}$wm - "
|
||||
case $wm in
|
||||
cinnamon) : ;; # none
|
||||
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
|
||||
|
||||
if [[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps) ]]; then
|
||||
WM_PACKAGES+=" libmpdclient rofi jsoncpp archlabs-screenlock termite archlabs-oblogout thunar archlabs-polybar archlabs-paranoid"
|
||||
elif [[ $INSTALL_WMS =~ (xfce4) ]]; then
|
||||
WM_PACKAGES+=" archlabs-oblogout archlabs-screenlock archlabs-paranoid"
|
||||
fi
|
||||
|
||||
# choose how to log in
|
||||
select_login_method || return 1
|
||||
|
||||
# choose which WM/DE to start at login
|
||||
if [[ $LOGIN_TYPE == 'xinit' ]]; then
|
||||
if [[ $WM_NUM -eq 1 ]]; then
|
||||
LOGIN_WM="$INSTALL_WMS"
|
||||
else
|
||||
if ! LOGIN_WM="$(menubox "$_WMLogin" "$_WMLoginBody" 0 0 0 $LOGIN_CHOICES)"; then
|
||||
return 1
|
||||
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
|
||||
else
|
||||
AUTOLOGIN=false
|
||||
fi
|
||||
|
||||
# add packages to the main package list
|
||||
PACKAGES="$WM_PACKAGES"
|
||||
return 0
|
||||
}
|
||||
|
||||
select_login_method() {
|
||||
if ! LOGIN_TYPE="$(menubox "$_WMLogin" "$_LoginTypeBody" 0 0 0 \
|
||||
"xinit" "Console login without a display manager" \
|
||||
"lightdm" "Lightweight display manager with a gtk greeter")"; then
|
||||
return 1
|
||||
fi
|
||||
if [[ $LOGIN_TYPE == 'lightdm' ]]; then
|
||||
WM_PACKAGES+=" lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice"
|
||||
EDIT_FILES[11]="/etc/lightdm/lightdm.conf /etc/lightdm/lightdm-gtk-greeter.conf"
|
||||
else
|
||||
EDIT_FILES[11]="/home/$NEWUSER/.xinitrc /home/$NEWUSER/.xprofile"
|
||||
fi
|
||||
}
|
||||
|
||||
select_extra_packages() {
|
||||
local pkgs
|
||||
pkgs="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||
--title " $_ExtraPackages " --checklist "$_ExtraPackagesBody\n" 0 0 30 \
|
||||
"firefox" "A popular open-source graphical web browser from Mozilla" off \
|
||||
"chromium" "an open-source graphical web browser based on the Blink rendering engine" off \
|
||||
"opera" "Fast and secure, free of charge web browser from Opera Software" off \
|
||||
"epiphany" "A GNOME web browser based on the WebKit rendering engine" off \
|
||||
"qutebrowser" "A keyboard-focused vim-like web browser based on Python and PyQt5" off \
|
||||
"atom" "An open-source text editor developed by GitHub that is licensed under the MIT License" off \
|
||||
"geany" "A fast and lightweight IDE" off \
|
||||
"emacs" "An extensible, customizable, self-documenting real-time display editor" off \
|
||||
"neovim" "A fork of Vim aiming to improve user experience, plugins, and GUIs." off \
|
||||
"mousepad" "A simple text editor" off \
|
||||
"rxvt-unicode" "A unicode enabled rxvt-clone terminal emulator" off \
|
||||
"termite" "A minimal VTE-based terminal emulator" off \
|
||||
"tilix" "A tiling terminal emulator for Linux using GTK+ 3" off \
|
||||
"terminator" "Terminal emulator that supports tabs and grids" off \
|
||||
"tilda" "A Gtk based drop down terminal for Linux and Unix" off \
|
||||
"xfce4-terminal" "A terminal emulator based in the Xfce Desktop Environment" off \
|
||||
"thunar" "A modern file manager for the Xfce Desktop Environment" off \
|
||||
"pcmanfm" "A fast and lightweight file manager based in Lxde" off \
|
||||
"gnome-disk-utility" "Disk Management Utility" off \
|
||||
"gnome-system-monitor" "View current processes and monitor system state" off \
|
||||
"steam" "A popular game distribution platform by Valve" off \
|
||||
"vlc" "A free and open source cross-platform multimedia player" off \
|
||||
"mpd" "A flexible, powerful, server-side application for playing music" off \
|
||||
"ncmpcpp" "An mpd client and almost exact clone of ncmpc with some new features" off \
|
||||
"cmus" "A small, fast and powerful console music player for Unix-like operating systems" off \
|
||||
"audacious" "A free and advanced audio player based on GTK+" off \
|
||||
"nicotine+" "A graphical client for Soulseek" off \
|
||||
"lollypop" "A new music playing application" off \
|
||||
"rhythmbox" "Music playback and management application" off \
|
||||
"deadbeef" "A GTK+ audio player for GNU/Linux" off \
|
||||
"clementine" "A modern music player and library organizer" off \
|
||||
"thunderbird" "Standalone mail and news reader from mozilla" off \
|
||||
"geary" "A lightweight email client for the GNOME desktop" off \
|
||||
"evolution" "Manage your email, contacts and schedule" off \
|
||||
"mutt" "Small but very powerful text-based mail client" off \
|
||||
"deluge" "A BitTorrent client written in python" off \
|
||||
"transmission-gtk" "Free BitTorrent client GTK+ GUI" off \
|
||||
"qbittorrent" "An advanced BitTorrent client" off \
|
||||
"hexchat" "A popular and easy to use graphical IRC client" off \
|
||||
"pidgin" "Multi-protocol instant messaging client" off \
|
||||
"weechat" "Fast, light and extensible IRC client" off \
|
||||
"irssi" "Modular text mode IRC client" off \
|
||||
"libreoffice-fresh" "Full featured office suite" off \
|
||||
"abiword" "Fully-featured word processor" off \
|
||||
"calligra" "A set of applications for productivity" off \
|
||||
"evince" "A document viewer" off \
|
||||
"zathura" "Minimalistic document viewer" off \
|
||||
"qpdfview" "A tabbed PDF viewer" off \
|
||||
"mupdf" "Lightweight PDF and XPS viewer" off \
|
||||
"gpicview" "Lightweight image viewer" off \
|
||||
"gimp" "GNU Image Manipulation Program" off \
|
||||
"inkscape" "Professional vector graphics editor" off \
|
||||
"krita" "Edit and paint images" off \
|
||||
"simplescreenrecorder" "A feature-rich screen recorder" off \
|
||||
"obs-studio" "Free opensource streaming/recording software" off \
|
||||
"openshot" "An open-source, non-linear video editor for Linux based on MLT framework" off \
|
||||
"kdenlive" "A non-linear video editor for Linux using the MLT video framework" off \
|
||||
"audacity" "A program that lets you manipulate digital audio waveforms" off \
|
||||
"guvcview" "Capture video from camera devices" off \
|
||||
"gpick" "Advanced color picker using GTK+ toolkit" off \
|
||||
"gcolor2" "A simple GTK+2 color selector" off \
|
||||
"plank" "An elegant, simple, and clean dock" off \
|
||||
"docky" "Full fledged dock that makes opening applications and managing windows faster and easier" off \
|
||||
"cairo-dock" "Light eye-candy fully themable animated dock" off \
|
||||
"qt5ct" "GUI for managing Qt based application themes, icons, and fonts" off \
|
||||
"ttf-hack" "A hand groomed and optically balanced typeface based on Bitstream Vera Mono" off \
|
||||
"ttf-anonymous-pro" "A family of four fixed-width fonts designed especially with coding in mind" off \
|
||||
"ttf-font-awesome" "Iconic font designed for Bootstrap" off \
|
||||
"ttf-fira-code" "Monospaced font with programming ligatures" off \
|
||||
"noto-fonts" "Google Noto fonts" off \
|
||||
"noto-fonts-cjk" "Google Noto CJK fonts (Chinese, Japanese, Korean)" off)"
|
||||
|
||||
[[ $pkgs =~ vlc ]] && pkgs+=" qt4"
|
||||
[[ $pkgs =~ mpd ]] && pkgs+=" mpc"
|
||||
[[ $pkgs =~ mupdf ]] && pkgs+=" mupdf-tools"
|
||||
[[ $pkgs =~ qt5ct ]] && pkgs+=" qt5-styleplugins"
|
||||
[[ $pkgs =~ steam ]] && pkgs+=" steam-native-runtime"
|
||||
[[ $pkgs =~ zathura ]] && pkgs+=" zathura-pdf-poppler"
|
||||
[[ $pkgs =~ noto-fonts ]] && pkgs+=" noto-fonts-emoji"
|
||||
[[ $pkgs =~ cairo-dock ]] && pkgs+=" cairo-dock-plug-ins"
|
||||
[[ $pkgs =~ kdenlive ]] && pkgs+=" kdebase-runtime dvdauthor frei0r-plugins breeze breeze-gtk"
|
||||
{ [[ $INSTALL_WMS =~ dwm ]] && ! [[ $pkgs =~ ttf-hack ]]; } && pkgs+=" ttf-hack"
|
||||
{ [[ $pkgs =~ (qutebrowser|qbittorrent|kdenlive|vlc) ]] && ! [[ $pkgs =~ qt5ct ]]; } && pkgs+=" qt5ct qt5-styleplugins"
|
||||
|
||||
PACKAGES+=" $pkgs" # add chosen packages to the main package list
|
||||
PACKAGES="${PACKAGES/^ /}" # remove leading spaces from the package string
|
||||
return 0
|
||||
}
|
||||
|
||||
select_mirrorlist_command() {
|
||||
local ip c
|
||||
local key="5f29642060ab983b31fdf4c2935d8c56"
|
||||
|
||||
if hash reflector >/dev/null 2>&1; then
|
||||
MIRROR_CMD="reflector --score 100 -l 50 -f 10 --sort rate --verbose"
|
||||
yesno "$_MirrorTitle" "$_MirrorSetup" "Automatic" "Custom" && return 0
|
||||
|
||||
ip="$(json 'ip' "check&?access_key=${key}&fields=ip")"
|
||||
c="$(json 'country_name' "${ip}?access_key=${key}&fields=country_name")"
|
||||
MIRROR_CMD="reflector --country $c --score 80 --latest 40 --fastest 10 --sort rate --verbose"
|
||||
|
||||
tput cnorm
|
||||
MIRROR_CMD="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \
|
||||
--title " $_MirrorTitle " --inputbox "$_MirrorCmd\n
|
||||
--score n Limit the list to the n servers with the highest score.
|
||||
--latest n Limit the list to the n most recently synchronized servers.
|
||||
--fastest n Return the n fastest mirrors that meet the other criteria.
|
||||
--sort {age,rate,country,score,delay}
|
||||
|
||||
'age': Last server synchronization;
|
||||
'rate': Download rate;
|
||||
'country': Server location;
|
||||
'score': MirrorStatus score;
|
||||
'delay': MirrorStatus delay.\n" 0 0 "$MIRROR_CMD")"
|
||||
else
|
||||
ip="$(json 'ip' "check&?access_key=${key}&fields=ip")"
|
||||
c="$(json 'country_code' "${ip}?access_key=${key}&fields=country_code")"
|
||||
local w="https://www.archlinux.org/mirrorlist"
|
||||
if [[ $c ]]; then
|
||||
if [[ $c =~ (CA|US) ]]; then
|
||||
MIRROR_CMD="curl -s '$w/?country=US&country=CA&protocol=https&use_mirror_status=on'"
|
||||
else
|
||||
MIRROR_CMD="curl -s '$w/?country=${c}&protocol=https&use_mirror_status=on'"
|
||||
fi
|
||||
else
|
||||
MIRROR_CMD="curl -s '$w/?country=US&country=CA&country=NZ&country=GB&country=AU&protocol=https&use_mirror_status=on'"
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
display_system_settings() {
|
||||
local cmd mnt pkgs
|
||||
cmd="${BCMDS[$BOOTLDR]}"
|
||||
mnt="${BMNTS[$SYS-$BOOTLDR]}"
|
||||
msgbox "$_PrepTitle" "\n\n---------- 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: $(printq "${PACKAGES:-None}")\n"
|
||||
}
|
||||
|
||||
configure_system_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 '/bin/zsh' '-' '/bin/bash' '-')"; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
tput civis
|
||||
if [[ $HAS_NETWORK == true ]]; then
|
||||
if ! KERNEL="$(menubox "$_KernelTitle" "$_KernelBody" 0 0 0 'linux' '-' 'linux-lts' '-')"; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
select_wm_or_de || return 1
|
||||
select_extra_packages || return 1
|
||||
select_mirrorlist_command || return 1
|
||||
else
|
||||
# defaults for when there is no network connection
|
||||
KERNEL='linux'
|
||||
AUTOLOGIN=true
|
||||
LOGIN_TYPE='xinit'
|
||||
INSTALL_WMS='openbox'
|
||||
LOGIN_WM='openbox-session'
|
||||
MIRROR_CMD="reflector --score 100 -l 50 -f 10 --sort rate --verbose"
|
||||
EDIT_FILES[11]="/home/$NEWUSER/.xinitrc /home/$NEWUSER/.xprofile"
|
||||
fi
|
||||
|
||||
export CONFIG_DONE=true
|
||||
return 0
|
||||
}
|
||||
|
||||
edit_system_configs() {
|
||||
if [[ $CURRENT_MENU != "edit" ]]; then
|
||||
SELECTED=1; CURRENT_MENU="edit"
|
||||
elif (( SELECTED < 11 )); then
|
||||
(( SELECTED++ ))
|
||||
fi
|
||||
|
||||
tput civis
|
||||
local exitstr
|
||||
[[ $DEBUG == true ]] && exitstr="View Log & Reboot" || exitstr="Reboot"
|
||||
|
||||
SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||
--title " $_EditTitle " --default-item $SELECTED --menu "$_EditBody" 0 0 0 \
|
||||
"1" "$exitstr" "2" "Keyboard" "3" "Locale" "4" "Hostname" \
|
||||
"5" "Sudoers" "6" "Mkinitcpio.conf" "7" "Fstab" "8" "Crypttab" \
|
||||
"9" "${BOOTLDR^}" "10" "Pacman.conf" "11" "${LOGIN_TYPE^}")
|
||||
|
||||
if [[ ! $SELECTED || $SELECTED -eq 1 ]]; then
|
||||
[[ $DEBUG == true ]] && more $DEBUG
|
||||
die 127
|
||||
else
|
||||
local existing_files=""
|
||||
for f in $(printf "%s" "${EDIT_FILES[$SELECTED]}"); do
|
||||
[[ -e ${MNT}$f ]] && existing_files+=" ${MNT}$f"
|
||||
done
|
||||
if [[ ! $existing_files ]]; then
|
||||
msgbox "$_ErrTitle" "$_NoFileErr"
|
||||
else
|
||||
if hash vim >/dev/null 2>&1; then
|
||||
vim -O $existing_files
|
||||
else
|
||||
for f in $existing_files; do
|
||||
if hash nano >/dev/null 2>&1; then
|
||||
nano $f
|
||||
else
|
||||
vi $f
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
edit_system_configs
|
||||
}
|
||||
|
||||
main() {
|
||||
if [[ $CURRENT_MENU != "main" ]]; then
|
||||
SELECTED=1
|
||||
@ -596,12 +33,13 @@ main() {
|
||||
# and that the needed config variables and user variables have been set up
|
||||
if [[ $SELECTED ]]; then
|
||||
if [[ $SELECTED -eq 8 || $SELECTED -eq 6 ]]; then
|
||||
{ [[ $SELECTED -eq 8 ]] && icheck 1 || icheck; } || return 1
|
||||
{ [[ $SELECTED -eq 8 ]] && preinstall_check 1 || preinstall_check; } || return 1
|
||||
elif [[ ($SELECTED -eq 2 || $SELECTED -eq 5) && $WARN != true ]]; then
|
||||
msgbox "$_PrepTitle" "$_WarnMount" && WARN=true
|
||||
fi
|
||||
fi
|
||||
|
||||
# setting $SELECTED to $SELECTED - 1 when a step fails retains the highlighted menu item
|
||||
case $SELECTED in
|
||||
1) device_tree ;;
|
||||
2) partition || SELECTED=1 ;;
|
||||
@ -627,12 +65,14 @@ for arg in "$@"; do case $arg in
|
||||
--debug|-d) debug ;;
|
||||
esac done
|
||||
|
||||
# initial choices/prep
|
||||
devices
|
||||
# initial prep
|
||||
select_language
|
||||
select_keymap
|
||||
checks
|
||||
sysid
|
||||
|
||||
# call checks before identify so we can try mounting efivarfs
|
||||
system_checks
|
||||
system_identify
|
||||
system_devices
|
||||
|
||||
# welcome message
|
||||
msgbox "$_WelTitle $DIST Installer" "$_WelBody"
|
||||
|
Reference in New Issue
Block a user