More cleanup and fixes, rename a large amount of functions for brevity
This commit is contained in:
parent
3401939dd6
commit
89c95254ed
35
README.md
35
README.md
@ -1,26 +1,25 @@
|
|||||||
# ArchLabs Installer
|
# ArchLabs Installer
|
||||||
|
|
||||||
#### Features
|
#### Features
|
||||||
+ Support for LUKS and/or LVM.
|
- Simple, easy to follow configuration.
|
||||||
+ Simple & easy to follow configuration.
|
- Automatic partitioning for whole devices.
|
||||||
+ Automatic partitioning for whole devices.
|
- Translations for different languages.
|
||||||
+ Translations for 10 different languages.
|
- No input halts during install.
|
||||||
+ Built-in error detection and capturing.
|
- Support for LUKS and/or LVM.
|
||||||
+ No input halts during install, setup is done first.
|
- Built-in error detection.
|
||||||
+ Written entirely in Bash making it easily hackable.
|
- Written entirely in Bash
|
||||||
|
|
||||||
#### Requirements
|
#### Requirements
|
||||||
+ `rsync` used to unpack the squashfs root.
|
- `rsync` for unpacking the squashfs.
|
||||||
+ `dialog` for all user input/output.
|
- `dialog` for all user input/output.
|
||||||
+ `vim` for editing files post install.
|
- `vim` for editing files post install.
|
||||||
+ `parted` for auto and manual partition creation.
|
- `parted` for partition creation.
|
||||||
+ `wipe` for the secure wipe option.
|
- `wipe` for the secure wipe.
|
||||||
+ Standard `awk` `sed` `grep` `uniq` `sort` `find` `ping` `mkfs` `lsblk`.
|
- `awk` `sed` `grep` `uniq` `sort` `find` `ping` `mkfs` `lsblk` `curl`.
|
||||||
+ `arch-chroot` used to perform operations in the chroot.
|
- `arch-chroot` to perform operations in a chroot.
|
||||||
+ `chpasswd` to set root and user passwords.
|
- `chpasswd` to set root and user passwords.
|
||||||
+ Network connection is needed to install packages and update the system.
|
- `openssl` to encrypt passwords.
|
||||||
+ `pacman` used to update the system and install/remove packages. *(with network connection)*
|
- Network connection is needed to install packages and update the system.
|
||||||
+ `reflector` for sorting the mirrorlist. *(with network connection)*
|
|
||||||
|
|
||||||
#### Manual Installation
|
#### Manual Installation
|
||||||
- curl
|
- curl
|
||||||
|
@ -16,7 +16,7 @@ _Name="Name:"
|
|||||||
|
|
||||||
# Welcome
|
# Welcome
|
||||||
_WelTitle="Welcome to"
|
_WelTitle="Welcome to"
|
||||||
_WelBody="This will unpack and setup $DIST on your system\n\nMenu Navigation:\n\nSelect items by pressing the option number or using the arrow keys.\n\nSwitch between buttons using [Tab] or the arrow keys.\n\nLong lists can be navigated using [Page Up] and [Page Down], or by pressing the first letter of the desired option.\n\nUse [Space] to (de)select options and [Enter] to confirm.\n"
|
_WelBody="This will unpack and help you setup $DIST on your system\n\nMenu Navigation:\n\n - Select items by pressing the option number or using the arrow keys.\n\n - Use [Space] to (de)select options and [Enter] to confirm.\n\n - Switch between buttons using [Tab] or the arrow keys.\n\n - Long lists can be navigated using [Page Up] and [Page Down], or by pressing the highlighted letter of the desired option.\n"
|
||||||
|
|
||||||
# Requirements
|
# Requirements
|
||||||
_NotRoot="\nThe installer must be run as root or using sudo.\n"
|
_NotRoot="\nThe installer must be run as root or using sudo.\n"
|
||||||
@ -25,7 +25,7 @@ _NoNetwork="\nThe installer should be run with an active network connection.\n"
|
|||||||
|
|
||||||
# Preparation Menu
|
# Preparation Menu
|
||||||
_PrepTitle="Prepare System"
|
_PrepTitle="Prepare System"
|
||||||
_PrepBody="\nFollow the below steps in order.\n\nTo begin install there must be a root partition mounted first, UEFI requires\na seperate boot partition, once mounted configure the system settings before beginning the install."
|
_PrepBody="\nFollow the below steps in order.\n\nBefore beginning the install, a root (/) partition must be mounted (UEFI also requires a boot partition) and the system settings must be configured."
|
||||||
_PrepLayout="Keyboard Layout"
|
_PrepLayout="Keyboard Layout"
|
||||||
_PrepShowDev="Device Tree"
|
_PrepShowDev="Device Tree"
|
||||||
_PrepParts="Edit Partitions"
|
_PrepParts="Edit Partitions"
|
||||||
@ -59,7 +59,7 @@ _TimeSubZBody="\nSelect the nearest city to your location from the list below."
|
|||||||
_TimeZQ="\nSet time zone as:"
|
_TimeZQ="\nSet time zone as:"
|
||||||
|
|
||||||
# bootloader
|
# bootloader
|
||||||
_MntBootBody="\nSelect bootloader and boot partition mountpoint.\n\nGrub is recommended, especially for multiboot."
|
_MntBootBody="\nSelect bootloader and boot partition mountpoint (if any)."
|
||||||
_InstSysTitle="Install Syslinux"
|
_InstSysTitle="Install Syslinux"
|
||||||
_InstSysBody="\nInstall syslinux to the master boot record (MBR) or to root (/)?"
|
_InstSysBody="\nInstall syslinux to the master boot record (MBR) or to root (/)?"
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ _DevSelTitle="Select Device"
|
|||||||
_DevSelBody="\nSelect a device from the list below.\n\nDevices (/dev) are the available drives on the system. /sda, /sdb ..."
|
_DevSelBody="\nSelect a device from the list below.\n\nDevices (/dev) are the available drives on the system. /sda, /sdb ..."
|
||||||
|
|
||||||
# Extra Partitions
|
# Extra Partitions
|
||||||
_ExtPartBody="\nSelect any additional partitions you want to mount, otherwise select '$_Done' to finish the mounting step.\n\nAfter choosing a partition you will be asked to enter the mountpoint."
|
_ExtPartBody="\nYou can now select additional partitions you want mounted, once choosed you will be asked to enter where you want it mounted.\n\nSelect '$_Done' to finish the mounting step and return to the main menu."
|
||||||
_ExtPartBody1="\nWhere do you want the partition mounted?\n\nEnsure the name begins with a forward slash (/).\nSome examples include:"
|
_ExtPartBody1="\nWhere do you want the partition mounted?\n\nEnsure the name begins with a forward slash (/).\nSome examples include:"
|
||||||
|
|
||||||
# Auto partition
|
# Auto partition
|
||||||
@ -133,22 +133,22 @@ _InstSysBody="\nInstall syslinux to the Master Boot Record (MBR) or to root (/)?
|
|||||||
|
|
||||||
# File System
|
# File System
|
||||||
_FSTitle="Choose Filesystem"
|
_FSTitle="Choose Filesystem"
|
||||||
_FSBody="\nRecommended: ext4\n\nNOTE: Some aren't usable for root (/) or boot (/boot) partitions."
|
_FSBody="\nDefault Filesystem: ext4\n\nNOTE: Not all filesystems are usable for root (/) or boot (/boot) partitions."
|
||||||
_SelRootBody="\nSelect root (/) partition.\n\nThis is the partition where $DIST will be installed."
|
_SelRootBody="\nSelect root (/) partition.\n\nThis is the partition where $DIST will be installed."
|
||||||
_SelBiosBody="\nDo you want to use a seperate boot partition? (required for LUKS)\n\nThis partition is where the bootloader will be installed.\n"
|
_SelBiosBody="\nDo you want to use a seperate boot partition? (required for LUKS)\n\nThis partition is where the bootloader will be installed.\n"
|
||||||
|
|
||||||
_SelSwpFile="Swapfile"
|
_SelSwpFile="Swapfile"
|
||||||
_SelSwpSetup="Swap Setup"
|
_SelSwpSetup="Swap Setup"
|
||||||
_SelSwpBody="\nSelect SWAP partition/file, or none. If using a swapfile, it will be initially set the same size as your RAM."
|
_SelSwpBody="\nSelect whether to use a swap partition, swapfile, or none.\n\nWhen selecting swapfile the size will be filled in to the size of your system memory, however this can be changed to suit your needs."
|
||||||
_SelSwpNone="None"
|
_SelSwpNone="None"
|
||||||
|
|
||||||
_SelSwpErr="Swap Setup Error: Must be 1(M|G) or greater, and can only contain whole numbers\n\nSize Entered:"
|
_SelSwpErr="Swap Setup Error: Must be 1(M|G) or greater, and can only contain whole numbers\n\nSize Entered:"
|
||||||
_SelSwpSize="\nEnter the size to use for swap.\n\nMust be greater than 1, end in either M or G, and contain only whole numbers."
|
_SelSwpSize="\nEnter the size to use for swap.\n\nMust be greater than 1, end in either M or G, and contain only whole numbers."
|
||||||
|
|
||||||
_SelUefiBody="\nSelect the system EFI boot partition.\n\nThis is a special partition used for booting newer UEFI systems. Usually the first partition on the drive, less than 512M, and formatted as vfat/fat32."
|
_SelUefiBody="\nSelect the system EFI boot partition.\n\nThis is a special partition used for booting modern UEFI systems. It's usually the first partition on the drive, less than 512M, and formatted as vfat/fat32."
|
||||||
_FormUefiBody="IMPORTANT:\n\nThe EFI partition"
|
_FormUefiBody="IMPORTANT:\n\nThe EFI partition"
|
||||||
_FormBiosBody="IMPORTANT:\n\nThe boot partition"
|
_FormBiosBody="IMPORTANT:\n\nThe boot partition"
|
||||||
_FormUefiBody2="is already correctly formatted.\n\nDo you want to reformat it?\n"
|
_FormUefiBody2="is already correctly formatted.\n\nFor a clean install, previously existing partitions should be formatted, however this removes ALL data/bootloaders on the partition so choose carefully.\n\nDo you want to reformat the partition?\n"
|
||||||
|
|
||||||
# LUKS / DM-Crypt / Encryption
|
# LUKS / DM-Crypt / Encryption
|
||||||
_LuksMenuBody="\nDevices and volumes encrypted using dm_crypt cannot be accessed or seen without being first unlocked."
|
_LuksMenuBody="\nDevices and volumes encrypted using dm_crypt cannot be accessed or seen without being first unlocked."
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
#!/usr/bin/bash
|
#!/usr/bin/bash
|
||||||
|
|
||||||
# vim:ft=sh:fdm=marker:fmr={,}
|
# vim:fdm=marker:fmr={,}
|
||||||
|
|
||||||
# This program is free software, provided under the GNU GPL
|
# This program is free software, provided under the GNU GPL
|
||||||
# Written by Nathaniel Maia for use in Archlabs
|
# Written by Nathaniel Maia for use in Archlabs
|
||||||
# Some ideas and code were taken from other installers
|
# Some ideas and code has been taken from other installers
|
||||||
# AIF, Cnichi, Calamares, The Arch Wiki.. Credit where credit is due
|
# AIF, Cnichi, Calamares, The Arch Wiki.. Credit where credit is due
|
||||||
|
|
||||||
# set -n
|
# set -n
|
||||||
|
|
||||||
# immutable variables {
|
# immutable {
|
||||||
|
|
||||||
readonly DIST="ArchLabs" # Linux distributor
|
readonly DIST="ArchLabs" # Linux distributor
|
||||||
readonly VER="1.6.88" # Installer version
|
readonly VER="1.6.94" # Installer version
|
||||||
readonly LIVE="liveuser" # Live session user
|
readonly LIVE="liveuser" # Live session user
|
||||||
readonly MNT="/mnt/install" # Install mountpoint
|
readonly MNT="/mnt/install" # Install mountpoint
|
||||||
readonly ERR="/tmp/errlog" # Built-in error log
|
readonly ERR="/tmp/errlog" # Built-in error log
|
||||||
@ -26,14 +26,6 @@ readonly SYS_MEM=$(grep 'MemTotal' /proc/meminfo | awk '{print int($2 / 1024)"M"
|
|||||||
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 CONSOLE_MAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' | awk '{gsub(/\.map\.gz|.*\//, ""); print $1 " -"}')"
|
readonly CONSOLE_MAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' | awk '{gsub(/\.map\.gz|.*\//, ""); print $1 " -"}')"
|
||||||
|
|
||||||
readonly IGNORE_DEV="$(lsblk -lno NAME,MOUNTPOINT | awk '/\/run\/archiso\/bootmnt/ {sub(/[1-9]/, ""); print $1}')"
|
|
||||||
if [[ $IGNORE_DEV ]]; then
|
|
||||||
readonly SYS_DEVS="$(lsblk -lno NAME,SIZE,TYPE | awk '/disk/ && !'"/$IGNORE_DEV/"' {print "/dev/" $1 " " $2}')"
|
|
||||||
else
|
|
||||||
readonly SYS_DEVS="$(lsblk -lno NAME,SIZE,TYPE | awk '/disk/ {print "/dev/" $1 " " $2}')"
|
|
||||||
fi
|
|
||||||
readonly DEV_COUNT="$(wc -l <<< "$SYS_DEVS")"
|
|
||||||
|
|
||||||
if grep -q 'GenuineIntel' /proc/cpuinfo; then
|
if grep -q 'GenuineIntel' /proc/cpuinfo; then
|
||||||
readonly UCODE="intel-ucode.img"
|
readonly UCODE="intel-ucode.img"
|
||||||
elif grep -q 'AuthenticAMD' /proc/cpuinfo; then
|
elif grep -q 'AuthenticAMD' /proc/cpuinfo; then
|
||||||
@ -54,25 +46,26 @@ if [[ $DISPLAY && $TERM != 'linux' ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# static string of keymap codes and respective language
|
# static string of keymap codes and respective language
|
||||||
readonly KEYMAPS="us English cm English gb English au English gh English za English
|
readonly KEYMAPS="us English cm English gb English au English gh English za English ng English
|
||||||
ng English ca French cd French gn French tg French fr French de German at German ch German
|
ca French cd French gn French tg French fr French de German at German ch German es Spanish
|
||||||
es Spanish latam Spanish br Portuguese pt Portuguese ma Arabic sy Arabic ara Arabic
|
latam Spanish br Portuguese pt Portuguese ma Arabic sy Arabic ara Arabic ua Ukrainian cz Czech
|
||||||
ua Ukrainian cz Czech ru Russian sk Slovak nl Dutch it Italian hu Hungarian cn Chinese
|
ru Russian sk Slovak nl Dutch it Italian hu Hungarian cn Chinese tw Taiwanese vn Vietnamese
|
||||||
tw Taiwanese vn Vietnamese kr Korean jp Japanese th Thai la Lao pl Polish se Swedish
|
kr Korean jp Japanese th Thai la Lao pl Polish se Swedish is Icelandic fi Finnish dk Danish
|
||||||
is Icelandic fi Finnish dk Danish be Belgian in Indian al Albanian am Armenian bd Bangla
|
be Belgian in Indian al Albanian am Armenian bd Bangla ba Bosnian bg Bulgarian dz Berber
|
||||||
ba Bosnian bg Bulgarian dz Berber mm Burmese hr Croatian gr Greek il Hebrew ir Persian iq Iraqi
|
mm Burmese hr Croatian gr Greek il Hebrew ir Persian iq Iraqi af Afghani fo Faroese ge Georgian
|
||||||
af Afghani fo Faroese ge Georgian ee Estonian kg Kyrgyz kz Kazakh lt Lithuanian mt Maltese
|
ee Estonian kg Kyrgyz kz Kazakh lt Lithuanian mt Maltese mn Mongolian no Norwegian ro Romanian
|
||||||
mn Mongolian no Norwegian ro Romanian rs Serbian si Slovenian tj Tajik lk Sinhala tr Turkish
|
rs Serbian si Slovenian tj Tajik lk Sinhala tr Turkish uz Uzbek ie Irish pk Urdu mv Dhivehi
|
||||||
uz Uzbek ie Irish pk Urdu mv Dhivehi epo Esperanto np Nepali et Amharic sn Wolof ml Bambara
|
epo Esperanto np Nepali et Amharic sn Wolof ml Bambara tz Swahili ke Swahili bw Tswana
|
||||||
tz Swahili ke Swahili bw Tswana ph Filipino id Indonesian my Malay tm Turkmen bt Dzongkha
|
ph Filipino id Indonesian my Malay tm Turkmen bt Dzongkha lv Latvian md Moldavian mao Maori
|
||||||
lv Latvian md Moldavian mao Maori by Belarusian me Montenegrin mk Macedonian kh Khmer az Azerbaijani"
|
by Belarusian me Montenegrin mk Macedonian kh Khmer az Azerbaijani"
|
||||||
|
|
||||||
declare -Agr BMNTS=(
|
declare -Agr BMNTS=(
|
||||||
[UEFI-grub]="/boot/efi" [UEFI-systemd-boot]="/boot" [BIOS-grub]="/boot"
|
[UEFI-grub]="/boot/efi" [UEFI-systemd-boot]="/boot" [BIOS-grub]="/boot"
|
||||||
[BIOS-syslinux]="/boot" [UEFI-syslinux]="/boot"
|
[BIOS-syslinux]="/boot" [UEFI-syslinux]="/boot"
|
||||||
)
|
)
|
||||||
|
|
||||||
declare -Agr BOOTLDRS=([BIOS]="grub ${BMNTS[BIOS-grub]} syslinux ${BMNTS[BIOS-syslinux]}"
|
declare -Agr BOOTLDRS=(
|
||||||
|
[BIOS]="grub ${BMNTS[BIOS-grub]} syslinux ${BMNTS[BIOS-syslinux]}"
|
||||||
[UEFI]="grub ${BMNTS[UEFI-grub]} systemd-boot ${BMNTS[UEFI-systemd-boot]} syslinux ${BMNTS[UEFI-syslinux]}"
|
[UEFI]="grub ${BMNTS[UEFI-grub]} systemd-boot ${BMNTS[UEFI-systemd-boot]} syslinux ${BMNTS[UEFI-syslinux]}"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -93,7 +86,7 @@ declare -Agr FS_OPTS=([vfat]="" [ntfs]="" [ext2]="" [ext3]=""
|
|||||||
|
|
||||||
# }
|
# }
|
||||||
|
|
||||||
init_variables() {
|
init() {
|
||||||
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=""
|
||||||
declare -g BOOT_DEVICE=""
|
declare -g BOOT_DEVICE=""
|
||||||
@ -136,14 +129,22 @@ init_variables() {
|
|||||||
[8]="/etc/crypttab"
|
[8]="/etc/crypttab"
|
||||||
[9]="/etc/default/grub"
|
[9]="/etc/default/grub"
|
||||||
[10]="/etc/pacman.conf"
|
[10]="/etc/pacman.conf"
|
||||||
|
[11]=""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
source_file() {
|
devices() {
|
||||||
. "$1" || { printf "\nFailed to source library file %s" "$1"; die 1; }
|
IGNORE_DEV="$(lsblk -lno NAME,MOUNTPOINT | awk '/\/run\/archiso\/bootmnt/ {sub(/[1-9]/, ""); print $1}')"
|
||||||
|
if [[ $IGNORE_DEV ]]; then
|
||||||
|
SYS_DEVS="$(lsblk -lno NAME,SIZE,TYPE | awk '/disk/ && !'"/$IGNORE_DEV/"' {print "/dev/" $1 " " $2}')"
|
||||||
|
else
|
||||||
|
SYS_DEVS="$(lsblk -lno NAME,SIZE,TYPE | awk '/disk/ {print "/dev/" $1 " " $2}')"
|
||||||
|
fi
|
||||||
|
DEV_COUNT="$(wc -l <<< "$SYS_DEVS")"
|
||||||
|
declare -gr SYS_DEVS IGNORE_DEV DEV_COUNT
|
||||||
}
|
}
|
||||||
|
|
||||||
user_creation() {
|
user() {
|
||||||
tput cnorm
|
tput cnorm
|
||||||
local values
|
local values
|
||||||
values="$(dialog --stdout --no-cancel --separator '~' --ok-label "Submit" --backtitle "$BT" \
|
values="$(dialog --stdout --no-cancel --separator '~' --ok-label "Submit" --backtitle "$BT" \
|
||||||
@ -176,16 +177,16 @@ user_creation() {
|
|||||||
rpass2="$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$values" |
|
rpass2="$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$values" |
|
||||||
awk -F'~' '{print $6}' | openssl enc -pbkdf2 -a -salt -pass pass:$SALT)"
|
awk -F'~' '{print $6}' | openssl enc -pbkdf2 -a -salt -pass pass:$SALT)"
|
||||||
|
|
||||||
# due to the encryption the string while encrypted will not be empty
|
# due to encrypting the string, when empty, once encrypted it wont be empty
|
||||||
local empty
|
local empty
|
||||||
empty="$(openssl enc -pbkdf2 -a -salt -pass pass:$SALT <<< "")"
|
empty="$(openssl enc -pbkdf2 -a -salt -pass pass:$SALT <<< "")"
|
||||||
|
|
||||||
# both root passwords are empty, so use the user passwords instead
|
# both root passwords are empty, so use the user passwords instead
|
||||||
[[ $rpass == "" && $rpass2 == "" ]] && { rpass="$pass"; rpass2="$pass2"; }
|
[[ $rpass == "$empty" && $rpass2 == "$empty" ]] && { 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 == "$empty" || "$pass" != "$pass2" || "$rpass" != "$rpass2" ]]; then
|
if [[ ${#user} -eq 0 || $user =~ \ |\' || $user =~ [^a-z0-9] || $pass == "$empty" || "$pass" != "$pass2" || "$rpass" != "$rpass2" ]]; then
|
||||||
if [[ $pass == "" || "$pass" != "$pass2" || "$rpass" != "$rpass2" ]]; then
|
if [[ $pass == "$empty" || "$pass" != "$pass2" || "$rpass" != "$rpass2" ]]; then
|
||||||
# password was left empty or doesn't match
|
# password was left empty or doesn't match
|
||||||
if [[ $pass == "$empty" ]]; then
|
if [[ $pass == "$empty" ]]; then
|
||||||
msgbox "$_ErrTitle" "\nUser password CANNOT be left empty.\n$_TryAgain"
|
msgbox "$_ErrTitle" "\nUser password CANNOT be left empty.\n$_TryAgain"
|
||||||
@ -199,7 +200,7 @@ user_creation() {
|
|||||||
user=""
|
user=""
|
||||||
fi
|
fi
|
||||||
# recursively loop back unless the user cancels
|
# recursively loop back unless the user cancels
|
||||||
user_creation || return 1
|
user || return 1
|
||||||
else
|
else
|
||||||
NEWUSER="$user"
|
NEWUSER="$user"
|
||||||
USER_PASS="$pass"
|
USER_PASS="$pass"
|
||||||
@ -208,7 +209,7 @@ user_creation() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
select_language() {
|
language() {
|
||||||
tput civis
|
tput civis
|
||||||
local lang
|
local lang
|
||||||
lang=$(dialog --cr-wrap --stdout --backtitle "$BT" --title " Select Language " --menu \
|
lang=$(dialog --cr-wrap --stdout --backtitle "$BT" --title " Select Language " --menu \
|
||||||
@ -219,20 +220,20 @@ select_language() {
|
|||||||
"7" "Italiano (it_IT)" "8" "Nederlands (nl_NL)" \
|
"7" "Italiano (it_IT)" "8" "Nederlands (nl_NL)" \
|
||||||
"9" "Magyar (hu_HU)" "10" "Chinese (zh_CN)")
|
"9" "Magyar (hu_HU)" "10" "Chinese (zh_CN)")
|
||||||
|
|
||||||
source_file $TRN/english.trans
|
src $TRN/english.trans
|
||||||
FONT="ter-i16n"
|
FONT="ter-i16n"
|
||||||
|
|
||||||
case $lang in
|
case $lang in
|
||||||
1) LOC="en_US.UTF-8" ;;
|
1) LOC="en_US.UTF-8" ;;
|
||||||
2) source_file $TRN/spanish.trans && LOC="es_ES.UTF-8" ;;
|
2) src $TRN/spanish.trans && LOC="es_ES.UTF-8" ;;
|
||||||
3) source_file $TRN/p_brasil.trans && LOC="pt_BR.UTF-8" ;;
|
3) src $TRN/p_brasil.trans && LOC="pt_BR.UTF-8" ;;
|
||||||
4) source_file $TRN/portuguese.trans && LOC="pt_PT.UTF-8" ;;
|
4) src $TRN/portuguese.trans && LOC="pt_PT.UTF-8" ;;
|
||||||
5) source_file $TRN/french.trans && LOC="fr_FR.UTF-8" ;;
|
5) src $TRN/french.trans && LOC="fr_FR.UTF-8" ;;
|
||||||
6) source_file $TRN/russian.trans && LOC="ru_RU.UTF-8" FONT="LatKaCyrHeb-16" ;;
|
6) src $TRN/russian.trans && LOC="ru_RU.UTF-8" FONT="LatKaCyrHeb-16" ;;
|
||||||
7) source_file $TRN/italian.trans && LOC="it_IT.UTF-8" ;;
|
7) src $TRN/italian.trans && LOC="it_IT.UTF-8" ;;
|
||||||
8) source_file $TRN/dutch.trans && LOC="nl_NL.UTF-8" ;;
|
8) src $TRN/dutch.trans && LOC="nl_NL.UTF-8" ;;
|
||||||
9) source_file $TRN/hungarian.trans && LOC="hu_HU.UTF-8" FONT="lat2-16" ;;
|
9) src $TRN/hungarian.trans && LOC="hu_HU.UTF-8" FONT="lat2-16" ;;
|
||||||
10) source_file $TRN/chinese.trans && LOC="zh_CN.UTF-8" ;;
|
10) src $TRN/chinese.trans && LOC="zh_CN.UTF-8" ;;
|
||||||
*) die 0
|
*) die 0
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@ -247,7 +248,7 @@ select_language() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_keymap() {
|
keymap() {
|
||||||
tput civis
|
tput civis
|
||||||
KEYMAP="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
KEYMAP="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||||
--title " $_PrepLayout " --menu "$_XMapBody" 20 70 12 $KEYMAPS)"
|
--title " $_PrepLayout " --menu "$_XMapBody" 20 70 12 $KEYMAPS)"
|
||||||
@ -270,7 +271,7 @@ setup_keymap() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_timezone() {
|
timezone() {
|
||||||
tput civis
|
tput civis
|
||||||
ZONE="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
ZONE="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||||
--title " $_TimeZTitle " --menu "$_TimeZBody" 20 70 10 America - Australia - \
|
--title " $_TimeZTitle " --menu "$_TimeZBody" 20 70 10 America - Australia - \
|
||||||
@ -281,10 +282,10 @@ setup_timezone() {
|
|||||||
--title " $_TimeZTitle " --menu "$_TimeSubZBody" 20 70 12 ${SUBZONES[$ZONE]})"
|
--title " $_TimeZTitle " --menu "$_TimeSubZBody" 20 70 12 ${SUBZONES[$ZONE]})"
|
||||||
[[ $? != 0 || $SUBZONE == "" ]] && return 1
|
[[ $? != 0 || $SUBZONE == "" ]] && return 1
|
||||||
|
|
||||||
yesno "$_TimeZTitle" "$_TimeZQ $ZONE/$SUBZONE?\n" && return 0 || setup_timezone
|
yesno "$_TimeZTitle" "$_TimeZQ $ZONE/$SUBZONE?\n" && return 0 || timezone
|
||||||
}
|
}
|
||||||
|
|
||||||
window_manager() {
|
sessions() {
|
||||||
INSTALL_WMS="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
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 \
|
||||||
@ -296,23 +297,24 @@ window_manager() {
|
|||||||
"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)"
|
||||||
[[ $? != 0 || $INSTALL_WMS == "" ]] && return 1
|
[[ $? != 0 || $INSTALL_WMS == "" ]] && return 1
|
||||||
WM_NUM=$(awk '{print NF}' <<< "$INSTALL_WMS")
|
WM_NUM=$(awk '{print NF}' <<< "$INSTALL_WMS")
|
||||||
|
WM_PACKAGES="$INSTALL_WMS"
|
||||||
|
|
||||||
# packages needed for the selected window manager
|
# packages needed for the selected WM/DE
|
||||||
for wm in $INSTALL_WMS; do
|
for wm in $INSTALL_WMS; do
|
||||||
LOGIN_CHOICES="${LOGIN_CHOICES}$wm - "
|
LOGIN_CHOICES="${LOGIN_CHOICES}$wm - "
|
||||||
case $wm in
|
case $wm in
|
||||||
cinnamon) WM_PACKAGES+=" $wm" ;;
|
cinnamon) : ;; # none
|
||||||
bspwm) WM_PACKAGES+=" $wm sxhkd" ;;
|
bspwm) WM_PACKAGES+=" sxhkd" ;;
|
||||||
gnome) WM_PACKAGES+=" $wm gnome-extra" ;;
|
gnome) WM_PACKAGES+=" gnome-extra" ;;
|
||||||
i3-gaps) WM_PACKAGES+=" $wm i3status perl-anyevent-i3" ;;
|
i3-gaps) WM_PACKAGES+=" i3status perl-anyevent-i3" ;;
|
||||||
xfce4) WM_PACKAGES+=" $wm xfce4-goodies xfce4-pulseaudio-plugin" ;;
|
xfce4) WM_PACKAGES+=" xfce4-goodies xfce4-pulseaudio-plugin" ;;
|
||||||
openbox) WM_PACKAGES+=" $wm obconf archlabs-obkey archlabs-kickshaw archlabs-skippy-xd tint2 conky jgmenu" ;;
|
openbox) WM_PACKAGES+=" obconf archlabs-obkey archlabs-kickshaw archlabs-skippy-xd tint2 conky jgmenu" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps) ]]; then
|
if [[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps) ]]; then
|
||||||
WM_PACKAGES+=" archlabs-polybar jsoncpp libmpdclient archlabs-screenlock archlabs-oblogout"
|
WM_PACKAGES+=" archlabs-polybar archlabs-paranoid archlabs-screenlock archlabs-oblogout"
|
||||||
WM_PACKAGES+=" archlabs-paranoid lxappearance rofi termite thunar"
|
WM_PACKAGES+=" rofi termite thunar lxappearance libmpdclient jsoncpp"
|
||||||
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
|
||||||
@ -333,7 +335,7 @@ window_manager() {
|
|||||||
else
|
else
|
||||||
LOGIN_TYPE='lightdm'
|
LOGIN_TYPE='lightdm'
|
||||||
WM_PACKAGES+=" lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice"
|
WM_PACKAGES+=" lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice"
|
||||||
FILES[11]="/etc/lightdm/lightdm.conf $MNT/etc/lightdm/lightdm-gtk-greeter.conf"
|
FILES[11]="/etc/lightdm/lightdm.conf /etc/lightdm/lightdm-gtk-greeter.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
EXTRA_PACKAGES="$WM_PACKAGES"
|
EXTRA_PACKAGES="$WM_PACKAGES"
|
||||||
@ -351,7 +353,7 @@ window_manager() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
extra_packages() {
|
packages() {
|
||||||
local pkgs
|
local pkgs
|
||||||
pkgs="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
pkgs="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||||
--title " $_ExtraPackages " --checklist "$_ExtraPackagesBody\n" 0 0 30 \
|
--title " $_ExtraPackages " --checklist "$_ExtraPackagesBody\n" 0 0 30 \
|
||||||
@ -436,30 +438,26 @@ 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"
|
||||||
if [[ $INSTALL_WMS =~ dwm ]] && ! [[ $pkgs =~ ttf-hack ]]; then
|
([[ $INSTALL_WMS =~ dwm ]] && ! [[ $pkgs =~ ttf-hack ]]) && pkgs+=" ttf-hack"
|
||||||
pkgs+=" ttf-hack"
|
([[ $pkgs =~ (qutebrowser|qbittorrent|kdenlive|vlc) ]] && ! [[ $pkgs =~ qt5ct ]]) && pkgs+=" qt5ct qt5-styleplugins"
|
||||||
fi
|
|
||||||
if [[ $pkgs =~ (qutebrowser|qbittorrent|kdenlive|vlc) ]] && ! [[ $pkgs =~ qt5ct ]]; then
|
|
||||||
pkgs+=" qt5ct qt5-styleplugins"
|
|
||||||
fi
|
|
||||||
|
|
||||||
EXTRA_PACKAGES="$EXTRA_PACKAGES$([[ $pkgs ]] && printf " %s" "$pkgs")"
|
EXTRA_PACKAGES+="$pkgs"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
mirrorlist_cmd() {
|
mirrors() {
|
||||||
local key="5f29642060ab983b31fdf4c2935d8c56"
|
local key="5f29642060ab983b31fdf4c2935d8c56"
|
||||||
local ip="$(curl -s "http://api.ipstack.com/check&fields=ip&?access_key=${key}" |
|
local ip="$(curl -s "http://api.ipstack.com/check&fields=ip&?access_key=${key}" |
|
||||||
val_from_json 'ip')"
|
json 'ip')"
|
||||||
|
|
||||||
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"
|
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 c="$(curl -s "http://api.ipstack.com/${ip}?access_key=${key}&fields=country_name" |
|
local c="$(curl -s "http://api.ipstack.com/${ip}?access_key=${key}&fields=country_name" |
|
||||||
val_from_json 'country_name')"
|
json 'country_name')"
|
||||||
if [[ $c != "" ]]; then
|
if [[ $c != "" ]]; then
|
||||||
MIRROR_CMD="reflector --country $c --score 80 --latest 40 --fastest 10 --sort rate"
|
MIRROR_CMD="reflector --country $c --score 80 --latest 40 --fastest 10 --sort rate --verbose"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tput cnorm
|
tput cnorm
|
||||||
@ -477,7 +475,7 @@ mirrorlist_cmd() {
|
|||||||
'delay': MirrorStatus delay.\n" 0 0 "$MIRROR_CMD")"
|
'delay': MirrorStatus delay.\n" 0 0 "$MIRROR_CMD")"
|
||||||
else
|
else
|
||||||
local c="$(curl -s "http://api.ipstack.com/${ip}?access_key=${key}&fields=country_code" |
|
local c="$(curl -s "http://api.ipstack.com/${ip}?access_key=${key}&fields=country_code" |
|
||||||
val_from_json 'country_code')"
|
json 'country_code')"
|
||||||
|
|
||||||
local w="https://www.archlinux.org/mirrorlist"
|
local w="https://www.archlinux.org/mirrorlist"
|
||||||
if [[ $c != "" ]]; then
|
if [[ $c != "" ]]; then
|
||||||
@ -493,37 +491,37 @@ mirrorlist_cmd() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
display_selection() {
|
display() {
|
||||||
msgbox "$_PrepTitle" "\nConfiguration values used for install\n\n
|
msgbox "$_PrepTitle" "\nConfiguration values used for install\n\n
|
||||||
Root: $ROOT_PART
|
Root: $ROOT_PART
|
||||||
Boot: $BOOT_PART
|
Boot: $BOOT_PART
|
||||||
Swap: $SWAP
|
Swap: $SWAP
|
||||||
Extra: ${EXTRA_MNTS:-None}
|
Extra: ${EXTRA_MNTS:-None}
|
||||||
|
|
||||||
LVM: $LVM
|
LVM: $LVM
|
||||||
LUKS: $LUKS
|
LUKS: $LUKS
|
||||||
|
|
||||||
Bootloader: $BOOTLDR
|
Bootloader: $BOOTLDR
|
||||||
Boot Mount: ${BMNTS[$SYS-$BOOTLDR]}
|
Boot Mount: ${BMNTS[$SYS-$BOOTLDR]}
|
||||||
Boot Command: ${BCMDS[$BOOTLDR]}
|
Boot Command: ${BCMDS[$BOOTLDR]}
|
||||||
|
|
||||||
New User: $NEWUSER
|
User: $NEWUSER
|
||||||
Login: $LOGIN_WM
|
Hostname: $HOSTNAME
|
||||||
Autologin: $AUTOLOGIN
|
Locale: $LOCALE
|
||||||
Login Type: $LOGIN_TYPE
|
Keymap: $KEYMAP
|
||||||
|
Timezone: $ZONE/$SUBZONE
|
||||||
|
|
||||||
Hostname: $HOSTNAME
|
Autologin: $AUTOLOGIN
|
||||||
Locale: $LOCALE
|
Login: $LOGIN_WM
|
||||||
Keymap: $KEYMAP
|
Login Type: $LOGIN_TYPE
|
||||||
Timezone: $ZONE/$SUBZONE
|
|
||||||
|
|
||||||
Kernel: $KERNEL
|
Sessions: $INSTALL_WMS
|
||||||
Sessions: $INSTALL_WMS
|
Kernel: $KERNEL
|
||||||
Mirrors: $MIRROR_CMD
|
Mirrors: $MIRROR_CMD
|
||||||
Packages: $EXTRA_PACKAGES\n"
|
Packages: $EXTRA_PACKAGES\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_install() {
|
configure() {
|
||||||
tput cnorm
|
tput cnorm
|
||||||
HOSTNAME="$(getinput "$_ConfHost" "$_HostNameBody" "${DIST,,}")"
|
HOSTNAME="$(getinput "$_ConfHost" "$_HostNameBody" "${DIST,,}")"
|
||||||
[[ $? != 0 || $HOSTNAME == "" ]] && return 1
|
[[ $? != 0 || $HOSTNAME == "" ]] && return 1
|
||||||
@ -533,22 +531,22 @@ configure_install() {
|
|||||||
--title " $_ConfLocale " --menu "$_LocaleBody" 25 70 20 $LOCALES)"
|
--title " $_ConfLocale " --menu "$_LocaleBody" 25 70 20 $LOCALES)"
|
||||||
[[ $? != 0 || $LOCALE == "" ]] && return 1
|
[[ $? != 0 || $LOCALE == "" ]] && return 1
|
||||||
|
|
||||||
setup_timezone || return 1
|
timezone || return 1
|
||||||
mirrorlist_cmd || return 1
|
mirrors || return 1
|
||||||
user_creation || return 1
|
user || return 1
|
||||||
window_manager || return 1
|
sessions || return 1
|
||||||
yesno 'Choose Kernel' "\nUse the current kernel or the LTS kernel?\n" 'Current' 'LTS' &&
|
yesno 'Choose Kernel' "\nUse the current kernel or the LTS kernel?\n" 'Current' 'LTS' &&
|
||||||
KERNEL='linux' || KERNEL='linux-lts'
|
KERNEL='linux' || KERNEL='linux-lts'
|
||||||
extra_packages || return 1
|
packages || return 1
|
||||||
CONFIG_DONE=true
|
CONFIG_DONE=true
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
edit_configs() {
|
configs() {
|
||||||
if [[ $CURRENT_MENU != "edit" ]]; then
|
if [[ $CURRENT_MENU != "edit" ]]; then
|
||||||
SELECTED=1
|
SELECTED=1
|
||||||
CURRENT_MENU="edit"
|
CURRENT_MENU="edit"
|
||||||
elif (( SELECTED < 10 )); then
|
elif (( SELECTED < 11 )); then
|
||||||
(( SELECTED++ ))
|
(( SELECTED++ ))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -557,7 +555,7 @@ edit_configs() {
|
|||||||
--title " $_EditTitle " --default-item $SELECTED --menu "$_EditBody" 0 0 0 \
|
--title " $_EditTitle " --default-item $SELECTED --menu "$_EditBody" 0 0 0 \
|
||||||
"1" "Exit & Reboot" "2" "Keyboard" "3" "Locale" "4" "Hostname" "5" "Sudoers" \
|
"1" "Exit & Reboot" "2" "Keyboard" "3" "Locale" "4" "Hostname" "5" "Sudoers" \
|
||||||
"6" "Mkinitcpio.conf" "7" "Fstab" "8" "Crypttab" "9" "${BOOTLDR^}" "10" "Pacman.conf" \
|
"6" "Mkinitcpio.conf" "7" "Fstab" "8" "Crypttab" "9" "${BOOTLDR^}" "10" "Pacman.conf" \
|
||||||
"11" "$LOGIN_TYPE")
|
"11" "${LOGIN_TYPE^}")
|
||||||
|
|
||||||
if [[ ! $SELECTED || $SELECTED -eq 1 ]]; then
|
if [[ ! $SELECTED || $SELECTED -eq 1 ]]; then
|
||||||
wrap_up "$_InstFinBody" 'Reboot' 'Back' 'reboot'
|
wrap_up "$_InstFinBody" 'Reboot' 'Back' 'reboot'
|
||||||
@ -568,14 +566,14 @@ edit_configs() {
|
|||||||
done
|
done
|
||||||
[[ ! $existing_files ]] && msgbox "$_ErrTitle" "$_NoFileErr" || vim -O $existing_files
|
[[ ! $existing_files ]] && msgbox "$_ErrTitle" "$_NoFileErr" || vim -O $existing_files
|
||||||
fi
|
fi
|
||||||
edit_configs
|
configs
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
if [[ $CURRENT_MENU != "main" ]]; then
|
if [[ $CURRENT_MENU != "main" ]]; then
|
||||||
SELECTED=1
|
SELECTED=1
|
||||||
CURRENT_MENU="main"
|
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
|
||||||
|
|
||||||
@ -590,7 +588,7 @@ main() {
|
|||||||
# and that the needed config variables and user variables have been set up
|
# and that the needed config variables and user variables have been set up
|
||||||
if [[ $SELECTED ]]; then
|
if [[ $SELECTED ]]; then
|
||||||
if [[ $SELECTED -eq 8 ]]; then
|
if [[ $SELECTED -eq 8 ]]; then
|
||||||
check_install_ready || return 1
|
icheck || return 1
|
||||||
elif [[ ($SELECTED -eq 2 || $SELECTED -eq 5) && $WARN != true ]]; then
|
elif [[ ($SELECTED -eq 2 || $SELECTED -eq 5) && $WARN != true ]]; then
|
||||||
msgbox "$_PrepTitle" "$_WarnMount"
|
msgbox "$_PrepTitle" "$_WarnMount"
|
||||||
WARN=true
|
WARN=true
|
||||||
@ -598,23 +596,27 @@ main() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
case $SELECTED in
|
case $SELECTED in
|
||||||
1) show_devices ;;
|
1) device_tree ;;
|
||||||
2) edit_partitions ;;
|
2) partition || SELECTED=1 ;;
|
||||||
3) luks_menu || SELECTED=1 ;;
|
3) luks_menu || SELECTED=2 ;;
|
||||||
4) lvm_menu || SELECTED=1 ;;
|
4) lvm_menu || SELECTED=3 ;;
|
||||||
5) mount_main || SELECTED=1 ;;
|
5) mountp || SELECTED=4 ;;
|
||||||
6) configure_install ;;
|
6) configure || SELECTED=5 ;;
|
||||||
7) display_selection ;;
|
7) display ;;
|
||||||
8) install_main && edit_configs ;;
|
8) install || SELECTED=7 ;;
|
||||||
*) wrap_up "$_CloseInstBody" 'Exit' 'Back' 'exit'
|
*) wrap_up "$_CloseInstBody" 'Exit' 'Back' 'exit'
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# must be done first
|
# must be done first
|
||||||
init_variables
|
init
|
||||||
|
|
||||||
for file in /usr/share/archlabs/installer/lib/?*.sh; do
|
# declares system device list
|
||||||
source_file "$file"
|
devices
|
||||||
|
|
||||||
|
# source all the lib files
|
||||||
|
for i in /usr/share/archlabs/installer/lib/?*.sh; do
|
||||||
|
. "$i" || { printf "\nFailed to source library file %s\n" "$i"; die 1; }
|
||||||
done
|
done
|
||||||
|
|
||||||
# trap Ctrl-C to properly exit
|
# trap Ctrl-C to properly exit
|
||||||
@ -624,10 +626,13 @@ for arg in $@; do case $arg in
|
|||||||
--debug|-d) debug ;;
|
--debug|-d) debug ;;
|
||||||
esac done
|
esac done
|
||||||
|
|
||||||
select_language
|
# initial choices/prep
|
||||||
setup_keymap
|
language
|
||||||
check_requirements
|
keymap
|
||||||
identify_system
|
checks
|
||||||
|
sysid
|
||||||
|
|
||||||
|
# welcome message
|
||||||
msgbox "$_WelTitle $DIST Installer" "$_WelBody"
|
msgbox "$_WelTitle $DIST Installer" "$_WelBody"
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
|
@ -55,13 +55,13 @@ prep_for_systemd-boot() {
|
|||||||
[[ $ROOT_PART =~ /dev/mapper ]] || ROOT_PART_ID="PART$ROOT_PART_ID"
|
[[ $ROOT_PART =~ /dev/mapper ]] || ROOT_PART_ID="PART$ROOT_PART_ID"
|
||||||
|
|
||||||
# create the boot entry configs
|
# create the boot entry configs
|
||||||
mkdir -p ${MNT}${BOOT_MNTS[$SYS-$BOOTLDR]}/loader/entries
|
mkdir -p ${MNT}${BMNTS[$SYS-$BOOTLDR]}/loader/entries
|
||||||
cat > ${MNT}${BOOT_MNTS[$SYS-$BOOTLDR]}/loader/loader.conf << EOF
|
cat > ${MNT}${BMNTS[$SYS-$BOOTLDR]}/loader/loader.conf << EOF
|
||||||
default $DIST
|
default $DIST
|
||||||
timeout 5
|
timeout 5
|
||||||
editor no
|
editor no
|
||||||
EOF
|
EOF
|
||||||
cat > ${MNT}${BOOT_MNTS[$SYS-$BOOTLDR]}/loader/entries/${DIST}.conf << EOF
|
cat > ${MNT}${BMNTS[$SYS-$BOOTLDR]}/loader/entries/${DIST}.conf << EOF
|
||||||
title $DIST Linux
|
title $DIST Linux
|
||||||
linux /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd %s" "/$UCODE")
|
linux /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd %s" "/$UCODE")
|
||||||
initrd /initramfs-$KERNEL.img
|
initrd /initramfs-$KERNEL.img
|
||||||
@ -87,11 +87,11 @@ EOF
|
|||||||
|
|
||||||
prep_for_syslinux() {
|
prep_for_syslinux() {
|
||||||
if [[ $SYS == 'UEFI' ]]; then
|
if [[ $SYS == 'UEFI' ]]; then
|
||||||
local cfgdir="${MNT}${BOOT_MNTS[$SYS-$BOOTLDR]}/EFI/syslinux"
|
local cfgdir="${MNT}${BMNTS[$SYS-$BOOTLDR]}/EFI/syslinux"
|
||||||
local cfgsrcdir="/usr/lib/syslinux/efi32/"
|
local cfgsrcdir="/usr/lib/syslinux/efi32/"
|
||||||
[[ $IS_64BIT == true ]] && cfgsrcdir="/usr/lib/syslinux/efi64/"
|
[[ $IS_64BIT == true ]] && cfgsrcdir="/usr/lib/syslinux/efi64/"
|
||||||
else
|
else
|
||||||
local cfgdir="$MNT${BOOT_MNTS[$SYS-$BOOTLDR]}/syslinux"
|
local cfgdir="$MNT${BMNTS[$SYS-$BOOTLDR]}/syslinux"
|
||||||
local cfgsrcdir="/usr/lib/syslinux/bios/"
|
local cfgsrcdir="/usr/lib/syslinux/bios/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -138,8 +138,8 @@ install_bootloader() {
|
|||||||
prep_for_$BOOTLDR
|
prep_for_$BOOTLDR
|
||||||
|
|
||||||
# install/setup the bootloader by running the BCMD (boot command)
|
# install/setup the bootloader by running the BCMD (boot command)
|
||||||
chroot_cmd "${BCMDS[$BOOTLDR]}" 2>$ERR
|
chrun "${BCMDS[$BOOTLDR]}" # 2>$ERR
|
||||||
check_for_errors "${BCMDS[$BOOTLDR]}"
|
echeck "${BCMDS[$BOOTLDR]}"
|
||||||
|
|
||||||
# copy efi stub to generic catch all
|
# copy efi stub to generic catch all
|
||||||
[[ $SYS == 'UEFI' && $BOOTLDR =~ (grub|syslinux) ]] && uefi_boot_fallback
|
[[ $SYS == 'UEFI' && $BOOTLDR =~ (grub|syslinux) ]] && uefi_boot_fallback
|
||||||
|
@ -8,29 +8,21 @@
|
|||||||
|
|
||||||
# set -n
|
# set -n
|
||||||
|
|
||||||
install_main() {
|
install() {
|
||||||
# function calls prefixed with 'oneshot' will only ever be run once
|
# function calls prefixed with 'oneshot' will only ever be run once
|
||||||
# otherwise the main function can be called repeatedly
|
# otherwise the main function can be called repeatedly
|
||||||
clear
|
clear; tput cnorm
|
||||||
tput cnorm
|
|
||||||
|
|
||||||
# unpack the file system
|
# unpack the file system
|
||||||
oneshot install_base
|
oneshot install_base
|
||||||
|
|
||||||
# generate /etc/fstab and touch it up if we used a swapfile
|
# generate /etc/fstab and touch it up if we used a swapfile
|
||||||
genfstab -U $MNT > $MNT/etc/fstab 2>$ERR
|
genfstab -U $MNT > $MNT/etc/fstab # 2>$ERR
|
||||||
check_for_errors "genfstab -U $MNT > $MNT/etc/fstab"
|
echeck "genfstab -U $MNT > $MNT/etc/fstab"
|
||||||
[[ -f $MNT/swapfile ]] && sed -i "s~${MNT}~~" $MNT/etc/fstab
|
[[ -f $MNT/swapfile ]] && sed -i "s~${MNT}~~" $MNT/etc/fstab
|
||||||
|
|
||||||
# update the mirrorlist.. MUST be done before updating or it may be slow
|
# update the mirrorlist.. MUST be done before updating or it may be slow
|
||||||
printf "%s\n\n" "Sorting the mirrorlist"
|
oneshot mirrorlist_sort
|
||||||
if hash reflector >/dev/null 2>&1; then
|
|
||||||
$MIRROR_CMD --save $MNT/etc/pacman.d/mirrorlist ||
|
|
||||||
reflector --score 100 -l 50 -f 10 --sort rate --save $MNT/etc/pacman.d/mirrorlist
|
|
||||||
else
|
|
||||||
{ eval $MIRROR_CMD || curl -s 'https://www.archlinux.org/mirrorlist/all/'; } |
|
|
||||||
sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -n 10 - >$MNT/etc/pacman.d/mirrorlist
|
|
||||||
fi
|
|
||||||
|
|
||||||
# MUST be before bootloader and mkinitcpio
|
# MUST be before bootloader and mkinitcpio
|
||||||
oneshot package_operations
|
oneshot package_operations
|
||||||
@ -44,11 +36,26 @@ install_main() {
|
|||||||
install_bootloader
|
install_bootloader
|
||||||
|
|
||||||
# hwclock setup, falls back to setting --directisa if the default fails
|
# hwclock setup, falls back to setting --directisa if the default fails
|
||||||
chroot_cmd "hwclock --systohc --utc" || chroot_cmd "hwclock --systohc --utc --directisa"
|
chrun "hwclock --systohc --utc" || chrun "hwclock --systohc --utc --directisa"
|
||||||
|
|
||||||
# create the user last to avoid referencing multiple $HOME locations for liveuser/newuser
|
# create the user last to avoid referencing multiple $HOME locations for liveuser/newuser
|
||||||
oneshot create_user
|
oneshot create_user
|
||||||
return 0
|
|
||||||
|
# drop off the user at the config editing menu
|
||||||
|
configs
|
||||||
|
}
|
||||||
|
|
||||||
|
mirrorlist_sort() {
|
||||||
|
printf "%s\n\n" "Sorting the mirrorlist"
|
||||||
|
if hash reflector >/dev/null 2>&1; then
|
||||||
|
$MIRROR_CMD --save $MNT/etc/pacman.d/mirrorlist --verbose ||
|
||||||
|
reflector --score 100 -l 50 -f 10 \
|
||||||
|
--sort rate --verbose --save $MNT/etc/pacman.d/mirrorlist
|
||||||
|
else
|
||||||
|
{ eval $MIRROR_CMD || curl -s 'https://www.archlinux.org/mirrorlist/all/'; } |
|
||||||
|
sed -e 's/^#Server/Server/' -e '/^#/d' |
|
||||||
|
rankmirrors -n 10 - > $MNT/etc/pacman.d/mirrorlist
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_base() {
|
install_base() {
|
||||||
@ -95,8 +102,8 @@ EOF
|
|||||||
LANG=$LOCALE
|
LANG=$LOCALE
|
||||||
EOF
|
EOF
|
||||||
sed -i "s/#en_US.UTF-8/en_US.UTF-8/g; s/#${LOCALE}/${LOCALE}/g" $MNT/etc/locale.gen
|
sed -i "s/#en_US.UTF-8/en_US.UTF-8/g; s/#${LOCALE}/${LOCALE}/g" $MNT/etc/locale.gen
|
||||||
chroot_cmd "locale-gen" 2>/dev/null
|
chrun "locale-gen" 2>/dev/null
|
||||||
chroot_cmd "ln -sf /usr/share/zoneinfo/$ZONE/$SUBZONE /etc/localtime" 2>/dev/null
|
chrun "ln -sf /usr/share/zoneinfo/$ZONE/$SUBZONE /etc/localtime" 2>/dev/null
|
||||||
|
|
||||||
# set the keymaps
|
# set the keymaps
|
||||||
cat > $MNT/etc/X11/xorg.conf.d/00-keyboard.conf <<EOF
|
cat > $MNT/etc/X11/xorg.conf.d/00-keyboard.conf <<EOF
|
||||||
@ -137,7 +144,7 @@ EOF
|
|||||||
|
|
||||||
create_user() {
|
create_user() {
|
||||||
# set root password
|
# set root password
|
||||||
chroot_cmd "chpasswd <<< 'root:$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$ROOT_PASS")'"
|
chrun "chpasswd <<< 'root:$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$ROOT_PASS")'"
|
||||||
|
|
||||||
# edit the group and passwd files in /etc/ to swap the liveuser account
|
# edit the group and passwd files in /etc/ to swap the liveuser account
|
||||||
sed -i "s/${LIVE}/${NEWUSER}/g" $MNT/etc/{group,gshadow,passwd,shadow}
|
sed -i "s/${LIVE}/${NEWUSER}/g" $MNT/etc/{group,gshadow,passwd,shadow}
|
||||||
@ -153,11 +160,11 @@ create_user() {
|
|||||||
[[ $INSTALL_WMS =~ bspwm ]] || rm -rf $MNT/home/$LIVE/.config/{bspwm,sxhkd}
|
[[ $INSTALL_WMS =~ bspwm ]] || rm -rf $MNT/home/$LIVE/.config/{bspwm,sxhkd}
|
||||||
[[ $INSTALL_WMS =~ i3-gaps ]] || rm -rf $MNT/home/$LIVE/.config/i3
|
[[ $INSTALL_WMS =~ i3-gaps ]] || rm -rf $MNT/home/$LIVE/.config/i3
|
||||||
[[ $INSTALL_WMS =~ openbox ]] || rm -rf $MNT/home/$LIVE/.config/{openbox,skippy-xd,jgmenu,conky,tint2}
|
[[ $INSTALL_WMS =~ openbox ]] || rm -rf $MNT/home/$LIVE/.config/{openbox,skippy-xd,jgmenu,conky,tint2}
|
||||||
chroot_cmd "mv -f /home/$LIVE /home/$NEWUSER"
|
chrun "mv -f /home/$LIVE /home/$NEWUSER"
|
||||||
fi
|
fi
|
||||||
chroot_cmd "usermod -aG rfkill,wheel,network,storage,power,video,audio,lp,autologin $NEWUSER"
|
chrun "usermod -aG rfkill,wheel,network,storage,power,video,audio,lp,autologin $NEWUSER"
|
||||||
chroot_cmd "chpasswd <<< '$NEWUSER:$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$USER_PASS")'"
|
chrun "chpasswd <<< '$NEWUSER:$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$USER_PASS")'"
|
||||||
chroot_cmd "chown -Rf $NEWUSER:users /home/$NEWUSER"
|
chrun "chown -Rf $NEWUSER:users /home/$NEWUSER"
|
||||||
}
|
}
|
||||||
|
|
||||||
run_mkinitcpio() {
|
run_mkinitcpio() {
|
||||||
@ -170,8 +177,8 @@ run_mkinitcpio() {
|
|||||||
(( LUKS == 1 )) && add="encrypt$([[ $add ]] && printf " %s" "$add")"
|
(( LUKS == 1 )) && add="encrypt$([[ $add ]] && printf " %s" "$add")"
|
||||||
sed -i "s/block filesystems/block ${add} filesystems ${MKINIT_HOOKS}/g" $MNT/etc/mkinitcpio.conf
|
sed -i "s/block filesystems/block ${add} filesystems ${MKINIT_HOOKS}/g" $MNT/etc/mkinitcpio.conf
|
||||||
|
|
||||||
chroot_cmd "mkinitcpio -p $KERNEL" 2>$ERR
|
chrun "mkinitcpio -p $KERNEL" # 2>$ERR
|
||||||
check_for_errors "mkinitcpio -p $KERNEL"
|
echeck "mkinitcpio -p $KERNEL"
|
||||||
}
|
}
|
||||||
|
|
||||||
package_operations() {
|
package_operations() {
|
||||||
@ -195,6 +202,10 @@ package_operations() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ $UCODE == 'amd-ucode.img' ]]; then
|
||||||
|
inpkg+=" amd-ucode"
|
||||||
|
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)"
|
||||||
|
|
||||||
@ -209,10 +220,10 @@ package_operations() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# iputils, base-devel, and git are all needed and should always be installed separately
|
# iputils, base-devel, and git are all needed and should always be installed separately
|
||||||
chroot_cmd "pacman -Syyu --noconfirm"
|
chrun "pacman -Syyu --noconfirm"
|
||||||
chroot_cmd "pacman -S iputils git --noconfirm; pacman -S base-devel --needed --noconfirm"
|
chrun "pacman -S iputils git --noconfirm; pacman -S base-devel --needed --noconfirm"
|
||||||
chroot_cmd "pacman -S $inpkg --needed --noconfirm"
|
chrun "pacman -S $inpkg --needed --noconfirm"
|
||||||
chroot_cmd "pacman -Rs $rmpkg --noconfirm"
|
chrun "pacman -Rs $rmpkg --noconfirm"
|
||||||
|
|
||||||
# for neovim copy the default vimrc and colorscheme to ~/.config/nvim
|
# for neovim copy the default vimrc and colorscheme to ~/.config/nvim
|
||||||
if [[ $EXTRA_PACKAGES =~ neovim ]]; then
|
if [[ $EXTRA_PACKAGES =~ neovim ]]; then
|
||||||
@ -226,7 +237,7 @@ package_operations() {
|
|||||||
mkdir -pv $MNT/home/$LIVE/suckless
|
mkdir -pv $MNT/home/$LIVE/suckless
|
||||||
for i in dwm dmenu st; do
|
for i in dwm dmenu st; do
|
||||||
p="/home/$LIVE/suckless/$i"
|
p="/home/$LIVE/suckless/$i"
|
||||||
chroot_cmd "git clone https://bitbucket.org/natemaia/$i $p && { cd $p; rm -f $p/config.h 2>/dev/null; make clean install && make clean; }"
|
chrun "git clone https://bitbucket.org/natemaia/$i $p && { cd $p; rm -f $p/config.h 2>/dev/null; make clean install && make clean; }"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -238,7 +249,7 @@ login_manager() {
|
|||||||
for f in $MNT/home/$LIVE/.{xinitrc,zprofile}; do
|
for f in $MNT/home/$LIVE/.{xinitrc,zprofile}; do
|
||||||
awk '{if($0 && $0 !~ "^#") print "# "$0; else print $0}' $f > $f
|
awk '{if($0 && $0 !~ "^#") print "# "$0; else print $0}' $f > $f
|
||||||
done
|
done
|
||||||
chroot_cmd 'systemctl enable lightdm.service && systemctl set-default graphical.target'
|
chrun 'systemctl enable lightdm.service && systemctl set-default graphical.target'
|
||||||
cat > $MNT/etc/lightdm/lightdm-gtk-greeter.conf << EOF
|
cat > $MNT/etc/lightdm/lightdm-gtk-greeter.conf << EOF
|
||||||
# LightDM GTK+ Configuration
|
# LightDM GTK+ Configuration
|
||||||
|
|
||||||
@ -252,7 +263,7 @@ font-name=DejaVu Sans Mono 11
|
|||||||
position=30%,end 50%,end
|
position=30%,end 50%,end
|
||||||
EOF
|
EOF
|
||||||
if [[ $AUTOLOGIN == true ]]; then
|
if [[ $AUTOLOGIN == true ]]; then
|
||||||
chroot_cmd "groupadd -r nopasswdlogin && usermod -aG nopasswdlogin $NEWUSER"
|
chrun "groupadd -r nopasswdlogin && usermod -aG nopasswdlogin $NEWUSER"
|
||||||
sed -i '/#%PAM-1.0/ a auth sufficient pam_succeed_if.so user ingroup nopasswdlogin' $MNT/etc/pam.d/lightdm
|
sed -i '/#%PAM-1.0/ a auth sufficient pam_succeed_if.so user ingroup nopasswdlogin' $MNT/etc/pam.d/lightdm
|
||||||
sed -i "/#autologin-session=/ c autologin-session=${LOGIN_WM}" $MNT/etc/lightdm/lightdm.conf
|
sed -i "/#autologin-session=/ c autologin-session=${LOGIN_WM}" $MNT/etc/lightdm/lightdm.conf
|
||||||
sed -i "/#autologin-user=/ c autologin-user=${NEWUSER}" $MNT/etc/lightdm/lightdm.conf
|
sed -i "/#autologin-user=/ c autologin-user=${NEWUSER}" $MNT/etc/lightdm/lightdm.conf
|
||||||
@ -264,7 +275,7 @@ EOF
|
|||||||
elif grep -q 'exec sudo archlabs-installer' $MNT/home/$LIVE/.zprofile; then
|
elif grep -q 'exec sudo archlabs-installer' $MNT/home/$LIVE/.zprofile; then
|
||||||
sed -i 's|exec sudo archlabs-installer|exec startx -- vt1 >/dev/null 2>&1|' $MNT/home/$LIVE/.zprofile
|
sed -i 's|exec sudo archlabs-installer|exec startx -- vt1 >/dev/null 2>&1|' $MNT/home/$LIVE/.zprofile
|
||||||
else
|
else
|
||||||
cat > ~/test << EOF
|
cat > $MNT/home/$LIVE/.zprofile << EOF
|
||||||
if [[ ! \$DISPLAY && \$XDG_VTNR -eq 1 ]]; then
|
if [[ ! \$DISPLAY && \$XDG_VTNR -eq 1 ]]; then
|
||||||
exec startx -- vt1 >/dev/null 2>&1
|
exec startx -- vt1 >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
@ -18,7 +18,7 @@ declare -g LUKS_NAME="cryptroot"
|
|||||||
luks_open() {
|
luks_open() {
|
||||||
LUKS_PART=""
|
LUKS_PART=""
|
||||||
modprobe -a dm-mod dm_crypt
|
modprobe -a dm-mod dm_crypt
|
||||||
unmount_partitions
|
unmountp
|
||||||
find_partitions 'part|crypt|lvm' || return 1
|
find_partitions 'part|crypt|lvm' || return 1
|
||||||
tput civis
|
tput civis
|
||||||
|
|
||||||
@ -36,8 +36,8 @@ luks_open() {
|
|||||||
luks_pass "$_LuksOpen" "$LUKS_NAME" || return 1
|
luks_pass "$_LuksOpen" "$LUKS_NAME" || return 1
|
||||||
|
|
||||||
infobox "$_LuksOpen" "$_LuksWaitBody $LUKS_NAME $_LuksWaitBody2 $LUKS_PART\n" 0
|
infobox "$_LuksOpen" "$_LuksWaitBody $LUKS_NAME $_LuksWaitBody2 $LUKS_PART\n" 0
|
||||||
cryptsetup open --type luks $LUKS_PART "$LUKS_NAME" <<< "$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")" 2>$ERR
|
cryptsetup open --type luks $LUKS_PART "$LUKS_NAME" <<< "$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")" # 2>$ERR
|
||||||
check_for_errors "cryptsetup open --type luks $LUKS_PART $LUKS_NAME"
|
echeck "cryptsetup open --type luks $LUKS_PART $LUKS_NAME"
|
||||||
|
|
||||||
LUKS=1
|
LUKS=1
|
||||||
luks_show
|
luks_show
|
||||||
@ -88,7 +88,7 @@ luks_pass() {
|
|||||||
luks_setup() {
|
luks_setup() {
|
||||||
LUKS_PART=""
|
LUKS_PART=""
|
||||||
modprobe -a dm-mod dm_crypt
|
modprobe -a dm-mod dm_crypt
|
||||||
unmount_partitions
|
unmountp
|
||||||
|
|
||||||
if [[ $ROOT_PART == "" || $LVM -eq 1 ]]; then
|
if [[ $ROOT_PART == "" || $LVM -eq 1 ]]; then
|
||||||
find_partitions 'part|lvm' || return 1
|
find_partitions 'part|lvm' || return 1
|
||||||
@ -117,11 +117,11 @@ luks_default() {
|
|||||||
luks_setup || return 1
|
luks_setup || return 1
|
||||||
infobox "$_LuksEncrypt" "$_LuksWaitBody $LUKS_NAME $_LuksWaitBody2 $LUKS_PART\n" 0
|
infobox "$_LuksEncrypt" "$_LuksWaitBody $LUKS_NAME $_LuksWaitBody2 $LUKS_PART\n" 0
|
||||||
|
|
||||||
cryptsetup -q luksFormat $LUKS_PART <<< "$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")" 2>$ERR
|
cryptsetup -q luksFormat $LUKS_PART <<< "$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")" # 2>$ERR
|
||||||
check_for_errors "cryptsetup -q luksFormat $LUKS_PART"
|
echeck "cryptsetup -q luksFormat $LUKS_PART"
|
||||||
|
|
||||||
cryptsetup open $LUKS_PART "$LUKS_NAME" <<< "$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")" 2>$ERR
|
cryptsetup open $LUKS_PART "$LUKS_NAME" <<< "$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")" # 2>$ERR
|
||||||
check_for_errors "cryptsetup open $LUKS_PART $LUKS_NAME"
|
echeck "cryptsetup open $LUKS_PART $LUKS_NAME"
|
||||||
|
|
||||||
LUKS=1
|
LUKS=1
|
||||||
luks_show
|
luks_show
|
||||||
@ -137,11 +137,11 @@ luks_keycmd() {
|
|||||||
|
|
||||||
infobox "$_LuksEncryptAdv" "$_LuksWaitBody $LUKS_NAME $_LuksWaitBody2 $LUKS_PART\n" 0
|
infobox "$_LuksEncryptAdv" "$_LuksWaitBody $LUKS_NAME $_LuksWaitBody2 $LUKS_PART\n" 0
|
||||||
|
|
||||||
cryptsetup -q $cipher luksFormat $LUKS_PART <<< "$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")" 2>$ERR
|
cryptsetup -q $cipher luksFormat $LUKS_PART <<< "$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")" # 2>$ERR
|
||||||
check_for_errors "cryptsetup -q $cipher luksFormat $LUKS_PART"
|
echeck "cryptsetup -q $cipher luksFormat $LUKS_PART"
|
||||||
|
|
||||||
cryptsetup open $LUKS_PART "$LUKS_NAME" <<< "$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")" 2>$ERR
|
cryptsetup open $LUKS_PART "$LUKS_NAME" <<< "$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")" # 2>$ERR
|
||||||
check_for_errors "cryptsetup open $LUKS_PART $LUKS_NAME"
|
echeck "cryptsetup open $LUKS_PART $LUKS_NAME"
|
||||||
|
|
||||||
luks_show
|
luks_show
|
||||||
return 0
|
return 0
|
||||||
@ -191,8 +191,8 @@ luks_keyfile() {
|
|||||||
mkkey="$mkkey && chmod 000 /crypto_keyfile.bin"
|
mkkey="$mkkey && chmod 000 /crypto_keyfile.bin"
|
||||||
mkkey="$mkkey && cryptsetup luksAddKey /dev/$n /crypto_keyfile.bin <<< '$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")'"
|
mkkey="$mkkey && cryptsetup luksAddKey /dev/$n /crypto_keyfile.bin <<< '$(openssl enc -pbkdf2 -a -d -salt -pass pass:$SALT <<< "$LUKS_PASS")'"
|
||||||
|
|
||||||
chroot_cmd "$mkkey"
|
chrun "$mkkey"
|
||||||
sed -i 's/FILES=()/FILES=(\/crypto_keyfile.bin)/g' $MNT/etc/mkinitcpio.conf 2>$ERR
|
sed -i 's/FILES=()/FILES=(\/crypto_keyfile.bin)/g' $MNT/etc/mkinitcpio.conf # 2>$ERR
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
@ -21,7 +21,7 @@ lvm_detect() {
|
|||||||
infobox "$_PrepLVM" "$_LvmDetBody" 0
|
infobox "$_PrepLVM" "$_LvmDetBody" 0
|
||||||
|
|
||||||
modprobe dm-mod 2>$ERR
|
modprobe dm-mod 2>$ERR
|
||||||
check_for_errors 'modprobe dm-mod'
|
echeck 'modprobe dm-mod'
|
||||||
|
|
||||||
vgscan >/dev/null 2>&1
|
vgscan >/dev/null 2>&1
|
||||||
vgchange -ay >/dev/null 2>&1
|
vgchange -ay >/dev/null 2>&1
|
||||||
@ -140,8 +140,8 @@ lvm_extra_lvs() {
|
|||||||
get_lv_size || { break; return 1; }
|
get_lv_size || { break; return 1; }
|
||||||
|
|
||||||
# create it
|
# create it
|
||||||
lvcreate -L "$VOLUME_SIZE" "$VOLUME_GROUP" -n "$VOLUME_NAME" 2>$ERR
|
lvcreate -L "$VOLUME_SIZE" "$VOLUME_GROUP" -n "$VOLUME_NAME" # 2>$ERR
|
||||||
check_for_errors "lvcreate -L $VOLUME_SIZE $VOLUME_GROUP -n $VOLUME_NAME"
|
echeck "lvcreate -L $VOLUME_SIZE $VOLUME_GROUP -n $VOLUME_NAME"
|
||||||
msgbox "$_LvmCreateVG (LV:$VOL_COUNT)" "$_Done LV $VOLUME_NAME ($VOLUME_SIZE) $_LvmPvDoneBody2."
|
msgbox "$_LvmCreateVG (LV:$VOL_COUNT)" "$_Done LV $VOLUME_NAME ($VOLUME_SIZE) $_LvmPvDoneBody2."
|
||||||
|
|
||||||
((VOL_COUNT--)) # decrement the number of volumes chosen after each loop
|
((VOL_COUNT--)) # decrement the number of volumes chosen after each loop
|
||||||
@ -184,8 +184,8 @@ lvm_create_group() {
|
|||||||
|
|
||||||
# create it
|
# create it
|
||||||
infobox "$_LvmCreateVG" "$_LvmPvActBody1 $VOLUME_GROUP\n" 0
|
infobox "$_LvmCreateVG" "$_LvmPvActBody1 $VOLUME_GROUP\n" 0
|
||||||
vgcreate -f "$VOLUME_GROUP" "$GROUP_PARTS" >/dev/null 2>$ERR
|
vgcreate -f "$VOLUME_GROUP" "$GROUP_PARTS" >/dev/null # 2>$ERR
|
||||||
check_for_errors "vgcreate -f $VOLUME_GROUP $GROUP_PARTS"
|
echeck "vgcreate -f $VOLUME_GROUP $GROUP_PARTS"
|
||||||
|
|
||||||
# get volume size size and transform size to MB if size is given in GB
|
# get volume size size and transform size to MB if size is given in GB
|
||||||
GROUP_SIZE=$(vgdisplay "$VOLUME_GROUP" | awk '/VG Size/ {print int($3)}')
|
GROUP_SIZE=$(vgdisplay "$VOLUME_GROUP" | awk '/VG Size/ {print int($3)}')
|
||||||
@ -202,7 +202,7 @@ lvm_create() {
|
|||||||
VOLUME_GROUP=""
|
VOLUME_GROUP=""
|
||||||
GROUP_PARTS=""
|
GROUP_PARTS=""
|
||||||
VOL_GROUP_MB=0
|
VOL_GROUP_MB=0
|
||||||
unmount_partitions
|
unmountp
|
||||||
|
|
||||||
if [[ $LUKS -eq 1 && $LUKS_NAME != "" ]]; then
|
if [[ $LUKS -eq 1 && $LUKS_NAME != "" ]]; then
|
||||||
GROUP_PARTS="/dev/mapper/$LUKS_NAME"
|
GROUP_PARTS="/dev/mapper/$LUKS_NAME"
|
||||||
@ -217,8 +217,8 @@ lvm_create() {
|
|||||||
|
|
||||||
# last or only logical volume
|
# last or only logical volume
|
||||||
lvm_volume_name "$_LvmLvNameBody1 $_LvmLvNameBody2 (${VOL_GROUP_MB}MB)" || return 1
|
lvm_volume_name "$_LvmLvNameBody1 $_LvmLvNameBody2 (${VOL_GROUP_MB}MB)" || return 1
|
||||||
lvcreate -l +100%FREE "$VOLUME_GROUP" -n "$VOLUME_NAME" 2>$ERR
|
lvcreate -l +100%FREE "$VOLUME_GROUP" -n "$VOLUME_NAME" # 2>$ERR
|
||||||
check_for_errors "lvcreate -l +100%FREE $VOLUME_GROUP -n $VOLUME_NAME"
|
echeck "lvcreate -l +100%FREE $VOLUME_GROUP -n $VOLUME_NAME"
|
||||||
|
|
||||||
LVM=1
|
LVM=1
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
format() {
|
format() {
|
||||||
infobox "$_FSTitle" "\nFormatting: $1\n\nCommand: ${FS_CMDS[$2]}\n" 0
|
infobox "$_FSTitle" "\nFormatting: $1\n\nCommand: ${FS_CMDS[$2]}\n" 0
|
||||||
${FS_CMDS[$2]} $1 >/dev/null 2>$ERR
|
${FS_CMDS[$2]} $1 >/dev/null 2>$ERR
|
||||||
check_for_errors "${FS_CMDS[$2]} $1"
|
echeck "${FS_CMDS[$2]} $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
decr_count() {
|
decr_count() {
|
||||||
@ -30,15 +30,15 @@ decr_count() {
|
|||||||
|
|
||||||
enable_swap() {
|
enable_swap() {
|
||||||
if [[ $1 == "$MNT/swapfile" ]]; then
|
if [[ $1 == "$MNT/swapfile" ]]; then
|
||||||
fallocate -l $SWAP_SIZE $1 2>$ERR
|
fallocate -l $SWAP_SIZE $1 # 2>$ERR
|
||||||
check_for_errors "fallocate -l $SWAP_SIZE $1"
|
echeck "fallocate -l $SWAP_SIZE $1"
|
||||||
chmod 600 $1 2>$ERR
|
chmod 600 $1 # 2>$ERR
|
||||||
check_for_errors "chmod 600 $1"
|
echeck "chmod 600 $1"
|
||||||
fi
|
fi
|
||||||
mkswap $1 >/dev/null 2>$ERR
|
mkswap $1 >/dev/null # 2>$ERR
|
||||||
check_for_errors "mkswap $1"
|
echeck "mkswap $1"
|
||||||
swapon $1 >/dev/null 2>$ERR
|
swapon $1 >/dev/null # 2>$ERR
|
||||||
check_for_errors "swapon $1"
|
echeck "swapon $1"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,11 +50,11 @@ mount_partition() {
|
|||||||
mkdir -p "$mount"
|
mkdir -p "$mount"
|
||||||
|
|
||||||
if [[ ${FS_OPTS[$fs]} != "" && $part != "$BOOT_PART" ]] && select_mount_opts "$part" "$fs"; then
|
if [[ ${FS_OPTS[$fs]} != "" && $part != "$BOOT_PART" ]] && select_mount_opts "$part" "$fs"; then
|
||||||
mount -o $MNT_OPTS $part "$mount" 2>$ERR
|
mount -o $MNT_OPTS $part "$mount" # 2>$ERR
|
||||||
check_for_errors "mount -o $MNT_OPTS $part $mount"
|
echeck "mount -o $MNT_OPTS $part $mount"
|
||||||
else
|
else
|
||||||
mount $part "$mount" 2>$ERR
|
mount $part "$mount" # 2>$ERR
|
||||||
check_for_errors "mount $part $mount"
|
echeck "mount $part $mount"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
confirm_mount $part "$mount" || return 1
|
confirm_mount $part "$mount" || return 1
|
||||||
@ -213,7 +213,7 @@ setup_boot_device() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
show_devices() {
|
device_tree() {
|
||||||
tput civis
|
tput civis
|
||||||
local msg
|
local msg
|
||||||
if [[ $IGNORE_DEV != "" ]]; then
|
if [[ $IGNORE_DEV != "" ]]; then
|
||||||
@ -229,7 +229,7 @@ show_devices() {
|
|||||||
select_device() {
|
select_device() {
|
||||||
local dev
|
local dev
|
||||||
local msg
|
local msg
|
||||||
[[ $1 == 'boot' ]] && msg="$_DevSelTitle for bootloader\n" || unmount_partitions
|
[[ $1 == 'boot' ]] && msg="$_DevSelTitle for bootloader\n" || unmountp
|
||||||
|
|
||||||
if [[ $DEV_COUNT -eq 1 && $SYS_DEVS ]]; then
|
if [[ $DEV_COUNT -eq 1 && $SYS_DEVS ]]; then
|
||||||
DEVICE="$(awk '{print $1}' <<< "$SYS_DEVS")"
|
DEVICE="$(awk '{print $1}' <<< "$SYS_DEVS")"
|
||||||
@ -249,11 +249,10 @@ select_device() {
|
|||||||
# if the device selected was for grub bootloader, set the BOOT_DEVICE
|
# if the device selected was for grub bootloader, set the BOOT_DEVICE
|
||||||
# this is needed because grub uses the base device for BIOS, not the partition
|
# this is needed because grub uses the base device for BIOS, not the partition
|
||||||
[[ $1 == 'boot' ]] && BOOT_DEVICE="$DEVICE"
|
[[ $1 == 'boot' ]] && BOOT_DEVICE="$DEVICE"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
edit_partitions() {
|
partition() {
|
||||||
local device
|
local device
|
||||||
if [[ $# -eq 0 ]]; then
|
if [[ $# -eq 0 ]]; then
|
||||||
select_device 'root' || return 1
|
select_device 'root' || return 1
|
||||||
@ -272,17 +271,16 @@ edit_partitions() {
|
|||||||
|
|
||||||
tput civis
|
tput civis
|
||||||
if [[ $choice != "$_PartWipe" && $choice != "$_PartAuto" && $choice != "$_PartShowTree" ]]; then
|
if [[ $choice != "$_PartWipe" && $choice != "$_PartAuto" && $choice != "$_PartShowTree" ]]; then
|
||||||
clear; tput cnorm
|
clear; tput cnorm; $choice $device
|
||||||
$choice $device
|
|
||||||
elif [[ $choice == "$_PartShowTree" ]]; then
|
elif [[ $choice == "$_PartShowTree" ]]; then
|
||||||
msgbox "$_PrepShowDev" "\n$(lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE,MOUNTPOINT "$device")\n"
|
msgbox "$_PrepShowDev" "\n$(lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE,MOUNTPOINT "$device")\n"
|
||||||
edit_partitions $device
|
partition $device
|
||||||
elif [[ $choice == "$_PartWipe" ]]; then
|
elif [[ $choice == "$_PartWipe" ]]; then
|
||||||
yesno "$_PartWipe" "$_PartBody1 $device $_PartWipeBody2" && wipe -Ifrev $device
|
yesno "$_PartWipe" "$_PartBody1 $device $_PartWipeBody2" && wipe -Ifrev $device
|
||||||
edit_partitions $device
|
partition $device
|
||||||
else
|
else
|
||||||
# if auto_partition fails we need to re-initialize the variables, just to be sure
|
# if auto_partition fails we need to re-initialize the variables, just to be sure
|
||||||
auto_partition $device || { initialize_variables; return 1; }
|
auto_partition $device || { init; return 1; }
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,10 +288,10 @@ edit_partitions() {
|
|||||||
## Mount functions ##
|
## Mount functions ##
|
||||||
########################################################
|
########################################################
|
||||||
|
|
||||||
mount_main() {
|
mountp() {
|
||||||
# prepare partition list PARTS for dialog
|
# prepare partition list PARTS for dialog
|
||||||
lvm_detect
|
lvm_detect
|
||||||
unmount_partitions
|
unmountp
|
||||||
find_partitions 'part|lvm|crypt' || return 1
|
find_partitions 'part|lvm|crypt' || return 1
|
||||||
|
|
||||||
# remove boot partition from dialog list if we auto partitioned one
|
# remove boot partition from dialog list if we auto partitioned one
|
||||||
@ -324,6 +322,13 @@ mount_main() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unmountp() {
|
||||||
|
swapoff -a
|
||||||
|
for i in $(mount | awk "/${MNT//\//\\/}/"' {print $3}' | sort -r); do
|
||||||
|
umount -r "$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
|
||||||
@ -352,7 +357,7 @@ select_swap() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
select_boot_setup() {
|
select_boot_setup() {
|
||||||
# choose bootloader and by extension mountpoint (if needed)
|
# choose bootloader and mountpoint (if needed)
|
||||||
tput civis
|
tput civis
|
||||||
BOOTLDR="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
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]})"
|
||||||
@ -398,8 +403,13 @@ select_mount_opts() {
|
|||||||
local title="${fs^} Mount Options"
|
local title="${fs^} Mount Options"
|
||||||
|
|
||||||
tput civis
|
tput civis
|
||||||
MNT_OPTS="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " \
|
if ssd "$part"; then
|
||||||
--checklist "$_MntBody" 0 0 0 ${FS_OPTS[$fs]} | sed 's/ /,/g; $s/,$//')"
|
MNT_OPTS="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " --checklist \
|
||||||
|
"$_MntBody" 0 0 0 $(sed 's/discard - off/discard - on/' <<< "${FS_OPTS[$fs]}") | sed 's/ /,/g; $s/,$//')"
|
||||||
|
else
|
||||||
|
MNT_OPTS="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " \
|
||||||
|
--checklist "$_MntBody" 0 0 0 ${FS_OPTS[$fs]} | sed 's/ /,/g; $s/,$//')"
|
||||||
|
fi
|
||||||
[[ $? != 0 || $MNT_OPTS == "" ]] && return 1
|
[[ $? != 0 || $MNT_OPTS == "" ]] && return 1
|
||||||
|
|
||||||
if ! yesno "$title" "$_MntConfBody $MNT_OPTS\n"; then
|
if ! yesno "$title" "$_MntConfBody $MNT_OPTS\n"; then
|
||||||
@ -416,8 +426,8 @@ select_filesystem() {
|
|||||||
|
|
||||||
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 "\nPartition: ${part}$([[ $cur_fs != "" ]] &&
|
--menu "\nPartition Name: ${part}$([[ $cur_fs ]] &&
|
||||||
printf "\nCurrent: %s" "$cur_fs")\n$_FSBody" 0 0 0 \
|
printf "\nExisting Filesystem: %s" "$cur_fs")$_FSBody" 0 0 0 \
|
||||||
$([[ $cur_fs != "" ]] && printf "%s -" "$_Skip") \
|
$([[ $cur_fs != "" ]] && 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]}" \
|
||||||
|
@ -8,15 +8,26 @@
|
|||||||
|
|
||||||
# set -n
|
# set -n
|
||||||
|
|
||||||
chroot_cmd() {
|
chrun() {
|
||||||
arch-chroot $MNT /bin/bash -c "$1"
|
arch-chroot $MNT /bin/bash -c "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
val_from_json() {
|
json() {
|
||||||
python3 -c "import sys, json; print(json.load(sys.stdin)['$1'])"
|
python3 -c "import sys, json; print(json.load(sys.stdin)['$1'])"
|
||||||
}
|
}
|
||||||
|
|
||||||
identify_system() {
|
src() {
|
||||||
|
. "$1" || { printf "\nFailed to source file %s\n" "$1"; die 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
ssd() {
|
||||||
|
local dev=$1
|
||||||
|
dev=${dev#/dev/}
|
||||||
|
[[ $dev =~ nvme ]] && dev=${dev%p[0-9]*} || dev=${dev%[0-9]*}
|
||||||
|
[[ $(cat /sys/block/$dev/queue/rotational) -eq 0 ]] || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
sysid() {
|
||||||
if grep -qi 'apple' /sys/class/dmi/id/sys_vendor; then
|
if grep -qi 'apple' /sys/class/dmi/id/sys_vendor; then
|
||||||
modprobe -r -q efivars
|
modprobe -r -q efivars
|
||||||
else
|
else
|
||||||
@ -34,21 +45,23 @@ identify_system() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
check_requirements() {
|
checks() {
|
||||||
if [[ $(whoami) != "root" ]]; then
|
if [[ $(whoami) != "root" ]]; then
|
||||||
infobox "$_ErrTitle" "$_NotRoot\n$_Exit" && die 1
|
infobox "$_ErrTitle" "$_NotRoot\n$_Exit" && die 1
|
||||||
elif ! grep -qw 'lm' /proc/cpuinfo; then
|
elif ! grep -qw 'lm' /proc/cpuinfo; then
|
||||||
infobox "$_ErrTitle" "$_Not64Bit\n$_Exit" && die 1
|
infobox "$_ErrTitle" "$_Not64Bit\n$_Exit" && die 1
|
||||||
elif ! (curl -s --head 'https://www.archlinux.org/mirrorlist/all/' | head -n 1 | grep -q '200'); then
|
elif ! curl -s --head 'https://www.archlinux.org/mirrorlist/all/' | head -n 1 | grep -q '200'; then
|
||||||
([[ $(systemctl is-active NetworkManager) == "active" ]] && hash nmtui >/dev/null 2>&1) && { tput civis; nmtui; }
|
if [[ $(systemctl is-active NetworkManager) == "active" ]] && hash nmtui >/dev/null 2>&1; then
|
||||||
if ! (curl -s --head 'https://www.archlinux.org/mirrorlist/all/' | head -n 1 | grep -q '200'); then
|
tput civis; nmtui
|
||||||
|
fi
|
||||||
|
if ! curl -s --head 'https://www.archlinux.org/mirrorlist/all/' | head -n 1 | grep -q '200'; then
|
||||||
infobox "$_ErrTitle" "$_NoNetwork\n"
|
infobox "$_ErrTitle" "$_NoNetwork\n"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
check_for_errors() {
|
echeck() {
|
||||||
# return if the last process exited normally
|
# return if the last process exited normally
|
||||||
(( $? == 0 )) && return 0
|
(( $? == 0 )) && return 0
|
||||||
local msg="\nThe command exited abnormally: $1"
|
local msg="\nThe command exited abnormally: $1"
|
||||||
@ -70,7 +83,7 @@ check_for_errors() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
check_install_ready() {
|
icheck() {
|
||||||
[[ $(lsblk -o MOUNTPOINT) =~ $MNT && $CONFIG_DONE == true ]] && return 0
|
[[ $(lsblk -o MOUNTPOINT) =~ $MNT && $CONFIG_DONE == true ]] && return 0
|
||||||
|
|
||||||
if ! [[ $(lsblk -o MOUNTPOINT) =~ $MNT ]]; then
|
if ! [[ $(lsblk -o MOUNTPOINT) =~ $MNT ]]; then
|
||||||
@ -83,13 +96,6 @@ check_install_ready() {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
unmount_partitions() {
|
|
||||||
swapoff -a
|
|
||||||
for i in $(mount | awk "/${MNT//\//\\/}/"' {print $3}' | sort -r); do
|
|
||||||
umount -r "$i" >/dev/null 2>&1
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
getinput() {
|
getinput() {
|
||||||
local answer
|
local answer
|
||||||
answer="$(dialog --cr-wrap --max-input 63 --stdout --no-cancel \
|
answer="$(dialog --cr-wrap --max-input 63 --stdout --no-cancel \
|
||||||
@ -133,7 +139,7 @@ wrap_up() {
|
|||||||
|
|
||||||
die() {
|
die() {
|
||||||
tput cnorm
|
tput cnorm
|
||||||
unmount_partitions
|
punmount
|
||||||
pgrep -f "$TERM_CMD -e tail" && pkill -f "$TERM_CMD -e tail"
|
pgrep -f "$TERM_CMD -e tail" && pkill -f "$TERM_CMD -e tail"
|
||||||
[[ $1 =~ [0-9] ]] && exit $1 || $1
|
[[ $1 =~ [0-9] ]] && exit $1 || $1
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user