Dont check directly instead of checking 0 everytime, update README
This commit is contained in:
parent
92fb1c6cff
commit
7426259dc5
@ -16,21 +16,22 @@
|
|||||||
- `vim` for editing files post install.
|
- `vim` for editing files post install.
|
||||||
- `parted` for partition creation.
|
- `parted` for partition creation.
|
||||||
- `wipe` for the secure wipe.
|
- `wipe` for the secure wipe.
|
||||||
- `awk` `sed` `grep` `uniq` `sort` `find` `ping` `mkfs` `lsblk` `curl`.
|
|
||||||
- `arch-chroot` to perform operations in a chroot.
|
- `arch-chroot` to perform operations in a chroot.
|
||||||
- `chpasswd` to set root and user passwords.
|
- `chpasswd` to set root and user passwords.
|
||||||
- `openssl` to encrypt passwords.
|
- `openssl` to encrypt passwords.
|
||||||
|
- Basic Unix tools
|
||||||
|
- `awk` `sed` `grep` `uniq` `sort` `find` `ping` `mkfs` `lsblk` `curl`.
|
||||||
- Network connection is needed to install packages and update the system.
|
- Network connection is needed to install packages and update the system.
|
||||||
|
|
||||||
#### Manual Installation
|
#### Manual Installation
|
||||||
- curl
|
- curl
|
||||||
```
|
```
|
||||||
sh -c "$(curl -fsSL https://bitbucket.org/archlabslinux/installer/raw/cfca6ca4d234f0a92c9d323fbeeb7214ce800fb0/install.sh)"
|
sh -c "$(curl -fsSL https://bitbucket.org/archlabslinux/installer/raw/master/install.sh)"
|
||||||
```
|
```
|
||||||
|
|
||||||
- wget
|
- wget
|
||||||
```
|
```
|
||||||
sh -c "$(wget https://bitbucket.org/archlabslinux/installer/raw/cfca6ca4d234f0a92c9d323fbeeb7214ce800fb0/install.sh -O -)"
|
sh -c "$(wget https://bitbucket.org/archlabslinux/installer/raw/master/install.sh -O -)"
|
||||||
```
|
```
|
||||||
|
|
||||||
- Packages for `pacman` can be found in our repos:
|
- Packages for `pacman` can be found in our repos:
|
||||||
|
@ -9,10 +9,12 @@
|
|||||||
|
|
||||||
# set -n
|
# set -n
|
||||||
|
|
||||||
|
# shellcheck disable=2154
|
||||||
|
|
||||||
# globals {
|
# globals {
|
||||||
|
|
||||||
# immutable values
|
# immutable values
|
||||||
readonly VER="1.7.11" # Installer version
|
readonly VER="1.7.12" # Installer version
|
||||||
readonly DIST="ArchLabs" # Linux distributor
|
readonly DIST="ArchLabs" # Linux distributor
|
||||||
readonly LIVE="liveuser" # Live session user
|
readonly LIVE="liveuser" # Live session user
|
||||||
readonly MNT="/mnt/install" # Install mountpoint
|
readonly MNT="/mnt/install" # Install mountpoint
|
||||||
@ -22,7 +24,7 @@ readonly ERR="/tmp/errlog" # Built-in error log
|
|||||||
declare -g WARN=false
|
declare -g WARN=false
|
||||||
declare -g AUTOLOGIN=false
|
declare -g AUTOLOGIN=false
|
||||||
declare -g CONFIG_DONE=false
|
declare -g CONFIG_DONE=false
|
||||||
declare -g SEPERATE_BOOT=false
|
declare -gx SEPERATE_BOOT=false
|
||||||
|
|
||||||
declare -g BT="$DIST Installer - (x86_64) - Version $VER"
|
declare -g BT="$DIST Installer - (x86_64) - Version $VER"
|
||||||
declare -g ROOT_PART=""
|
declare -g ROOT_PART=""
|
||||||
@ -90,7 +92,7 @@ select_language() {
|
|||||||
user_creation() {
|
user_creation() {
|
||||||
tput cnorm
|
tput cnorm
|
||||||
local values
|
local values
|
||||||
values="$(dialog --stdout --no-cancel --separator '~' --ok-label "Submit" --backtitle "$BT" \
|
if ! values="$(dialog --stdout --no-cancel --separator '~' --ok-label "Submit" --backtitle "$BT" \
|
||||||
--title " $_UserTitle " --insecure --mixedform "$_UserBody" 27 75 10 \
|
--title " $_UserTitle " --insecure --mixedform "$_UserBody" 27 75 10 \
|
||||||
"$_Username" 1 1 "" 1 $((${#_Username} + 2)) 71 0 0 \
|
"$_Username" 1 1 "" 1 $((${#_Username} + 2)) 71 0 0 \
|
||||||
"$_Password" 2 1 "" 2 $((${#_Password} + 2)) 71 0 1 \
|
"$_Password" 2 1 "" 2 $((${#_Password} + 2)) 71 0 1 \
|
||||||
@ -98,15 +100,16 @@ user_creation() {
|
|||||||
"$_RootBody" 6 1 "" 6 $((${#_RootBody} + 1)) 71 0 2 \
|
"$_RootBody" 6 1 "" 6 $((${#_RootBody} + 1)) 71 0 2 \
|
||||||
"$_Password" 8 1 "" 8 $((${#_Password} + 2)) 71 0 1 \
|
"$_Password" 8 1 "" 8 $((${#_Password} + 2)) 71 0 1 \
|
||||||
"$_Password2" 9 1 "" 9 $((${#_Password2} + 2)) 71 0 1 |
|
"$_Password2" 9 1 "" 9 $((${#_Password2} + 2)) 71 0 1 |
|
||||||
openssl enc -pbkdf2 -a -salt -pass pass:$SALT)"
|
openssl enc -pbkdf2 -a -salt -pass pass:$SALT)"; then
|
||||||
[[ $? != 0 || $values == "" ]] && return 1
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
# username doesn't need to be re-encrypted
|
# username doesn't need to be re-encrypted
|
||||||
local user
|
local user
|
||||||
user="$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$values" |
|
user="$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$values" |
|
||||||
awk -F'~' '{print $1}')"
|
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
|
# 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
|
# so it decrypts the string '$values', gets the field we want, and re-encrypts it
|
||||||
local pass pass2
|
local pass pass2
|
||||||
pass="$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$values" |
|
pass="$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$values" |
|
||||||
@ -145,46 +148,48 @@ user_creation() {
|
|||||||
# recursively loop back unless the user cancels
|
# recursively loop back unless the user cancels
|
||||||
user || return 1
|
user || return 1
|
||||||
else
|
else
|
||||||
NEWUSER="$user"
|
export NEWUSER="$user"
|
||||||
USER_PASS="$pass"
|
export USER_PASS="$pass"
|
||||||
ROOT_PASS="$rpass"
|
export ROOT_PASS="$rpass"
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
select_keymap() {
|
select_keymap() {
|
||||||
tput civis
|
tput civis
|
||||||
KEYMAP="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! KEYMAP="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||||
--title " $_PrepLayout " --menu "$_XMapBody" 20 70 12 \
|
--title " $_PrepLayout " --menu "$_XMapBody" 20 70 12 \
|
||||||
'us' 'English' 'cm' 'English' 'gb' 'English' 'au' 'English' 'gh' 'English' \
|
'us' 'English' 'cm' 'English' 'gb' 'English' 'au' 'English' 'gh' 'English' \
|
||||||
'za' 'English' 'ng' 'English' 'ca' 'French' 'cd' 'French' 'gn' 'French' \
|
'za' 'English' 'ng' 'English' 'ca' 'French' 'cd' 'French' 'gn' 'French' \
|
||||||
'tg' 'French' 'fr' 'French' 'de' 'German' 'at' 'German' 'ch' 'German' \
|
'tg' 'French' 'fr' 'French' 'de' 'German' 'at' 'German' 'ch' 'German' \
|
||||||
'es' 'Spanish' 'latam' 'Spanish' 'br' 'Portuguese' 'pt' 'Portuguese' 'ma' 'Arabic' \
|
'es' 'Spanish' 'latam' 'Spanish' 'br' 'Portuguese' 'pt' 'Portuguese' 'ma' 'Arabic' \
|
||||||
'sy' 'Arabic' 'ara' 'Arabic' 'ua' 'Ukrainian' 'cz' 'Czech' 'ru' 'Russian' \
|
'sy' 'Arabic' 'ara' 'Arabic' 'ua' 'Ukrainian' 'cz' 'Czech' 'ru' 'Russian' \
|
||||||
'sk' 'Slovak' 'nl' 'Dutch' 'it' 'Italian' 'hu' 'Hungarian' 'cn' 'Chinese' \
|
'sk' 'Slovak' 'nl' 'Dutch' 'it' 'Italian' 'hu' 'Hungarian' 'cn' 'Chinese' \
|
||||||
'tw' 'Taiwanese' 'vn' 'Vietnamese' 'kr' 'Korean' 'jp' 'Japanese' 'th' 'Thai' \
|
'tw' 'Taiwanese' 'vn' 'Vietnamese' 'kr' 'Korean' 'jp' 'Japanese' 'th' 'Thai' \
|
||||||
'la' 'Lao' 'pl' 'Polish' 'se' 'Swedish' 'is' 'Icelandic' 'fi' 'Finnish' \
|
'la' 'Lao' 'pl' 'Polish' 'se' 'Swedish' 'is' 'Icelandic' 'fi' 'Finnish' \
|
||||||
'dk' 'Danish' 'be' 'Belgian' 'in' 'Indian' 'al' 'Albanian' 'am' 'Armenian' \
|
'dk' 'Danish' 'be' 'Belgian' 'in' 'Indian' 'al' 'Albanian' 'am' 'Armenian' \
|
||||||
'bd' 'Bangla' 'ba' 'Bosnian' 'bg' 'Bulgarian' 'dz' 'Berber' 'mm' 'Burmese' \
|
'bd' 'Bangla' 'ba' 'Bosnian' 'bg' 'Bulgarian' 'dz' 'Berber' 'mm' 'Burmese' \
|
||||||
'hr' 'Croatian' 'gr' 'Greek' 'il' 'Hebrew' 'ir' 'Persian' 'iq' 'Iraqi' \
|
'hr' 'Croatian' 'gr' 'Greek' 'il' 'Hebrew' 'ir' 'Persian' 'iq' 'Iraqi' \
|
||||||
'af' 'Afghani' 'fo' 'Faroese' 'ge' 'Georgian' 'ee' 'Estonian' 'kg' 'Kyrgyz' \
|
'af' 'Afghani' 'fo' 'Faroese' 'ge' 'Georgian' 'ee' 'Estonian' 'kg' 'Kyrgyz' \
|
||||||
'kz' 'Kazakh' 'lt' 'Lithuanian' 'mt' 'Maltese' 'mn' 'Mongolian' 'ro' 'Romanian' \
|
'kz' 'Kazakh' 'lt' 'Lithuanian' 'mt' 'Maltese' 'mn' 'Mongolian' 'ro' 'Romanian' \
|
||||||
'no' 'Norwegian' 'rs' 'Serbian' 'si' 'Slovenian' 'tj' 'Tajik' 'lk' 'Sinhala' \
|
'no' 'Norwegian' 'rs' 'Serbian' 'si' 'Slovenian' 'tj' 'Tajik' 'lk' 'Sinhala' \
|
||||||
'tr' 'Turkish' 'uz' 'Uzbek' 'ie' 'Irish' 'pk' 'Urdu' 'mv' 'Dhivehi' \
|
'tr' 'Turkish' 'uz' 'Uzbek' 'ie' 'Irish' 'pk' 'Urdu' 'mv' 'Dhivehi' \
|
||||||
'np' 'Nepali' 'et' 'Amharic' 'sn' 'Wolof' 'ml' 'Bambara' 'tz' 'Swahili' \
|
'np' 'Nepali' 'et' 'Amharic' 'sn' 'Wolof' 'ml' 'Bambara' 'tz' 'Swahili' \
|
||||||
'ke' 'Swahili' 'bw' 'Tswana' 'ph' 'Filipino' 'my' 'Malay' 'tm' 'Turkmen' \
|
'ke' 'Swahili' 'bw' 'Tswana' 'ph' 'Filipino' 'my' 'Malay' 'tm' 'Turkmen' \
|
||||||
'id' 'Indonesian' 'bt' 'Dzongkha' 'lv' 'Latvian' 'md' 'Moldavian' 'mao' 'Maori' \
|
'id' 'Indonesian' 'bt' 'Dzongkha' 'lv' 'Latvian' 'md' 'Moldavian' 'mao' 'Maori' \
|
||||||
'by' 'Belarusian' 'az' 'Azerbaijani' 'mk' 'Macedonian' 'kh' 'Khmer' 'epo' 'Esperanto' \
|
'by' 'Belarusian' 'az' 'Azerbaijani' 'mk' 'Macedonian' 'kh' 'Khmer' 'epo' 'Esperanto' \
|
||||||
'me' 'Montenegrin')"
|
'me' 'Montenegrin')"; then
|
||||||
[[ $? != 0 || $KEYMAP == "" ]] && return 1
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
# when a matching console map is not available open a selection dialog
|
# when a matching console map is not available open a selection dialog
|
||||||
if [[ $CMAPS =~ "$KEYMAP -" ]]; then
|
# shellcheck disable=SC2153
|
||||||
|
if [[ $CMAPS == *"$KEYMAP"* ]]; then
|
||||||
CMAP="$KEYMAP"
|
CMAP="$KEYMAP"
|
||||||
else
|
else
|
||||||
CMAP="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! CMAP="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_CMapTitle " --menu "$_CMapBody" 20 70 12 $CMAPS)"; then
|
||||||
--title " $_CMapTitle " --menu "$_CMapBody" 20 70 12 $CMAPS)"
|
return 1
|
||||||
[[ $? != 0 || $CMAP == "" ]] && return 1
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $DISPLAY && $TERM != 'linux' ]]; then
|
if [[ $DISPLAY && $TERM != 'linux' ]]; then
|
||||||
@ -204,22 +209,24 @@ select_timezone() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
tput civis
|
tput civis
|
||||||
ZONE="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! ZONE="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||||
--title " $_TimeZTitle " --menu "$_TimeZBody" 20 70 10 \
|
--title " $_TimeZTitle " --menu "$_TimeZBody" 20 70 10 \
|
||||||
'America' '-' 'Australia' '-' 'Asia' '-' 'Atlantic' '-' 'Africa' '-' \
|
'America' '-' 'Australia' '-' 'Asia' '-' 'Atlantic' '-' 'Africa' '-' \
|
||||||
'Europe' '-' 'Indian' '-' 'Pacific' '-' 'Arctic' '-' 'Antarctica' '-')"
|
'Europe' '-' 'Indian' '-' 'Pacific' '-' 'Arctic' '-' 'Antarctica' '-')"; then
|
||||||
[[ $? != 0 || $ZONE == "" ]] && return 1
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
SUBZONE="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! SUBZONE="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||||
--title " $_TimeZTitle " --menu "$_TimeSubZBody" 20 70 12 ${SUBZONES[$ZONE]})"
|
--title " $_TimeZTitle " --menu "$_TimeSubZBody" 20 70 12 ${SUBZONES[$ZONE]})"; then
|
||||||
[[ $? != 0 || $SUBZONE == "" ]] && return 1
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
yesno "$_TimeZTitle" "$_TimeZQ $ZONE/$SUBZONE?\n" && return 0 || select_timezone
|
yesno "$_TimeZTitle" "$_TimeZQ $ZONE/$SUBZONE?\n" && return 0 || select_timezone
|
||||||
}
|
}
|
||||||
|
|
||||||
select_wm_or_de() {
|
select_wm_or_de() {
|
||||||
tput civis
|
tput civis
|
||||||
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 \
|
"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 \
|
"bspwm" "A tiling window manager that represents windows as the leaves of a binary tree" off \
|
||||||
@ -227,8 +234,9 @@ select_wm_or_de() {
|
|||||||
"dwm" "A customized fork of dwm, with patches and modifications" 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 \
|
"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)"
|
"xfce4" "A lightweight and modular desktop environment based on GTK+ 2 and 3" off)"; then
|
||||||
[[ $? -eq 0 ]] || return 1
|
return 1
|
||||||
|
fi
|
||||||
[[ $INSTALL_WMS ]] || INSTALL_WMS='openbox'
|
[[ $INSTALL_WMS ]] || INSTALL_WMS='openbox'
|
||||||
|
|
||||||
WM_NUM=$(awk '{print NF}' <<< "$INSTALL_WMS")
|
WM_NUM=$(awk '{print NF}' <<< "$INSTALL_WMS")
|
||||||
@ -244,13 +252,12 @@ select_wm_or_de() {
|
|||||||
gnome) WM_PACKAGES+=" gnome-extra" ;;
|
gnome) WM_PACKAGES+=" gnome-extra" ;;
|
||||||
i3-gaps) WM_PACKAGES+=" i3status perl-anyevent-i3" ;;
|
i3-gaps) WM_PACKAGES+=" i3status perl-anyevent-i3" ;;
|
||||||
xfce4) WM_PACKAGES+=" xfce4-goodies xfce4-pulseaudio-plugin" ;;
|
xfce4) WM_PACKAGES+=" xfce4-goodies xfce4-pulseaudio-plugin" ;;
|
||||||
openbox) WM_PACKAGES+=" archlabs-obkey archlabs-kickshaw archlabs-skippy-xd obconf tint2 conky jgmenu" ;;
|
openbox) WM_PACKAGES+=" archlabs-obkey obconf archlabs-kickshaw tint2 archlabs-skippy-xd conky jgmenu" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps) ]]; then
|
if [[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps) ]]; then
|
||||||
WM_PACKAGES+=" rofi termite thunar archlabs-polybar archlabs-paranoid"
|
WM_PACKAGES+=" libmpdclient rofi jsoncpp archlabs-screenlock termite archlabs-oblogout thunar archlabs-polybar archlabs-paranoid"
|
||||||
WM_PACKAGES+=" libmpdclient jsoncpp archlabs-screenlock archlabs-oblogout"
|
|
||||||
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
|
||||||
@ -263,9 +270,10 @@ select_wm_or_de() {
|
|||||||
if [[ $WM_NUM -eq 1 ]]; then
|
if [[ $WM_NUM -eq 1 ]]; then
|
||||||
LOGIN_WM="$INSTALL_WMS"
|
LOGIN_WM="$INSTALL_WMS"
|
||||||
else
|
else
|
||||||
LOGIN_WM="$(dialog --cr-wrap --stdout --no-cancel --backtitle "$BT" \
|
if ! LOGIN_WM="$(dialog --cr-wrap --stdout --no-cancel --backtitle "$BT" \
|
||||||
--title " $_WMLogin " --menu "$_WMLoginBody" 0 0 0 $LOGIN_CHOICES)"
|
--title " $_WMLogin " --menu "$_WMLoginBody" 0 0 0 $LOGIN_CHOICES)"; then
|
||||||
[[ $? -eq 0 ]] || return 1
|
return 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case $LOGIN_WM in
|
case $LOGIN_WM in
|
||||||
@ -288,11 +296,12 @@ select_wm_or_de() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
select_login_method() {
|
select_login_method() {
|
||||||
LOGIN_TYPE="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! LOGIN_TYPE="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||||
--title " $_WMLogin " --menu "$_LoginTypeBody" 0 0 0 \
|
--title " $_WMLogin " --menu "$_LoginTypeBody" 0 0 0 \
|
||||||
"xinit" "Console login without a display manager" \
|
"xinit" "Console login without a display manager" \
|
||||||
"lightdm" "Lightweight display manager with the gtk greeter")"
|
"lightdm" "Lightweight display manager with the gtk greeter")"; then
|
||||||
[[ $? -eq 0 ]] || return 1
|
return 1
|
||||||
|
fi
|
||||||
if [[ $LOGIN_TYPE == 'lightdm' ]]; then
|
if [[ $LOGIN_TYPE == 'lightdm' ]]; then
|
||||||
WM_PACKAGES+=" lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice"
|
WM_PACKAGES+=" lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice"
|
||||||
EDIT_FILES[11]="/etc/lightdm/lightdm.conf /etc/lightdm/lightdm-gtk-greeter.conf"
|
EDIT_FILES[11]="/etc/lightdm/lightdm.conf /etc/lightdm/lightdm-gtk-greeter.conf"
|
||||||
@ -386,8 +395,8 @@ select_extra_packages() {
|
|||||||
[[ $pkgs =~ noto-fonts ]] && pkgs+=" noto-fonts-emoji"
|
[[ $pkgs =~ noto-fonts ]] && pkgs+=" noto-fonts-emoji"
|
||||||
[[ $pkgs =~ cairo-dock ]] && pkgs+=" cairo-dock-plug-ins"
|
[[ $pkgs =~ cairo-dock ]] && pkgs+=" cairo-dock-plug-ins"
|
||||||
[[ $pkgs =~ kdenlive ]] && pkgs+=" kdebase-runtime dvdauthor frei0r-plugins breeze breeze-gtk"
|
[[ $pkgs =~ kdenlive ]] && pkgs+=" kdebase-runtime dvdauthor frei0r-plugins breeze breeze-gtk"
|
||||||
([[ $INSTALL_WMS =~ dwm ]] && ! [[ $pkgs =~ ttf-hack ]]) && pkgs+=" ttf-hack"
|
{ [[ $INSTALL_WMS =~ dwm ]] && ! [[ $pkgs =~ ttf-hack ]]; } && pkgs+=" ttf-hack"
|
||||||
([[ $pkgs =~ (qutebrowser|qbittorrent|kdenlive|vlc) ]] && ! [[ $pkgs =~ qt5ct ]]) && pkgs+=" qt5ct qt5-styleplugins"
|
{ [[ $pkgs =~ (qutebrowser|qbittorrent|kdenlive|vlc) ]] && ! [[ $pkgs =~ qt5ct ]]; } && pkgs+=" qt5ct qt5-styleplugins"
|
||||||
|
|
||||||
PACKAGES+=" $pkgs" # add chosen packages to the main package list
|
PACKAGES+=" $pkgs" # add chosen packages to the main package list
|
||||||
PACKAGES="${PACKAGES/^ /}" # remove leading spaces from the package string
|
PACKAGES="${PACKAGES/^ /}" # remove leading spaces from the package string
|
||||||
@ -395,14 +404,15 @@ select_extra_packages() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
select_mirrorlist_command() {
|
select_mirrorlist_command() {
|
||||||
|
local ip c
|
||||||
local key="5f29642060ab983b31fdf4c2935d8c56"
|
local key="5f29642060ab983b31fdf4c2935d8c56"
|
||||||
|
|
||||||
if hash reflector >/dev/null 2>&1; then
|
if hash reflector >/dev/null 2>&1; then
|
||||||
MIRROR_CMD="reflector --score 100 -l 50 -f 10 --sort rate --verbose"
|
MIRROR_CMD="reflector --score 100 -l 50 -f 10 --sort rate --verbose"
|
||||||
yesno "$_MirrorTitle" "$_MirrorSetup" "Automatic" "Custom" && return 0
|
yesno "$_MirrorTitle" "$_MirrorSetup" "Automatic" "Custom" && return 0
|
||||||
|
|
||||||
local ip="$(json 'ip' "check&?access_key=${key}&fields=ip")"
|
ip="$(json 'ip' "check&?access_key=${key}&fields=ip")"
|
||||||
local c="$(json 'country_name' "${ip}?access_key=${key}&fields=country_name")"
|
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"
|
MIRROR_CMD="reflector --country $c --score 80 --latest 40 --fastest 10 --sort rate --verbose"
|
||||||
|
|
||||||
tput cnorm
|
tput cnorm
|
||||||
@ -419,8 +429,8 @@ select_mirrorlist_command() {
|
|||||||
'score': MirrorStatus score;
|
'score': MirrorStatus score;
|
||||||
'delay': MirrorStatus delay.\n" 0 0 "$MIRROR_CMD")"
|
'delay': MirrorStatus delay.\n" 0 0 "$MIRROR_CMD")"
|
||||||
else
|
else
|
||||||
local ip="$(json 'ip' "check&?access_key=${key}&fields=ip")"
|
ip="$(json 'ip' "check&?access_key=${key}&fields=ip")"
|
||||||
local c="$(json 'country_code' "${ip}?access_key=${key}&fields=country_code")"
|
c="$(json 'country_code' "${ip}?access_key=${key}&fields=country_code")"
|
||||||
local w="https://www.archlinux.org/mirrorlist"
|
local w="https://www.archlinux.org/mirrorlist"
|
||||||
if [[ $c ]]; then
|
if [[ $c ]]; then
|
||||||
if [[ $c =~ (CA|US) ]]; then
|
if [[ $c =~ (CA|US) ]]; then
|
||||||
@ -442,12 +452,12 @@ display_system_settings() {
|
|||||||
msgbox "$_PrepTitle" "\n\n---------- PARTITION CONFIGURATION ------------
|
msgbox "$_PrepTitle" "\n\n---------- PARTITION CONFIGURATION ------------
|
||||||
|
|
||||||
Root: ${ROOT_PART:-None}
|
Root: ${ROOT_PART:-None}
|
||||||
Boot: ${BOOT_PART:-None}
|
Boot: ${BOOT_PART:-${BOOT_DEVICE:-None}}
|
||||||
|
|
||||||
Swap: ${SWAP_PART:-None}
|
Swap: ${SWAP_PART:-None}
|
||||||
Size: ${SWAP_SIZE:-None}
|
Size: ${SWAP_SIZE:-None}
|
||||||
|
|
||||||
Extra: ${EXTRA_MNTS:-None}
|
Extra: ${EXTRA_MNTS:-${EXTRA_MNT:-None}}
|
||||||
Hooks: ${MKINIT_HOOKS:-None}
|
Hooks: ${MKINIT_HOOKS:-None}
|
||||||
|
|
||||||
LVM: ${LVM:-None}
|
LVM: ${LVM:-None}
|
||||||
@ -487,13 +497,15 @@ display_system_settings() {
|
|||||||
|
|
||||||
configure_system_settings() {
|
configure_system_settings() {
|
||||||
tput cnorm
|
tput cnorm
|
||||||
HOSTNAME="$(getinput "$_ConfHost" "$_HostNameBody" "${DIST,,}")"
|
if ! HOSTNAME="$(getinput "$_ConfHost" "$_HostNameBody" "${DIST,,}")"; then
|
||||||
[[ $? != 0 || ! $HOSTNAME ]] && return 1
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
tput civis
|
tput civis
|
||||||
LOCALE="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
# shellcheck disable=SC2153
|
||||||
--title " $_ConfLocale " --menu "$_LocaleBody" 25 70 20 $LOCALES)"
|
if ! LOCALE="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_ConfLocale " --menu "$_LocaleBody" 25 70 20 $LOCALES)"; then
|
||||||
[[ $? != 0 || ! $LOCALE ]] && return 1
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
select_timezone || return 1
|
select_timezone || return 1
|
||||||
select_mirrorlist_command || return 1
|
select_mirrorlist_command || return 1
|
||||||
@ -501,11 +513,11 @@ configure_system_settings() {
|
|||||||
select_wm_or_de || return 1
|
select_wm_or_de || return 1
|
||||||
|
|
||||||
tput civis
|
tput civis
|
||||||
KERNEL="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! KERNEL="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_KernelTitle " --menu "$_KernelBody" 0 0 0 'linux' '-' 'linux-lts' '-')"; then
|
||||||
--title " $_KernelTitle " --menu "$_KernelBody" 0 0 0 'linux' '-' 'linux-lts' '-')"
|
return 1
|
||||||
[[ $? != 0 || ! $KERNEL ]] && return 1
|
fi
|
||||||
select_extra_packages || return 1
|
select_extra_packages || return 1
|
||||||
CONFIG_DONE=true
|
export CONFIG_DONE=true
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -517,8 +529,8 @@ edit_system_configs() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
tput civis
|
tput civis
|
||||||
local exitstr="Exit"
|
local exitstr
|
||||||
[[ $DEBUG == true ]] && exitstr+=" & Reboot" || exitstr+=" & Reboot"
|
[[ $DEBUG == true ]] && exitstr="View Log & Shutdown" || exitstr="Exit & Reboot"
|
||||||
|
|
||||||
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 \
|
||||||
@ -527,10 +539,11 @@ 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 /tmp/debug-log; die 0; } || die 'systemctl -i reboot'
|
[[ $DEBUG == true ]] && { more /tmp/debug-log; die 'shutdown -h now'; }
|
||||||
|
die 'systemctl -i reboot'
|
||||||
else
|
else
|
||||||
local existing_files=""
|
local existing_files=""
|
||||||
for f in $(echo "${EDIT_FILES[$SELECTED]}"); do
|
for f in $(printf "%s" "${EDIT_FILES[$SELECTED]}"); do
|
||||||
[[ -e ${MNT}$f ]] && existing_files+=" ${MNT}$f"
|
[[ -e ${MNT}$f ]] && existing_files+=" ${MNT}$f"
|
||||||
done
|
done
|
||||||
if [[ ! $existing_files ]]; then
|
if [[ ! $existing_files ]]; then
|
||||||
@ -598,7 +611,7 @@ done
|
|||||||
# trap Ctrl-C to properly exit
|
# trap Ctrl-C to properly exit
|
||||||
trap sigint INT
|
trap sigint INT
|
||||||
|
|
||||||
for arg in $@; do case $arg in
|
for arg in "$@"; do case $arg in
|
||||||
--debug|-d) debug ;;
|
--debug|-d) debug ;;
|
||||||
esac done
|
esac done
|
||||||
|
|
||||||
|
@ -19,12 +19,12 @@ declare -Agr BMNTS=(
|
|||||||
[BIOS-syslinux]="/boot" [UEFI-syslinux]="/boot"
|
[BIOS-syslinux]="/boot" [UEFI-syslinux]="/boot"
|
||||||
)
|
)
|
||||||
|
|
||||||
declare -Agr BOOTLDRS=(
|
declare -Agrx BOOTLDRS=(
|
||||||
[BIOS]="grub ${BMNTS[BIOS-grub]} syslinux ${BMNTS[BIOS-syslinux]}"
|
[BIOS]="grub ${BMNTS[BIOS-grub]} syslinux ${BMNTS[BIOS-syslinux]}"
|
||||||
[UEFI]="systemd-boot ${BMNTS[UEFI-systemd-boot]} grub ${BMNTS[UEFI-grub]} syslinux ${BMNTS[UEFI-syslinux]}"
|
[UEFI]="systemd-boot ${BMNTS[UEFI-systemd-boot]} grub ${BMNTS[UEFI-grub]} syslinux ${BMNTS[UEFI-syslinux]}"
|
||||||
)
|
)
|
||||||
|
|
||||||
declare -gA EDIT_FILES=(
|
declare -Agx EDIT_FILES=(
|
||||||
[2]="/etc/X11/xorg.conf.d/00-keyboard.conf /etc/default/keyboard /etc/vconsole.conf"
|
[2]="/etc/X11/xorg.conf.d/00-keyboard.conf /etc/default/keyboard /etc/vconsole.conf"
|
||||||
[3]="/etc/locale.conf /etc/default/locale"
|
[3]="/etc/locale.conf /etc/default/locale"
|
||||||
[4]="/etc/hostname /etc/hosts"
|
[4]="/etc/hostname /etc/hosts"
|
||||||
|
@ -140,7 +140,7 @@ create_user() {
|
|||||||
sed -i "s/${LIVE}/${NEWUSER}/g" $MNT/etc/{group,gshadow,passwd,shadow}
|
sed -i "s/${LIVE}/${NEWUSER}/g" $MNT/etc/{group,gshadow,passwd,shadow}
|
||||||
|
|
||||||
if [[ -d $MNT/home/$NEWUSER ]]; then
|
if [[ -d $MNT/home/$NEWUSER ]]; then
|
||||||
rm -rf $MNT/home/$LIVE
|
rm -rf ${MNT:?}/home/$LIVE
|
||||||
else
|
else
|
||||||
# fix up some user files that reference the liveuser
|
# fix up some user files that reference the liveuser
|
||||||
sed -i "s/${LIVE}/${NEWUSER}/g" $MNT/home/$LIVE/.config/gtk-3.0/bookmarks \
|
sed -i "s/${LIVE}/${NEWUSER}/g" $MNT/home/$LIVE/.config/gtk-3.0/bookmarks \
|
||||||
|
@ -6,10 +6,11 @@
|
|||||||
# this file is not meant to be run directly
|
# this file is not meant to be run directly
|
||||||
# sourcing this file in a non bash shell is not advised
|
# sourcing this file in a non bash shell is not advised
|
||||||
|
|
||||||
|
# shellcheck disable=2154
|
||||||
# set -n
|
# set -n
|
||||||
|
|
||||||
declare -g LUKS=""
|
declare -g LUKS=""
|
||||||
declare -g LUKS_DEV=""
|
declare -gx LUKS_DEV=""
|
||||||
declare -g LUKS_PART=""
|
declare -g LUKS_PART=""
|
||||||
declare -g LUKS_PASS=""
|
declare -g LUKS_PASS=""
|
||||||
declare -g LUKS_UUID=""
|
declare -g LUKS_UUID=""
|
||||||
@ -27,9 +28,9 @@ luks_open() {
|
|||||||
infobox "$_LuksOpen" "${_OnlyOne}: $LUKS_PART\n" 1
|
infobox "$_LuksOpen" "${_OnlyOne}: $LUKS_PART\n" 1
|
||||||
else
|
else
|
||||||
tput civis
|
tput civis
|
||||||
LUKS_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! LUKS_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_LuksOpen " --menu "$_LuksMenuBody" 0 0 0 $PARTS)"; then
|
||||||
--title " $_LuksOpen " --menu "$_LuksMenuBody" 0 0 0 $PARTS)"
|
return 1
|
||||||
[[ $? != 0 || $LUKS_PART == "" ]] && return 1
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# get password and name for encryption
|
# get password and name for encryption
|
||||||
@ -52,13 +53,14 @@ luks_pass() {
|
|||||||
|
|
||||||
tput cnorm
|
tput cnorm
|
||||||
local values
|
local values
|
||||||
values="$(dialog --stdout --separator '~' --ok-label "Submit" --backtitle "$BT" \
|
if ! values="$(dialog --stdout --separator '~' --ok-label "Submit" --backtitle "$BT" \
|
||||||
--title " $title " --insecure --mixedform "$_LuksOpenBody" 16 75 4 \
|
--title " $title " --insecure --mixedform "$_LuksOpenBody" 16 75 4 \
|
||||||
"$_Name" 1 1 "$name" 1 $((${#_Name} + 2)) 71 0 0 \
|
"$_Name" 1 1 "$name" 1 $((${#_Name} + 2)) 71 0 0 \
|
||||||
"$_Password" 2 1 "" 2 $((${#_Password} + 2)) 71 0 1 \
|
"$_Password" 2 1 "" 2 $((${#_Password} + 2)) 71 0 1 \
|
||||||
"$_Password2" 3 1 "" 3 $((${#_Password2} + 2)) 71 0 1 |
|
"$_Password2" 3 1 "" 3 $((${#_Password2} + 2)) 71 0 1 |
|
||||||
openssl enc -pbkdf2 -a -salt -pass pass:$SALT)"
|
openssl enc -pbkdf2 -a -salt -pass pass:$SALT)"; then
|
||||||
[[ $? != 0 || $values == "" ]] && return 1
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
name="$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$values" |
|
name="$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$values" |
|
||||||
awk -F'~' '{print $1}')"
|
awk -F'~' '{print $1}')"
|
||||||
@ -99,9 +101,9 @@ luks_setup() {
|
|||||||
infobox "$_LuksEncrypt" "${_OnlyOne}: $LUKS_PART\n" 1
|
infobox "$_LuksEncrypt" "${_OnlyOne}: $LUKS_PART\n" 1
|
||||||
else
|
else
|
||||||
tput civis
|
tput civis
|
||||||
LUKS_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! LUKS_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_LuksEncrypt " --menu "$_LuksEncryptBody" 0 0 0 $PARTS)"; then
|
||||||
--title " $_LuksEncrypt " --menu "$_LuksEncryptBody" 0 0 0 $PARTS)"
|
return 1
|
||||||
[[ $? != 0 || $LUKS_PART == "" ]] && return 1
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
infobox "$_PrepMount" "\nUsing root partition created earlier: $ROOT_PART\n" 1
|
infobox "$_PrepMount" "\nUsing root partition created earlier: $ROOT_PART\n" 1
|
||||||
@ -132,8 +134,9 @@ luks_keycmd() {
|
|||||||
if luks_setup; then
|
if luks_setup; then
|
||||||
tput cnorm
|
tput cnorm
|
||||||
local cipher
|
local cipher
|
||||||
cipher="$(getinput "$_PrepLUKS" "$_LuksCipherKey" "-s 512 -c aes-xts-plain64")"
|
if ! cipher="$(getinput "$_PrepLUKS" "$_LuksCipherKey" "-s 512 -c aes-xts-plain64")"; then
|
||||||
[[ $? != 0 || $cipher == "" ]] && return 1
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
infobox "$_LuksEncryptAdv" "$_LuksWaitBody $LUKS_NAME $_LuksWaitBody2 $LUKS_PART\n" 0
|
infobox "$_LuksEncryptAdv" "$_LuksWaitBody $LUKS_NAME $_LuksWaitBody2 $LUKS_PART\n" 0
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
# this file is not meant to be run directly
|
# this file is not meant to be run directly
|
||||||
# sourcing this file in a non bash shell is not advised
|
# sourcing this file in a non bash shell is not advised
|
||||||
|
|
||||||
|
# shellcheck disable=2154
|
||||||
# set -n
|
# set -n
|
||||||
|
|
||||||
declare -g LVM=""
|
declare -g LVM=""
|
||||||
@ -42,17 +43,19 @@ lvm_show_vg() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
tput civis
|
tput civis
|
||||||
DEL_VG="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! DEL_VG="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_PrepLVM " --menu "$_LvmSelVGBody" 18 70 10 $VOL_GROUP_LIST)"; then
|
||||||
--title " $_PrepLVM " --menu "$_LvmSelVGBody" 18 70 10 $VOL_GROUP_LIST)"
|
return 1
|
||||||
[[ $? != 0 || $DEL_VG == "" ]] && return 1
|
fi
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
get_lv_size() {
|
get_lv_size() {
|
||||||
tput cnorm
|
tput cnorm
|
||||||
local ttl=" $_LvmCreateVG (LV:$VOL_COUNT) "
|
local ttl=" $_LvmCreateVG (LV:$VOL_COUNT) "
|
||||||
local msg="${VOLUME_GROUP}: ${GROUP_SIZE}$GROUP_SIZE_TYPE (${VOL_GROUP_MB}MB $_LvmLvSizeBody1).$_LvmLvSizeBody2"
|
local msg="${VOLUME_GROUP}: ${GROUP_SIZE}$GROUP_SIZE_TYPE (${VOL_GROUP_MB}MB $_LvmLvSizeBody1).$_LvmLvSizeBody2"
|
||||||
VOLUME_SIZE="$(getinput "$ttl" "$msg" "")"
|
if ! VOLUME_SIZE="$(getinput "$ttl" "$msg" "")"; then
|
||||||
[[ $? != 0 || $VOLUME_SIZE == "" ]] && return 1
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
ERR_SIZE=0
|
ERR_SIZE=0
|
||||||
# if the size is empty or 0
|
# if the size is empty or 0
|
||||||
@ -104,8 +107,9 @@ lvm_volume_name() {
|
|||||||
|
|
||||||
tput cnorm
|
tput cnorm
|
||||||
local name
|
local name
|
||||||
name="$(getinput "$_LvmCreateVG (LV:$VOL_COUNT)" "$msg" "$default")"
|
if ! name="$(getinput "$_LvmCreateVG (LV:$VOL_COUNT)" "$msg" "$default")"; then
|
||||||
[[ $? != 0 || $name == "" ]] && return 1
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
# bad volume name answer or name already in use
|
# bad volume name answer or name already in use
|
||||||
if [[ ${name:0:1} == "/" || ${#name} -eq 0 || $name =~ \ |\' ]] || grep -q "$name" <<< "$(lsblk)"; then
|
if [[ ${name:0:1} == "/" || ${#name} -eq 0 || $name =~ \ |\' ]] || grep -q "$name" <<< "$(lsblk)"; then
|
||||||
@ -120,8 +124,9 @@ lvm_volume_name() {
|
|||||||
lvm_group_name() {
|
lvm_group_name() {
|
||||||
tput cnorm
|
tput cnorm
|
||||||
local group
|
local group
|
||||||
group="$(getinput "$_LvmCreateVG" "$_LvmNameVgBody" "VolGroup")"
|
if ! group="$(getinput "$_LvmCreateVG" "$_LvmNameVgBody" "VolGroup")"; then
|
||||||
[[ $? != 0 || $group == "" ]] && return 1
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
# bad answer or group name already taken
|
# bad answer or group name already taken
|
||||||
if [[ ${group:0:1} == "/" || ${#group} -eq 0 || $group =~ \ |\' ]] || grep -q "$group" <<< "$(lsblk)"; then
|
if [[ ${group:0:1} == "/" || ${#group} -eq 0 || $group =~ \ |\' ]] || grep -q "$group" <<< "$(lsblk)"; then
|
||||||
@ -151,11 +156,12 @@ lvm_extra_lvs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lvm_volume_count() {
|
lvm_volume_count() {
|
||||||
VOL_COUNT=$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_LvmCreateVG " \
|
if ! VOL_COUNT=$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_LvmCreateVG " \
|
||||||
--radiolist "$_LvmLvNumBody1 $VOLUME_GROUP\n$_LvmLvNumBody2" 0 0 0 \
|
--radiolist "$_LvmLvNumBody1 $VOLUME_GROUP\n$_LvmLvNumBody2" 0 0 0 \
|
||||||
"1" "-" off "2" "-" off "3" "-" off "4" "-" off "5" "-" off \
|
"1" "-" off "2" "-" off "3" "-" off "4" "-" off "5" "-" off \
|
||||||
"6" "-" off "7" "-" off "8" "-" off "9" "-" off)
|
"6" "-" off "7" "-" off "8" "-" off "9" "-" off); then
|
||||||
[[ $? != 0 || $VOL_COUNT == "" ]] && return 1
|
return 1
|
||||||
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,9 +171,9 @@ lvm_partitions() {
|
|||||||
|
|
||||||
# choose partitions
|
# choose partitions
|
||||||
tput civis
|
tput civis
|
||||||
GROUP_PARTS="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! GROUP_PARTS="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_LvmCreateVG " --checklist "$_LvmPvSelBody" 0 0 0 $PARTS)"; then
|
||||||
--title " $_LvmCreateVG " --checklist "$_LvmPvSelBody" 0 0 0 $PARTS)"
|
return 1
|
||||||
[[ $? != 0 || $GROUP_PARTS == "" ]] && return 1
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -247,7 +253,7 @@ lvm_del_all() {
|
|||||||
for i in $PHYSICAL_VOLUMES; do
|
for i in $PHYSICAL_VOLUMES; do
|
||||||
pvremove -f "$i" >/dev/null 2>&1
|
pvremove -f "$i" >/dev/null 2>&1
|
||||||
done
|
done
|
||||||
LVM=' logical volume'
|
export LVM=' logical volume'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
102
src/lib/mount.sh
102
src/lib/mount.sh
@ -6,10 +6,11 @@
|
|||||||
# this file is not meant to be run directly
|
# this file is not meant to be run directly
|
||||||
# sourcing this file in a non bash shell is not advised
|
# sourcing this file in a non bash shell is not advised
|
||||||
|
|
||||||
|
# shellcheck disable=2154,2153,2046
|
||||||
# set -n
|
# set -n
|
||||||
|
|
||||||
readonly SYS_MEM="$(awk '/MemTotal/ {print int($2 / 1024)"M"}' /proc/meminfo)"
|
readonly SYS_MEM="$(awk '/MemTotal/ {print int($2 / 1024)"M"}' /proc/meminfo)"
|
||||||
readonly SALT="$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
|
readonly SALT="$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 32 | head -n 1)"
|
||||||
readonly LOCALES="$(awk '/\.UTF-8/ {gsub(/# .*|#/, ""); if($1) print $1 " -"}' /etc/locale.gen)"
|
readonly LOCALES="$(awk '/\.UTF-8/ {gsub(/# .*|#/, ""); if($1) print $1 " -"}' /etc/locale.gen)"
|
||||||
readonly CMAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' | awk '{gsub(/\.map\.gz|.*\//, ""); print $1 " -"}')"
|
readonly CMAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' | awk '{gsub(/\.map\.gz|.*\//, ""); print $1 " -"}')"
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ mount_install_partitions() {
|
|||||||
infobox "$_PrepMount" "\nUsing boot partition: $BOOT_PART\n" 1
|
infobox "$_PrepMount" "\nUsing boot partition: $BOOT_PART\n" 1
|
||||||
elif [[ $SYS == "UEFI" ]]; then
|
elif [[ $SYS == "UEFI" ]]; then
|
||||||
select_efi_partition || { BOOT_PART=""; return 1; }
|
select_efi_partition || { BOOT_PART=""; return 1; }
|
||||||
elif (( $COUNT > 0 )); then
|
elif (( COUNT > 0 )); then
|
||||||
select_boot_partition || { BOOT_PART=""; return 1; }
|
select_boot_partition || { BOOT_PART=""; return 1; }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -41,27 +42,28 @@ mount_install_partitions() {
|
|||||||
|
|
||||||
unmount_install_partitions() {
|
unmount_install_partitions() {
|
||||||
swapoff -a
|
swapoff -a
|
||||||
for i in $(mount | awk "/${MNT//\//\\/}/"' {print $3}' | sort -r); do
|
umount -R $MNT # >/dev/null 2>&1
|
||||||
umount "$i" >/dev/null 2>&1
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
select_swap() {
|
select_swap() {
|
||||||
# Ask user to select partition or create swapfile
|
# Ask user to select partition or create swapfile
|
||||||
tput civis
|
tput civis
|
||||||
SWAP_PART="$(dialog --backtitle "$BT" --cr-wrap --stdout --title " $_SelSwpSetup " \
|
if ! SWAP_PART="$(dialog --backtitle "$BT" --cr-wrap --stdout --title " $_SelSwpSetup " \
|
||||||
--menu "$_SelSwpBody" 0 0 0 "$_SelSwpNone" "-" "$_SelSwpFile" "$SYS_MEM" $PARTS)"
|
--menu "$_SelSwpBody" 0 0 0 "$_SelSwpNone" "-" "$_SelSwpFile" "$SYS_MEM" $PARTS)" || [[ $SWAP_PART == "$_SelSwpNone" ]]; then
|
||||||
[[ $? != 0 || $SWAP_PART == "$_SelSwpNone" ]] && { SWAP_PART=""; return 0; }
|
SWAP_PART=""; return 0
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $SWAP_PART == "$_SelSwpFile" ]]; then
|
if [[ $SWAP_PART == "$_SelSwpFile" ]]; then
|
||||||
tput cnorm
|
tput cnorm
|
||||||
SWAP_SIZE="$(getinput "$_SelSwpSetup" "$_SelSwpSize" "$SYS_MEM")"
|
if ! SWAP_SIZE="$(getinput "$_SelSwpSetup" "$_SelSwpSize" "$SYS_MEM")"; then
|
||||||
[[ $? != 0 || ! $SWAP_SIZE ]] && { SWAP_PART=""; SWAP_SIZE=""; return 0; }
|
SWAP_PART=""; SWAP_SIZE=""; return 0
|
||||||
|
fi
|
||||||
|
|
||||||
while ! [[ ${SWAP_SIZE:0:1} =~ [1-9] && ${SWAP_SIZE: -1} =~ (M|G) ]]; do
|
while ! [[ ${SWAP_SIZE:0:1} =~ [1-9] && ${SWAP_SIZE: -1} =~ (M|G) ]]; do
|
||||||
msgbox "$_SelSwpSetup Error" "\n$_SelSwpErr $SWAP_SIZE\n"
|
msgbox "$_SelSwpSetup Error" "\n$_SelSwpErr $SWAP_SIZE\n"
|
||||||
SWAP_SIZE="$(getinput "$_SelSwpSetup" "$_SelSwpSize" "$SYS_MEM")"
|
if ! SWAP_SIZE="$(getinput "$_SelSwpSetup" "$_SelSwpSize" "$SYS_MEM")"; then
|
||||||
[[ $? != 0 || ! $SWAP_SIZE ]] && { SWAP_PART=""; SWAP_SIZE=""; break; return 0; }
|
SWAP_PART=""; SWAP_SIZE=""; break; return 0
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
enable_swap "$MNT/swapfile"
|
enable_swap "$MNT/swapfile"
|
||||||
@ -76,8 +78,9 @@ select_swap() {
|
|||||||
|
|
||||||
select_mountpoint() {
|
select_mountpoint() {
|
||||||
tput cnorm
|
tput cnorm
|
||||||
EXTRA_MNT="$(getinput "$_PrepMount $part" "$_ExtPartBody1 /home /var\n" "/")"
|
if ! EXTRA_MNT="$(getinput "$_PrepMount $part" "$_ExtPartBody1 /home /var\n" "/")"; then
|
||||||
[[ $? != 0 || $EXTRA_MNT == "" ]] && return 1
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
# bad mountpoint
|
# bad mountpoint
|
||||||
if [[ ${EXTRA_MNT:0:1} != "/" || ${#EXTRA_MNT} -le 1 || $EXTRA_MNT =~ \ |\' ]]; then
|
if [[ ${EXTRA_MNT:0:1} != "/" || ${#EXTRA_MNT} -le 1 || $EXTRA_MNT =~ \ |\' ]]; then
|
||||||
@ -90,9 +93,10 @@ select_mountpoint() {
|
|||||||
select_boot_setup() {
|
select_boot_setup() {
|
||||||
# choose bootloader and mountpoint (if needed)
|
# choose bootloader and mountpoint (if needed)
|
||||||
tput civis
|
tput civis
|
||||||
BOOTLDR="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! BOOTLDR="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||||
--title " $_PrepMount " --menu "$_MntBootBody" 0 0 0 ${BOOTLDRS[$SYS]})"
|
--title " $_PrepMount " --menu "$_MntBootBody" 0 0 0 ${BOOTLDRS[$SYS]})"; then
|
||||||
[[ $? != 0 || $BOOTLDR == "" ]] && return 1
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
# grub on BIOS needs an install device, NOT partition eg. /dev/sda
|
# grub on BIOS needs an install device, NOT partition eg. /dev/sda
|
||||||
if [[ $SYS == 'BIOS' && $BOOTLDR == 'grub' && $BOOT_DEVICE == "" ]]; then
|
if [[ $SYS == 'BIOS' && $BOOTLDR == 'grub' && $BOOT_DEVICE == "" ]]; then
|
||||||
@ -104,17 +108,18 @@ select_boot_setup() {
|
|||||||
elif [[ $BOOTLDR == 'syslinux' ]]; then
|
elif [[ $BOOTLDR == 'syslinux' ]]; then
|
||||||
if [[ $SYS == 'BIOS' ]]; then
|
if [[ $SYS == 'BIOS' ]]; then
|
||||||
FILES[9]="/boot/syslinux/syslinux.cfg"
|
FILES[9]="/boot/syslinux/syslinux.cfg"
|
||||||
BCMDS[$BOOTLDR]="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! BCMDS[$BOOTLDR]="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||||
--title " $_InstSysTitle " --menu "$_InstSysBody" 0 0 0 \
|
--title " $_InstSysTitle " --menu "$_InstSysBody" 0 0 0 \
|
||||||
"syslinux-install_update -iam" "Install to MBR (Master Boot Record)" \
|
"syslinux-install_update -iam" "Install to MBR (Master Boot Record)" \
|
||||||
"syslinux-install_update -i" "Install to root partition (/)")"
|
"syslinux-install_update -i" "Install to root partition (/)")"; then
|
||||||
[[ $? != 0 || ${BCMDS[$BOOTLDR]} == "" ]] && return 1
|
return 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
FILES[9]="/boot/EFI/syslinux/syslinux.cfg"
|
FILES[9]="/boot/EFI/syslinux/syslinux.cfg"
|
||||||
BCMDS[syslinux]="efibootmgr -c -d $BOOT_DEVICE -p $BOOT_PART_NUM -l /EFI/syslinux/syslinux.efi -L $DIST"
|
BCMDS[syslinux]="efibootmgr -c -d $BOOT_DEVICE -p $BOOT_PART_NUM -l /EFI/syslinux/syslinux.efi -L $DIST"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
FILES[9]="/etc/default/grub"
|
export FILES[9]="/etc/default/grub"
|
||||||
if [[ $SYS == 'UEFI' ]]; then
|
if [[ $SYS == 'UEFI' ]]; then
|
||||||
local ttype="i386-efi"
|
local ttype="i386-efi"
|
||||||
[[ $IS_64BIT == true ]] && ttype='x86_64-efi'
|
[[ $IS_64BIT == true ]] && ttype='x86_64-efi'
|
||||||
@ -122,7 +127,6 @@ select_boot_setup() {
|
|||||||
else
|
else
|
||||||
BCMDS[grub]+=" --target=i386-pc $BOOT_DEVICE"
|
BCMDS[grub]+=" --target=i386-pc $BOOT_DEVICE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BCMDS[grub]+=" && grub-mkconfig -o /boot/grub/grub.cfg"
|
BCMDS[grub]+=" && grub-mkconfig -o /boot/grub/grub.cfg"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -131,7 +135,7 @@ select_boot_setup() {
|
|||||||
setup_boot_device
|
setup_boot_device
|
||||||
mount_partition "$BOOT_PART" "${BMNTS[$SYS-$BOOTLDR]}" ||
|
mount_partition "$BOOT_PART" "${BMNTS[$SYS-$BOOTLDR]}" ||
|
||||||
{ src /usr/share/archlabs/installer/lib/boot.sh ; return 1; }
|
{ src /usr/share/archlabs/installer/lib/boot.sh ; return 1; }
|
||||||
SEPERATE_BOOT=true
|
export SEPERATE_BOOT=true
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -140,16 +144,15 @@ select_mount_opts() {
|
|||||||
local part="$1"
|
local part="$1"
|
||||||
local fs="$2"
|
local fs="$2"
|
||||||
local title="${fs^} Mount Options"
|
local title="${fs^} Mount Options"
|
||||||
|
local opts
|
||||||
|
opts="${FS_OPTS[$fs]}"
|
||||||
|
ssd "$part" && opts=$(sed 's/discard - off/discard - on/' <<< "$opts")
|
||||||
|
|
||||||
tput civis
|
tput civis
|
||||||
if ssd "$part"; then
|
if ! MNT_OPTS="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " \
|
||||||
MNT_OPTS="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " --checklist \
|
--checklist "$_MntBody" 0 0 0 $opts | sed 's/ /,/g; $s/,$//')"; then
|
||||||
"$_MntBody" 0 0 0 $(sed 's/discard - off/discard - on/' <<< "${FS_OPTS[$fs]}") | sed 's/ /,/g; $s/,$//')"
|
return 1
|
||||||
else
|
|
||||||
MNT_OPTS="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " \
|
|
||||||
--checklist "$_MntBody" 0 0 0 ${FS_OPTS[$fs]} | sed 's/ /,/g; $s/,$//')"
|
|
||||||
fi
|
fi
|
||||||
[[ $? != 0 || $MNT_OPTS == "" ]] && return 1
|
|
||||||
|
|
||||||
if ! yesno "$title" "$_MntConfBody $MNT_OPTS\n"; then
|
if ! yesno "$title" "$_MntConfBody $MNT_OPTS\n"; then
|
||||||
select_mount_opts "$part" "$fs" || return 1
|
select_mount_opts "$part" "$fs" || return 1
|
||||||
@ -159,21 +162,21 @@ select_mount_opts() {
|
|||||||
|
|
||||||
select_filesystem() {
|
select_filesystem() {
|
||||||
local part="$1"
|
local part="$1"
|
||||||
local cur_fs="$(lsblk -lno FSTYPE $part)"
|
local cur_fs str
|
||||||
local str="$([[ $cur_fs && $part != $ROOT_PART ]] && printf "\nExisting Filesystem: %s" "$cur_fs")"
|
cur_fs="$(lsblk -lno FSTYPE $part)"
|
||||||
|
str="$([[ $cur_fs && $part != "$ROOT_PART" ]] && printf "\nExisting Filesystem: %s" "$cur_fs")"
|
||||||
tput civis
|
tput civis
|
||||||
|
|
||||||
local fs
|
local fs
|
||||||
fs="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_FSTitle: $part " \
|
fs="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_FSTitle: $part " \
|
||||||
--menu "\nSelect which filesystem you want to use for $part\n\nPartition Name: ${part}${str}$_FSBody" 0 0 0 \
|
--menu "\nSelect which filesystem you want to use for $part\n\nPartition Name: ${part}${str}$_FSBody" 0 0 0 \
|
||||||
$([[ $cur_fs && $part != $ROOT_PART ]] && printf "%s" "$_Skip -") \
|
$([[ $cur_fs && $part != "$ROOT_PART" ]] && printf "%s" "$_Skip -") \
|
||||||
"ext4" "${FS_CMDS[ext4]}" "ext3" "${FS_CMDS[ext3]}" \
|
"ext4" "${FS_CMDS[ext4]}" "ext3" "${FS_CMDS[ext3]}" \
|
||||||
"ext2" "${FS_CMDS[ext2]}" "vfat" "${FS_CMDS[vfat]}" \
|
"ext2" "${FS_CMDS[ext2]}" "vfat" "${FS_CMDS[vfat]}" \
|
||||||
"ntfs" "${FS_CMDS[ntfs]}" "f2fs" "${FS_CMDS[f2fs]}" \
|
"ntfs" "${FS_CMDS[ntfs]}" "f2fs" "${FS_CMDS[f2fs]}" \
|
||||||
"jfs" "${FS_CMDS[jfs]}" "nilfs2" "${FS_CMDS[nilfs2]}" \
|
"jfs" "${FS_CMDS[jfs]}" "nilfs2" "${FS_CMDS[nilfs2]}" \
|
||||||
"reiserfs" "${FS_CMDS[reiserfs]}" "xfs" "${FS_CMDS[xfs]}")"
|
"reiserfs" "${FS_CMDS[reiserfs]}" "xfs" "${FS_CMDS[xfs]}")"
|
||||||
[[ $fs == "$_Skip" ]] && return 0
|
[[ $fs == "$_Skip" ]] && return 0 || { [[ $fs == "" ]] && return 1; }
|
||||||
[[ $fs == "" ]] && return 1
|
|
||||||
|
|
||||||
if yesno "$_FSTitle" "\nFormat $part as $fs?\n"; then
|
if yesno "$_FSTitle" "\nFormat $part as $fs?\n"; then
|
||||||
format $part $fs
|
format $part $fs
|
||||||
@ -189,9 +192,10 @@ select_efi_partition() {
|
|||||||
BOOT_PART="$(awk 'NF > 0 {print $1}' <<< "$PARTS")"
|
BOOT_PART="$(awk 'NF > 0 {print $1}' <<< "$PARTS")"
|
||||||
infobox "$_PrepMount" "$_OnlyOne for EFI: $BOOT_PART\n" 1
|
infobox "$_PrepMount" "$_OnlyOne for EFI: $BOOT_PART\n" 1
|
||||||
else
|
else
|
||||||
BOOT_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! BOOT_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||||
--title " $_PrepMount " --menu "$_SelUefiBody" 0 0 0 $PARTS)"
|
--title " $_PrepMount " --menu "$_SelUefiBody" 0 0 0 $PARTS)"; then
|
||||||
[[ $? != 0 || $BOOT_PART == "" ]] && return 1
|
return 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if grep -q 'fat' <<< "$(fsck -N "$BOOT_PART")"; then
|
if grep -q 'fat' <<< "$(fsck -N "$BOOT_PART")"; then
|
||||||
@ -206,10 +210,8 @@ select_efi_partition() {
|
|||||||
|
|
||||||
select_boot_partition() {
|
select_boot_partition() {
|
||||||
tput civis
|
tput civis
|
||||||
BOOT_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! BOOT_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_PrepMount " \
|
||||||
--title " $_PrepMount " --menu "$_SelBiosBody" 0 0 0 "$_Skip" "-" $PARTS)"
|
--menu "$_SelBiosBody" 0 0 0 "$_Skip" "-" $PARTS)" || [[ $BOOT_PART == "$_Skip" ]]; then
|
||||||
|
|
||||||
if [[ $BOOT_PART == "$_Skip" || ! $BOOT_PART ]]; then
|
|
||||||
BOOT_PART=""
|
BOOT_PART=""
|
||||||
else
|
else
|
||||||
if grep -q 'ext[34]' <<< "$(fsck -N "$BOOT_PART")"; then
|
if grep -q 'ext[34]' <<< "$(fsck -N "$BOOT_PART")"; then
|
||||||
@ -230,7 +232,7 @@ select_root_partition() {
|
|||||||
decr_count "$LUKS_PART"
|
decr_count "$LUKS_PART"
|
||||||
elif [[ $LVM ]]; then
|
elif [[ $LVM ]]; then
|
||||||
[[ $LUKS ]] && decr_count "$LUKS_PART"
|
[[ $LUKS ]] && decr_count "$LUKS_PART"
|
||||||
for part in $(echo "$GROUP_PARTS"); do decr_count "$part"; done
|
for part in $(printf "%s" "$GROUP_PARTS"); do decr_count "$part"; done
|
||||||
ROOT_PART=""
|
ROOT_PART=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -239,9 +241,10 @@ select_root_partition() {
|
|||||||
infobox "$_PrepMount" "$_OnlyOne for root (/): $ROOT_PART\n" 1
|
infobox "$_PrepMount" "$_OnlyOne for root (/): $ROOT_PART\n" 1
|
||||||
elif [[ ! $ROOT_PART || $LVM ]]; then
|
elif [[ ! $ROOT_PART || $LVM ]]; then
|
||||||
tput civis
|
tput civis
|
||||||
ROOT_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! ROOT_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||||
--title " $_PrepMount " --menu "$_SelRootBody" 0 0 0 $PARTS)"
|
--title " $_PrepMount " --menu "$_SelRootBody" 0 0 0 $PARTS)"; then
|
||||||
[[ $? != 0 || $ROOT_PART == "" ]] && return 1
|
return 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
local msg="\nUsing${LUKS} root partition:" # $LUKS might just be an empty string
|
local msg="\nUsing${LUKS} root partition:" # $LUKS might just be an empty string
|
||||||
infobox "$_PrepMount" "$msg $ROOT_PART\n" 1
|
infobox "$_PrepMount" "$msg $ROOT_PART\n" 1
|
||||||
@ -256,9 +259,10 @@ select_extra_partitions() {
|
|||||||
while (( COUNT > 0 )); do
|
while (( COUNT > 0 )); do
|
||||||
tput civis
|
tput civis
|
||||||
local part
|
local part
|
||||||
part="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
if ! part="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_PrepMount " \
|
||||||
--title " $_PrepMount " --menu "$_ExtPartBody" 0 0 0 "$_Done" "-" $PARTS)"
|
--menu "$_ExtPartBody" 0 0 0 "$_Done" "-" $PARTS)" || [[ $part == "$_Done" ]]; then
|
||||||
[[ $? != 0 || $part == "$_Done" || $part == "" ]] && break
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
# choose what filesystem and get the mountpoint
|
# choose what filesystem and get the mountpoint
|
||||||
select_filesystem "$part" || { break; return 1; }
|
select_filesystem "$part" || { break; return 1; }
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
# this file is not meant to be run directly
|
# this file is not meant to be run directly
|
||||||
# sourcing this file in a non bash shell is not advised
|
# sourcing this file in a non bash shell is not advised
|
||||||
|
|
||||||
|
# shellcheck disable=2154,2153,2046
|
||||||
# set -n
|
# set -n
|
||||||
|
|
||||||
declare -Agr FS_CMDS=(
|
declare -Agr FS_CMDS=(
|
||||||
@ -40,11 +41,12 @@ partition() {
|
|||||||
|
|
||||||
tput civis
|
tput civis
|
||||||
local choice
|
local choice
|
||||||
choice="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_PartTitle " \
|
if ! choice="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_PartTitle " \
|
||||||
--menu "$_PartBody" 0 0 0 "$_PartShowTree" "-" "$_PartAuto" "-" \
|
--menu "$_PartBody" 0 0 0 "$_PartShowTree" "-" "$_PartAuto" "-" \
|
||||||
$( ([[ $DISPLAY ]] && hash gparted >/dev/null 2>&1) && printf "gparted -") \
|
$({ [[ $DISPLAY ]] && hash gparted >/dev/null 2>&1; } && printf "gparted -") \
|
||||||
"cfdisk" "-" "parted" "-" "$_PartWipe" "-")"
|
"cfdisk" "-" "parted" "-" "$_PartWipe" "-")"; then
|
||||||
[[ $? != 0 || $choice == "" ]] && return 1
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
tput civis
|
tput civis
|
||||||
if [[ $choice != "$_PartWipe" && $choice != "$_PartAuto" && $choice != "$_PartShowTree" ]]; then
|
if [[ $choice != "$_PartWipe" && $choice != "$_PartAuto" && $choice != "$_PartShowTree" ]]; then
|
||||||
@ -109,9 +111,10 @@ select_device() {
|
|||||||
infobox "$_DevSelTitle" "$msg $DEVICE\n" 1
|
infobox "$_DevSelTitle" "$msg $DEVICE\n" 1
|
||||||
elif (( DEV_COUNT > 1 )); then
|
elif (( DEV_COUNT > 1 )); then
|
||||||
tput civis
|
tput civis
|
||||||
DEVICE="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_DevSelTitle " \
|
if ! DEVICE="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_DevSelTitle " \
|
||||||
--menu "${msg}$_DevSelBody" 0 0 0 $SYS_DEVS)"
|
--menu "${msg}$_DevSelBody" 0 0 0 $SYS_DEVS)"; then
|
||||||
[[ $? != 0 || $DEVICE == "" ]] && return 1
|
return 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
msg="\nNo available devices to use$([[ $1 == 'boot' ]] && printf " for bootloader")."
|
msg="\nNo available devices to use$([[ $1 == 'boot' ]] && printf " for bootloader")."
|
||||||
msgbox "$_ErrTitle" "$msg\n$_Exit"
|
msgbox "$_ErrTitle" "$msg\n$_Exit"
|
||||||
@ -129,7 +132,7 @@ confirm_mount() {
|
|||||||
local msg="Partition: $part\n"
|
local msg="Partition: $part\n"
|
||||||
[[ $mount == "$MNT" ]] && msg+="Mountpoint: / (root)" || msg+="Mountpoint: ${mount#$MNT}"
|
[[ $mount == "$MNT" ]] && msg+="Mountpoint: / (root)" || msg+="Mountpoint: ${mount#$MNT}"
|
||||||
|
|
||||||
if [[ $(mount) =~ "$mount" ]]; then
|
if [[ $(mount) == *"$mount"* ]]; then
|
||||||
infobox "$_MntTitle" "$_MntSucc\n$msg\n" 1 && decr_count "$part"
|
infobox "$_MntTitle" "$_MntSucc\n$msg\n" 1 && decr_count "$part"
|
||||||
else
|
else
|
||||||
infobox "$_MntTitle" "$_MntFail\n$msg\n" 1 && return 1
|
infobox "$_MntTitle" "$_MntFail\n$msg\n" 1 && return 1
|
||||||
@ -140,7 +143,8 @@ confirm_mount() {
|
|||||||
check_cryptlvm() {
|
check_cryptlvm() {
|
||||||
local dev=""
|
local dev=""
|
||||||
local part="$1"
|
local part="$1"
|
||||||
local devs="$(lsblk -lno NAME,FSTYPE,TYPE)"
|
local devs
|
||||||
|
devs="$(lsblk -lno NAME,FSTYPE,TYPE)"
|
||||||
|
|
||||||
# Identify if $part is "crypt" (LUKS on LVM, or LUKS alone)
|
# Identify if $part is "crypt" (LUKS on LVM, or LUKS alone)
|
||||||
if [[ $(lsblk -lno TYPE "$part") =~ 'crypt' ]]; then
|
if [[ $(lsblk -lno TYPE "$part") =~ 'crypt' ]]; then
|
||||||
@ -163,7 +167,7 @@ check_cryptlvm() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
elif [[ $(lsblk -lno TYPE "$part") =~ 'lvm' ]]; then
|
elif [[ $(lsblk -lno TYPE "$part") =~ 'lvm' ]]; then
|
||||||
LVM=' logical volume'
|
export LVM=' logical volume'
|
||||||
VOLUME_NAME="${part#/dev/mapper/}"
|
VOLUME_NAME="${part#/dev/mapper/}"
|
||||||
|
|
||||||
for dev in $(awk '/crypt/ && /lvm2_member/ {print "/dev/mapper/"$1}' <<< "$devs" | uniq); do
|
for dev in $(awk '/crypt/ && /lvm2_member/ {print "/dev/mapper/"$1}' <<< "$devs" | uniq); do
|
||||||
@ -176,7 +180,7 @@ check_cryptlvm() {
|
|||||||
if grep -q "$LUKS_NAME" <<< "$(lsblk -lno NAME "$dev")"; then
|
if grep -q "$LUKS_NAME" <<< "$(lsblk -lno NAME "$dev")"; then
|
||||||
LUKS_UUID="$(lsblk -lno UUID,TYPE,FSTYPE "$dev" | awk '/part/ && /crypto_LUKS/ {print $1}')"
|
LUKS_UUID="$(lsblk -lno UUID,TYPE,FSTYPE "$dev" | awk '/part/ && /crypto_LUKS/ {print $1}')"
|
||||||
LUKS_DEV="$LUKS_DEV cryptdevice=UUID=$LUKS_UUID:$LUKS_NAME"
|
LUKS_DEV="$LUKS_DEV cryptdevice=UUID=$LUKS_UUID:$LUKS_NAME"
|
||||||
LUKS=' encrypted'
|
export LUKS=' encrypted'
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -185,7 +189,8 @@ check_cryptlvm() {
|
|||||||
|
|
||||||
auto_partition() {
|
auto_partition() {
|
||||||
local device="$1"
|
local device="$1"
|
||||||
local size=$(lsblk -lno SIZE $device | awk 'NR == 1 {
|
local size
|
||||||
|
size=$(lsblk -lno SIZE $device | awk 'NR == 1 {
|
||||||
if ($1 ~ "G") {
|
if ($1 ~ "G") {
|
||||||
sub(/G/, ""); print ($1 * 1000 - 512) / 1000"G"
|
sub(/G/, ""); print ($1 * 1000 - 512) / 1000"G"
|
||||||
} else {
|
} else {
|
||||||
@ -206,9 +211,11 @@ auto_partition() {
|
|||||||
|
|
||||||
swapoff -a # in case the device was previously used for swap
|
swapoff -a # in case the device was previously used for swap
|
||||||
|
|
||||||
local dev_info="$(parted -s $device print)"
|
local dev_info
|
||||||
|
dev_info="$(parted -s $device print)"
|
||||||
|
|
||||||
# walk the partitions on the device in reverse order and delete them
|
# walk the partitions on the device in reverse order and delete them
|
||||||
|
# shellcheck disable=2013
|
||||||
for i in $(awk '/^ [1-9][0-9]?/ {print $1}' <<< "$dev_info" | sort -r); do
|
for i in $(awk '/^ [1-9][0-9]?/ {print $1}' <<< "$dev_info" | sort -r); do
|
||||||
parted -s $device rm $i >/dev/null 2>&1
|
parted -s $device rm $i >/dev/null 2>&1
|
||||||
done
|
done
|
||||||
@ -247,7 +254,8 @@ auto_partition() {
|
|||||||
mount_partition() {
|
mount_partition() {
|
||||||
local part="$1"
|
local part="$1"
|
||||||
local mountp="${MNT}$2"
|
local mountp="${MNT}$2"
|
||||||
local fs="$(lsblk -lno FSTYPE $part)"
|
local fs
|
||||||
|
fs="$(lsblk -lno FSTYPE $part)"
|
||||||
|
|
||||||
mkdir -p "$mountp"
|
mkdir -p "$mountp"
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
# this file is not meant to be run directly
|
# this file is not meant to be run directly
|
||||||
# sourcing this file in a non bash shell is not advised
|
# sourcing this file in a non bash shell is not advised
|
||||||
|
|
||||||
|
# shellcheck disable=2154
|
||||||
# set -n
|
# set -n
|
||||||
|
|
||||||
chrun() {
|
chrun() {
|
||||||
@ -29,8 +30,8 @@ ssd() {
|
|||||||
|
|
||||||
die() {
|
die() {
|
||||||
tput cnorm
|
tput cnorm
|
||||||
|
fuser -km $MNT # >/dev/null 2>&1
|
||||||
unmount_install_partitions
|
unmount_install_partitions
|
||||||
pgrep -f "$TERM_CMD -e tail" && pkill -f "$TERM_CMD -e tail"
|
|
||||||
[[ $1 =~ [0-9] ]] && exit $1 || $1
|
[[ $1 =~ [0-9] ]] && exit $1 || $1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,10 +54,11 @@ oneshot() {
|
|||||||
|
|
||||||
getinput() {
|
getinput() {
|
||||||
local answer
|
local answer
|
||||||
answer="$(dialog --cr-wrap --max-input 63 --stdout --no-cancel \
|
if ! answer="$(dialog --cr-wrap --max-input 63 --stdout --no-cancel \
|
||||||
--backtitle "$BT" --title " $1 " --inputbox "$2" 0 0 "$3")"
|
--backtitle "$BT" --title " $1 " --inputbox "$2" 0 0 "$3")" || [[ $answer == '' ]]; then
|
||||||
[[ $? != 0 || $answer == "" ]] && return 1
|
return 1
|
||||||
printf "$answer"
|
fi
|
||||||
|
printf "%s" "$answer"
|
||||||
}
|
}
|
||||||
|
|
||||||
infobox() {
|
infobox() {
|
||||||
@ -67,7 +69,7 @@ infobox() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
printq() {
|
printq() {
|
||||||
local str="$@"
|
local str="$*"
|
||||||
if [[ ${#str} -gt $(( ${COLUMNS:-$(tput cols)} / 2 )) ]]; then
|
if [[ ${#str} -gt $(( ${COLUMNS:-$(tput cols)} / 2 )) ]]; then
|
||||||
q=$(awk '{print int(NF / 4)}' <<< "$str")
|
q=$(awk '{print int(NF / 4)}' <<< "$str")
|
||||||
str="$(awk '{
|
str="$(awk '{
|
||||||
@ -102,7 +104,7 @@ devices() {
|
|||||||
SYS_DEVS="$(lsblk -lno NAME,SIZE,TYPE | awk '/disk/ {print "/dev/" $1 " " $2}')"
|
SYS_DEVS="$(lsblk -lno NAME,SIZE,TYPE | awk '/disk/ {print "/dev/" $1 " " $2}')"
|
||||||
fi
|
fi
|
||||||
DEV_COUNT="$(wc -l <<< "$SYS_DEVS")"
|
DEV_COUNT="$(wc -l <<< "$SYS_DEVS")"
|
||||||
declare -gr SYS_DEVS IGNORE_DEV DEV_COUNT
|
declare -grx SYS_DEVS IGNORE_DEV DEV_COUNT
|
||||||
}
|
}
|
||||||
|
|
||||||
sysid() {
|
sysid() {
|
||||||
@ -110,9 +112,9 @@ sysid() {
|
|||||||
local efidir="/sys/firmware/efi"
|
local efidir="/sys/firmware/efi"
|
||||||
|
|
||||||
if grep -q 'GenuineIntel' /proc/cpuinfo; then
|
if grep -q 'GenuineIntel' /proc/cpuinfo; then
|
||||||
declare -g UCODE="intel-ucode.img"
|
declare -gx UCODE="intel-ucode.img"
|
||||||
elif grep -q 'AuthenticAMD' /proc/cpuinfo; then
|
elif grep -q 'AuthenticAMD' /proc/cpuinfo; then
|
||||||
declare -g UCODE="amd-ucode.img"
|
declare -gx UCODE="amd-ucode.img"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if grep -qi 'apple' /sys/class/dmi/id/sys_vendor; then
|
if grep -qi 'apple' /sys/class/dmi/id/sys_vendor; then
|
||||||
@ -123,7 +125,7 @@ sysid() {
|
|||||||
|
|
||||||
if [[ -d $efidir ]]; then
|
if [[ -d $efidir ]]; then
|
||||||
SYS="UEFI"
|
SYS="UEFI"
|
||||||
[[ $(cat $efidir/fw_platform_size) == 64 ]] && IS_64BIT=true
|
[[ $(cat $efidir/fw_platform_size) == 64 ]] && export IS_64BIT=true
|
||||||
grep -q $efidir/efivars <<< "$(mount)" || mount -t efivarfs efivarfs $efidir/efivars
|
grep -q $efidir/efivars <<< "$(mount)" || mount -t efivarfs efivarfs $efidir/efivars
|
||||||
else
|
else
|
||||||
SYS="BIOS"
|
SYS="BIOS"
|
||||||
@ -149,7 +151,8 @@ checks() {
|
|||||||
|
|
||||||
echeck() {
|
echeck() {
|
||||||
# return if the last process exited normally
|
# return if the last process exited normally
|
||||||
(( $? == 0 )) && return 0
|
local last_exit_code=$?
|
||||||
|
(( last_exit_code == 0 )) && return 0
|
||||||
local msg="\nThe command exited abnormally: $1"
|
local msg="\nThe command exited abnormally: $1"
|
||||||
|
|
||||||
# get error message from logfile and strip any non-printable characters,
|
# get error message from logfile and strip any non-printable characters,
|
||||||
@ -169,8 +172,8 @@ echeck() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
icheck() {
|
icheck() {
|
||||||
[[ $(lsblk -o MOUNTPOINT) =~ $MNT ]] || { msgbox "$_ErrTitle" "$_ErrNoMount"; SELECTED=4; return 1; }
|
[[ $(lsblk -o MOUNTPOINT) =~ $MNT ]] || { msgbox "$_ErrTitle" "$_ErrNoMount"; export SELECTED=4; return 1; }
|
||||||
[[ $CONFIG_DONE == true ]] || { msgbox "$_ErrTitle" "$_ErrNoConfig"; SELECTED=5; return 1; }
|
[[ $CONFIG_DONE == true ]] || { msgbox "$_ErrTitle" "$_ErrNoConfig"; export SELECTED=5; return 1; }
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,5 +203,5 @@ debug() {
|
|||||||
xterm -e "tail -f /tmp/debug-log" &
|
xterm -e "tail -f /tmp/debug-log" &
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
DEBUG=true
|
export DEBUG=true
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user