Function style change, clean up for virtualbox utils
This commit is contained in:
parent
76a62ee6da
commit
8e1b4a6647
21
README.md
21
README.md
@ -19,22 +19,21 @@
|
|||||||
- `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
|
- Basic unix tool set: `awk` `sed` `grep` `uniq` `sort` `find` `ping` `mkfs` `lsblk` `curl`.
|
||||||
- `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/master/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/master/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:
|
- Pre-built packages can be found in our repos:
|
||||||
- stable: https://bitbucket.org/archlabslinux/archlabs_repo/src/master/x86_64/
|
[stable](https://bitbucket.org/archlabslinux/archlabs_repo/src/master/x86_64/)
|
||||||
- unstable: https://bitbucket.org/archlabslinux/archlabs_unstable/src/master/x86_64/
|
[unstable](https://bitbucket.org/archlabslinux/archlabs_unstable/src/master/x86_64/)
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#!/usr/bin/bash
|
#!/usr/bin/bash
|
||||||
|
|
||||||
# shellcheck disable=2154,2034,2153
|
# shellcheck disable=2154,2034,2153
|
||||||
|
# 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
|
||||||
@ -8,13 +10,14 @@
|
|||||||
|
|
||||||
|
|
||||||
# immutable globals
|
# immutable globals
|
||||||
readonly VER="1.7.19" # Installer version
|
readonly VER="1.7.20" # Installer version
|
||||||
readonly DIST="ArchLabs" # Linux distributor
|
readonly DIST="ArchLabs" # Linux distributor
|
||||||
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
|
||||||
readonly DBG="/tmp/debuglog" # Built-in error log
|
readonly DBG="/tmp/debuglog" # Built-in error log
|
||||||
|
|
||||||
main() {
|
main()
|
||||||
|
{
|
||||||
if [[ $CURRENT_MENU != "main" ]]; then
|
if [[ $CURRENT_MENU != "main" ]]; then
|
||||||
if [[ $SAVED ]]; then
|
if [[ $SAVED ]]; then
|
||||||
SELECTED=$((SAVED + 1))
|
SELECTED=$((SAVED + 1))
|
||||||
|
@ -35,7 +35,8 @@ declare -Agx EDIT_FILES=(
|
|||||||
[11]="" # login files, left empty, don't know the username yet for /home/USER/FILES
|
[11]="" # login files, left empty, don't know the username yet for /home/USER/FILES
|
||||||
)
|
)
|
||||||
|
|
||||||
prep_for_grub() {
|
prep_for_grub()
|
||||||
|
{
|
||||||
local cfg="$MNT/etc/default/grub"
|
local cfg="$MNT/etc/default/grub"
|
||||||
sed -i "s/GRUB_DISTRIBUTOR=.*/GRUB_DISTRIBUTOR=\"${DIST}\"/g;
|
sed -i "s/GRUB_DISTRIBUTOR=.*/GRUB_DISTRIBUTOR=\"${DIST}\"/g;
|
||||||
s/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"\"/g" $cfg
|
s/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"\"/g" $cfg
|
||||||
@ -49,7 +50,8 @@ prep_for_grub() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
prep_for_systemd-boot() {
|
prep_for_systemd-boot()
|
||||||
|
{
|
||||||
# no LVM then systemd-boot uses PARTUUID
|
# no LVM then systemd-boot uses PARTUUID
|
||||||
[[ $ROOT_PART =~ /dev/mapper ]] || ROOT_PART_ID="PART$ROOT_PART_ID"
|
[[ $ROOT_PART =~ /dev/mapper ]] || ROOT_PART_ID="PART$ROOT_PART_ID"
|
||||||
|
|
||||||
@ -84,7 +86,8 @@ EOF
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
prep_for_syslinux() {
|
prep_for_syslinux()
|
||||||
|
{
|
||||||
if [[ $SYS == 'UEFI' ]]; then
|
if [[ $SYS == 'UEFI' ]]; then
|
||||||
local cfgdir="${MNT}${BMNTS[$SYS-$BOOTLDR]}/EFI/syslinux"
|
local cfgdir="${MNT}${BMNTS[$SYS-$BOOTLDR]}/EFI/syslinux"
|
||||||
local cfgsrcdir="/usr/lib/syslinux/efi32/"
|
local cfgsrcdir="/usr/lib/syslinux/efi32/"
|
||||||
@ -119,7 +122,8 @@ EOF
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
install_bootloader() {
|
install_bootloader()
|
||||||
|
{
|
||||||
# not an LVM we can use the UUID for booting otherwise use the partition label
|
# not an LVM we can use the UUID for booting otherwise use the partition label
|
||||||
if ! [[ $ROOT_PART =~ /dev/mapper ]]; then
|
if ! [[ $ROOT_PART =~ /dev/mapper ]]; then
|
||||||
ROOT_PART_ID="UUID=$(blkid -s PARTUUID -o value $ROOT_PART)"
|
ROOT_PART_ID="UUID=$(blkid -s PARTUUID -o value $ROOT_PART)"
|
||||||
@ -145,7 +149,8 @@ install_bootloader() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
uefi_boot_fallback() {
|
uefi_boot_fallback()
|
||||||
|
{
|
||||||
# some UEFI firmware requires a directory in the ESP and a generic bootx64.efi
|
# some UEFI firmware requires a directory in the ESP and a generic bootx64.efi
|
||||||
# see: https://wiki.archlinux.org/index.php/GRUB#UEFI
|
# see: https://wiki.archlinux.org/index.php/GRUB#UEFI
|
||||||
# also: https://wiki.archlinux.org/index.php/syslinux#UEFI_Systems
|
# also: https://wiki.archlinux.org/index.php/syslinux#UEFI_Systems
|
||||||
@ -172,7 +177,8 @@ uefi_boot_fallback() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
shim_secure_boot() {
|
shim_secure_boot()
|
||||||
|
{
|
||||||
# still a W.I.P
|
# still a W.I.P
|
||||||
local shim_file="shim.efi"
|
local shim_file="shim.efi"
|
||||||
[[ $IS_64BIT == true ]] && shim_file="shim64.efi"
|
[[ $IS_64BIT == true ]] && shim_file="shim64.efi"
|
||||||
|
@ -8,7 +8,9 @@
|
|||||||
|
|
||||||
# shellcheck disable=2154,2034,2153
|
# shellcheck disable=2154,2034,2153
|
||||||
|
|
||||||
# mutable globals {
|
# mutable globals
|
||||||
|
# {
|
||||||
|
|
||||||
declare -g WARN=false
|
declare -g WARN=false
|
||||||
declare -g AUTOLOGIN=false
|
declare -g AUTOLOGIN=false
|
||||||
declare -g CONFIG_DONE=false
|
declare -g CONFIG_DONE=false
|
||||||
@ -38,15 +40,16 @@ declare -g MKINIT_HOOKS="shutdown"
|
|||||||
|
|
||||||
# }
|
# }
|
||||||
|
|
||||||
|
|
||||||
# basic dialog helper functions
|
# basic dialog helper functions
|
||||||
|
|
||||||
msgbox() {
|
msgbox()
|
||||||
|
{
|
||||||
tput civis
|
tput civis
|
||||||
dialog --cr-wrap --backtitle "$BT" --title " $1 " --msgbox "$2\n" 0 0
|
dialog --cr-wrap --backtitle "$BT" --title " $1 " --msgbox "$2\n" 0 0
|
||||||
}
|
}
|
||||||
|
|
||||||
menubox() {
|
menubox()
|
||||||
|
{
|
||||||
local title="$1"
|
local title="$1"
|
||||||
local body="$2"
|
local body="$2"
|
||||||
local h=$3
|
local h=$3
|
||||||
@ -60,7 +63,8 @@ menubox() {
|
|||||||
printf "%s" "$response"
|
printf "%s" "$response"
|
||||||
}
|
}
|
||||||
|
|
||||||
checkbox() {
|
checkbox()
|
||||||
|
{
|
||||||
local title="$1"
|
local title="$1"
|
||||||
local body="$2"
|
local body="$2"
|
||||||
local h=$3
|
local h=$3
|
||||||
@ -74,7 +78,8 @@ checkbox() {
|
|||||||
printf "%s" "$response"
|
printf "%s" "$response"
|
||||||
}
|
}
|
||||||
|
|
||||||
getinput() {
|
getinput()
|
||||||
|
{
|
||||||
local answer
|
local answer
|
||||||
if ! answer="$(dialog --cr-wrap --max-input 63 --stdout --no-cancel --backtitle "$BT" --title " $1 " --inputbox "$2" 0 0 "$3")" || [[ $answer == '' ]]; then
|
if ! answer="$(dialog --cr-wrap --max-input 63 --stdout --no-cancel --backtitle "$BT" --title " $1 " --inputbox "$2" 0 0 "$3")" || [[ $answer == '' ]]; then
|
||||||
return 1
|
return 1
|
||||||
@ -82,14 +87,16 @@ getinput() {
|
|||||||
printf "%s" "$answer"
|
printf "%s" "$answer"
|
||||||
}
|
}
|
||||||
|
|
||||||
infobox() {
|
infobox()
|
||||||
|
{
|
||||||
local sec="$3"
|
local sec="$3"
|
||||||
tput civis
|
tput civis
|
||||||
dialog --cr-wrap --backtitle "$BT" --title " $1 " --infobox "$2\n" 0 0
|
dialog --cr-wrap --backtitle "$BT" --title " $1 " --infobox "$2\n" 0 0
|
||||||
sleep ${sec:-2}
|
sleep ${sec:-2}
|
||||||
}
|
}
|
||||||
|
|
||||||
yesno() {
|
yesno()
|
||||||
|
{
|
||||||
# usage: yesno <title> <text> [<yes_label> <no_label> [<no>]]
|
# usage: yesno <title> <text> [<yes_label> <no_label> [<no>]]
|
||||||
# three options: one --default-no and custom labels, one just custom labels, and one basic.
|
# three options: one --default-no and custom labels, one just custom labels, and one basic.
|
||||||
tput civis
|
tput civis
|
||||||
@ -106,7 +113,8 @@ yesno() {
|
|||||||
|
|
||||||
# larger specific dialog menus
|
# larger specific dialog menus
|
||||||
|
|
||||||
select_language() {
|
select_language()
|
||||||
|
{
|
||||||
tput civis
|
tput civis
|
||||||
local lang
|
local lang
|
||||||
local title="\nLanguage - sprache - taal - språk - lingua - idioma - nyelv - língua\n"
|
local title="\nLanguage - sprache - taal - språk - lingua - idioma - nyelv - língua\n"
|
||||||
@ -145,7 +153,8 @@ select_language() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
user_creation() {
|
user_creation()
|
||||||
|
{
|
||||||
tput cnorm
|
tput cnorm
|
||||||
local values
|
local values
|
||||||
if ! values="$(dialog --stdout --no-cancel --separator '~' --ok-label "Submit" --backtitle "$BT" \
|
if ! values="$(dialog --stdout --no-cancel --separator '~' --ok-label "Submit" --backtitle "$BT" \
|
||||||
@ -211,7 +220,8 @@ user_creation() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
select_keymap() {
|
select_keymap()
|
||||||
|
{
|
||||||
tput civis
|
tput civis
|
||||||
if ! KEYMAP="$(menubox "$_PrepLayout" "$_XMapBody" 20 70 12 \
|
if ! KEYMAP="$(menubox "$_PrepLayout" "$_XMapBody" 20 70 12 \
|
||||||
'us' 'English' 'cm' 'English' 'gb' 'English' 'au' 'English' 'gh' 'English' \
|
'us' 'English' 'cm' 'English' 'gb' 'English' 'au' 'English' 'gh' 'English' \
|
||||||
@ -254,7 +264,8 @@ select_keymap() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
select_timezone() {
|
select_timezone()
|
||||||
|
{
|
||||||
# create associative array for SUBZONES[zone]
|
# create associative array for SUBZONES[zone]
|
||||||
local f="/usr/share/zoneinfo/zone.tab"
|
local f="/usr/share/zoneinfo/zone.tab"
|
||||||
declare -A SUBZONES
|
declare -A SUBZONES
|
||||||
@ -276,7 +287,8 @@ select_timezone() {
|
|||||||
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()
|
||||||
|
{
|
||||||
declare -g PACKAGES=""
|
declare -g PACKAGES=""
|
||||||
|
|
||||||
tput civis
|
tput civis
|
||||||
@ -348,7 +360,8 @@ select_wm_or_de() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
select_login_method() {
|
select_login_method()
|
||||||
|
{
|
||||||
if ! LOGIN_TYPE="$(menubox "$_WMLogin" "$_LoginTypeBody" 0 0 0 \
|
if ! LOGIN_TYPE="$(menubox "$_WMLogin" "$_LoginTypeBody" 0 0 0 \
|
||||||
"xinit" "Console login without a display manager" \
|
"xinit" "Console login without a display manager" \
|
||||||
"lightdm" "Lightweight display manager with a gtk greeter")"; then
|
"lightdm" "Lightweight display manager with a gtk greeter")"; then
|
||||||
@ -362,7 +375,8 @@ select_login_method() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
select_packages() {
|
select_packages()
|
||||||
|
{
|
||||||
if [[ $CURRENT_MENU != "packages" ]]; then
|
if [[ $CURRENT_MENU != "packages" ]]; then
|
||||||
declare -g SAVED=$SELECTED
|
declare -g SAVED=$SELECTED
|
||||||
SELECTED=1
|
SELECTED=1
|
||||||
@ -402,7 +416,8 @@ select_packages() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
select_mirrorcmd() {
|
select_mirrorcmd()
|
||||||
|
{
|
||||||
local ip c
|
local ip c
|
||||||
local key="5f29642060ab983b31fdf4c2935d8c56"
|
local key="5f29642060ab983b31fdf4c2935d8c56"
|
||||||
|
|
||||||
@ -444,7 +459,8 @@ select_mirrorcmd() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
display_system_settings() {
|
display_system_settings()
|
||||||
|
{
|
||||||
local cmd mnt pkgs
|
local cmd mnt pkgs
|
||||||
cmd="${BCMDS[$BOOTLDR]}"
|
cmd="${BCMDS[$BOOTLDR]}"
|
||||||
mnt="${BMNTS[$SYS-$BOOTLDR]}"
|
mnt="${BMNTS[$SYS-$BOOTLDR]}"
|
||||||
@ -498,7 +514,8 @@ display_system_settings() {
|
|||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_system_settings() {
|
configure_system_settings()
|
||||||
|
{
|
||||||
tput cnorm
|
tput cnorm
|
||||||
if ! HOSTNAME="$(getinput "$_ConfHost" "$_HostNameBody" "${DIST,,}")"; then
|
if ! HOSTNAME="$(getinput "$_ConfHost" "$_HostNameBody" "${DIST,,}")"; then
|
||||||
return 1
|
return 1
|
||||||
@ -540,7 +557,8 @@ configure_system_settings() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
edit_system_configs() {
|
edit_system_configs()
|
||||||
|
{
|
||||||
if [[ $CURRENT_MENU != "edit" ]]; then
|
if [[ $CURRENT_MENU != "edit" ]]; then
|
||||||
SELECTED=1; CURRENT_MENU="edit"
|
SELECTED=1; CURRENT_MENU="edit"
|
||||||
elif (( SELECTED < 11 )); then
|
elif (( SELECTED < 11 )); then
|
||||||
|
@ -1,19 +1,23 @@
|
|||||||
#!/usr/bin/bash
|
#!/usr/bin/bash
|
||||||
|
|
||||||
# vim:ft=sh:fdm=marker:fmr={,}
|
# vim:ft=sh:fdm=marker:fmr={,}
|
||||||
# shellcheck disable=2153
|
|
||||||
|
|
||||||
# archlabs installer library script file
|
# archlabs installer library script file
|
||||||
# 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=2153
|
||||||
|
|
||||||
readonly RUN="/run/archiso/bootmnt/arch/boot"
|
readonly RUN="/run/archiso/bootmnt/arch/boot"
|
||||||
readonly VM="$(dmesg | grep -i "hypervisor")"
|
readonly VM="$(dmesg | grep -i "hypervisor")"
|
||||||
|
|
||||||
install() {
|
install()
|
||||||
# function calls prefixed with 'oneshot' will only ever be run once
|
{
|
||||||
# otherwise the main function can be called repeatedly
|
# NOTE: function calls prefixed with 'oneshot' will only ever be run once
|
||||||
clear; tput cnorm
|
# this allows running install() multiple times without redoing things
|
||||||
|
|
||||||
|
clear
|
||||||
|
tput cnorm
|
||||||
|
|
||||||
# unpack the file system
|
# unpack the file system
|
||||||
oneshot install_base
|
oneshot install_base
|
||||||
@ -52,11 +56,14 @@ install() {
|
|||||||
edit_system_configs
|
edit_system_configs
|
||||||
}
|
}
|
||||||
|
|
||||||
install_base() {
|
install_base()
|
||||||
|
{
|
||||||
|
# compressed image?
|
||||||
if [[ -e /run/archiso/sfs/airootfs/ ]]; then
|
if [[ -e /run/archiso/sfs/airootfs/ ]]; then
|
||||||
printf "\nUnpacking base system --- Total: ~ 2.9G\n\n"
|
printf "\nUnpacking base system --- Total: ~ 2.9G\n\n"
|
||||||
rsync -ah --info=progress2 /run/archiso/sfs/airootfs/ $MNT/
|
rsync -ah --info=progress2 /run/archiso/sfs/airootfs/ $MNT/
|
||||||
else
|
else
|
||||||
|
|
||||||
# update the mirrorlist.. MUST be done before pacstrapping or it may be slow
|
# update the mirrorlist.. MUST be done before pacstrapping or it may be slow
|
||||||
oneshot mirrorlist_sort
|
oneshot mirrorlist_sort
|
||||||
|
|
||||||
@ -108,7 +115,8 @@ EOF
|
|||||||
[[ -e /etc/NetworkManager/system-connections ]] && cp -rf /etc/NetworkManager/system-connections $MNT/etc/NetworkManager/
|
[[ -e /etc/NetworkManager/system-connections ]] && cp -rf /etc/NetworkManager/system-connections $MNT/etc/NetworkManager/
|
||||||
cp -f /etc/resolv.conf $MNT/etc/
|
cp -f /etc/resolv.conf $MNT/etc/
|
||||||
|
|
||||||
# set the locale and timezone
|
|
||||||
|
# set the locale
|
||||||
cat > $MNT/etc/locale.conf << EOF
|
cat > $MNT/etc/locale.conf << EOF
|
||||||
LANG=$LOCALE
|
LANG=$LOCALE
|
||||||
EOF
|
EOF
|
||||||
@ -117,8 +125,12 @@ 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
|
||||||
chrun "locale-gen" 2>/dev/null
|
chrun "locale-gen" 2>/dev/null
|
||||||
|
|
||||||
|
|
||||||
|
# set the timezone
|
||||||
chrun "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
|
||||||
# Use localectl(1) to instruct systemd-localed to update it.
|
# Use localectl(1) to instruct systemd-localed to update it.
|
||||||
@ -137,11 +149,15 @@ XKBVARIANT=""
|
|||||||
XKBOPTIONS=""
|
XKBOPTIONS=""
|
||||||
BACKSPACE="guess"
|
BACKSPACE="guess"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
||||||
# console keymap
|
# console keymap
|
||||||
cat > $MNT/etc/vconsole.conf <<EOF
|
cat > $MNT/etc/vconsole.conf <<EOF
|
||||||
KEYMAP=$CMAP
|
KEYMAP=$CMAP
|
||||||
FONT=$FONT
|
FONT=$FONT
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
||||||
# set the hostname
|
# set the hostname
|
||||||
cat > $MNT/etc/hostname << EOF
|
cat > $MNT/etc/hostname << EOF
|
||||||
$HOSTNAME
|
$HOSTNAME
|
||||||
@ -153,27 +169,31 @@ EOF
|
|||||||
ff02::1 ip6-allnodes
|
ff02::1 ip6-allnodes
|
||||||
ff02::2 ip6-allrouters
|
ff02::2 ip6-allrouters
|
||||||
EOF
|
EOF
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
create_user() {
|
create_user()
|
||||||
|
{
|
||||||
# set root password
|
# set root password
|
||||||
chrun "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")'"
|
||||||
|
|
||||||
# Create the user, set password, then remove temporary password file
|
|
||||||
local groups='audio,autologin,floppy,log,network,rfkill,scanner,storage,optical,power,wheel'
|
local groups='audio,autologin,floppy,log,network,rfkill,scanner,storage,optical,power,wheel'
|
||||||
|
|
||||||
|
# setup the autologin group
|
||||||
chrun "groupadd -r autologin"
|
chrun "groupadd -r autologin"
|
||||||
|
|
||||||
|
# Create the user, set password, and make sure the ownership of ~/ is correct
|
||||||
chrun "useradd -m -u 1000 -g users -G $groups -s $MYSHELL $NEWUSER" 2>$ERR
|
chrun "useradd -m -u 1000 -g users -G $groups -s $MYSHELL $NEWUSER" 2>$ERR
|
||||||
chrun "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")'"
|
||||||
chrun "chown -Rf $NEWUSER:users /home/$NEWUSER"
|
chrun "chown -Rf $NEWUSER:users /home/$NEWUSER"
|
||||||
|
|
||||||
# remove welcome message
|
# remove configs for window managers that were never installed
|
||||||
[[ $INSTALL_WMS =~ i3-gaps ]] || rm -rf $MNT/home/$NEWUSER/.config/i3
|
[[ $INSTALL_WMS =~ i3-gaps ]] || rm -rf $MNT/home/$NEWUSER/.config/i3
|
||||||
[[ $INSTALL_WMS =~ bspwm ]] || rm -rf $MNT/home/$NEWUSER/.config/{bspwm,sxhkd}
|
[[ $INSTALL_WMS =~ bspwm ]] || rm -rf $MNT/home/$NEWUSER/.config/{bspwm,sxhkd}
|
||||||
[[ $INSTALL_WMS =~ openbox ]] || rm -rf $MNT/home/$NEWUSER/.config/{openbox,skippy-xd,jgmenu,conky,tint2}
|
[[ $INSTALL_WMS =~ openbox ]] || rm -rf $MNT/home/$NEWUSER/.config/{openbox,skippy-xd,jgmenu,conky,tint2}
|
||||||
[[ $INSTALL_WMS =~ (openbox|i3-gaps|bspwm) ]] || rm -rf $MNT/home/$NEWUSER/.config/polybar
|
[[ $INSTALL_WMS =~ (openbox|i3-gaps|bspwm) ]] || rm -rf $MNT/home/$NEWUSER/.config/polybar
|
||||||
|
|
||||||
# for neovim copy the default vimrc and colorscheme to ~/.config/nvim
|
# for neovim set up ~/.config/nvim
|
||||||
if [[ $PACKAGES =~ neovim ]]; then
|
if [[ $PACKAGES =~ neovim ]]; then
|
||||||
mkdir -p $MNT/home/$NEWUSER/.config/nvim
|
mkdir -p $MNT/home/$NEWUSER/.config/nvim
|
||||||
cp -f $MNT/home/$NEWUSER/.vimrc $MNT/home/$NEWUSER/.config/nvim/init.vim
|
cp -f $MNT/home/$NEWUSER/.vimrc $MNT/home/$NEWUSER/.config/nvim/init.vim
|
||||||
@ -184,15 +204,19 @@ create_user() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
login_manager() {
|
login_manager()
|
||||||
|
{
|
||||||
local service="$MNT/etc/systemd/system/getty@tty1.service.d"
|
local service="$MNT/etc/systemd/system/getty@tty1.service.d"
|
||||||
|
|
||||||
# remove welcome message
|
# remove welcome message
|
||||||
sed -i '/printf/d' $MNT/root/.zshrc
|
sed -i '/printf/d' $MNT/root/.zshrc
|
||||||
|
|
||||||
|
|
||||||
if [[ $LOGIN_TYPE == 'lightdm' ]]; then
|
if [[ $LOGIN_TYPE == 'lightdm' ]]; then
|
||||||
|
|
||||||
rm -rf $service
|
rm -rf $service
|
||||||
chrun '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
|
||||||
|
|
||||||
@ -205,8 +229,9 @@ icon-theme-name=Adwaita
|
|||||||
font-name=DejaVu Sans Mono 11
|
font-name=DejaVu Sans Mono 11
|
||||||
position=30%,end 50%,end
|
position=30%,end 50%,end
|
||||||
EOF
|
EOF
|
||||||
else
|
|
||||||
# xinit login
|
else # xinit login
|
||||||
|
|
||||||
if [[ -e $MNT/home/$NEWUSER/.xinitrc ]]; then
|
if [[ -e $MNT/home/$NEWUSER/.xinitrc ]]; then
|
||||||
sed -i "s/openbox-session/${LOGIN_WM}/g" $MNT/home/$NEWUSER/.xinitrc
|
sed -i "s/openbox-session/${LOGIN_WM}/g" $MNT/home/$NEWUSER/.xinitrc
|
||||||
else
|
else
|
||||||
@ -214,8 +239,14 @@ EOF
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# automatic startx for login shells
|
# automatic startx for login shells
|
||||||
[[ $MYSHELL == '/bin/bash' ]] && local loginrc=".bash_profile" || local loginrc=".zprofile"
|
case $MYSHELL in
|
||||||
EDIT_FILES[11]+="/home/$NEWUSER/$loginrc"
|
/bin/bash) local loginrc=".bash_profile" ;;
|
||||||
|
/usr/bin/zsh) local loginrc=".zprofile" ;;
|
||||||
|
/usr/bin/mksh) local loginrc=".profile" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# add the shell login file to the edit list after install
|
||||||
|
EDIT_FILES[11]+=" /home/$NEWUSER/$loginrc"
|
||||||
|
|
||||||
cat >> $MNT/home/$NEWUSER/$loginrc << EOF
|
cat >> $MNT/home/$NEWUSER/$loginrc << EOF
|
||||||
# ~/$loginrc
|
# ~/$loginrc
|
||||||
@ -234,7 +265,8 @@ EOF
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
run_mkinitcpio() {
|
run_mkinitcpio()
|
||||||
|
{
|
||||||
local add=""
|
local add=""
|
||||||
# setup a keyfile for LUKS.. Only when choosing grub and system is UEFI
|
# setup a keyfile for LUKS.. Only when choosing grub and system is UEFI
|
||||||
[[ $LUKS && ! $LVM && $SYS == 'UEFI' && $BOOTLDR == 'grub' ]] && luks_keyfile
|
[[ $LUKS && ! $LVM && $SYS == 'UEFI' && $BOOTLDR == 'grub' ]] && luks_keyfile
|
||||||
@ -248,7 +280,8 @@ run_mkinitcpio() {
|
|||||||
echeck "mkinitcpio -p $KERNEL"
|
echeck "mkinitcpio -p $KERNEL"
|
||||||
}
|
}
|
||||||
|
|
||||||
mirrorlist_sort() {
|
mirrorlist_sort()
|
||||||
|
{
|
||||||
printf "\n\n%s\n\n" "Sorting the mirrorlist"
|
printf "\n\n%s\n\n" "Sorting the mirrorlist"
|
||||||
if hash reflector >/dev/null 2>&1; then
|
if hash reflector >/dev/null 2>&1; then
|
||||||
$MIRROR_CMD --save $MNT/etc/pacman.d/mirrorlist --verbose ||
|
$MIRROR_CMD --save $MNT/etc/pacman.d/mirrorlist --verbose ||
|
||||||
@ -259,19 +292,24 @@ mirrorlist_sort() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
package_operations() {
|
package_operations()
|
||||||
|
{
|
||||||
local inpkg="$PACKAGES" # add the packages chosen during setup
|
local inpkg="$PACKAGES" # add the packages chosen during setup
|
||||||
local rmpkg="archlabs-installer" # always remove the installer
|
local rmpkg="archlabs-installer" # always remove the installer
|
||||||
|
|
||||||
# the LTS kernel uses different packages
|
|
||||||
if [[ $KERNEL == 'linux-lts' ]]; then
|
if [[ $KERNEL == 'linux-lts' ]]; then
|
||||||
rmpkg+=" virtualbox-guest-modules-arch linux"
|
rmpkg+=" linux"
|
||||||
inpkg+=" linux-lts"
|
inpkg+=" linux-lts"
|
||||||
# if the system is a VM then install the needed packages otherwise remove the guest utils
|
fi
|
||||||
[[ $VM ]] && inpkg+=" virtualbox-guest-dkms linux-lts-headers" || rmpkg+=" virtualbox-guest-utils"
|
|
||||||
|
# if the system is a VM then install the needed packages
|
||||||
|
if [[ $VM ]]; then
|
||||||
|
inpkg+=" virtualbox-guest-utils"
|
||||||
|
if [[ $KERNEL == 'linux-lts' ]]; then
|
||||||
|
inpkg+=" virtualbox-guest-dkms linux-lts-headers"
|
||||||
else
|
else
|
||||||
# if the system is not a VM then remove the guest utils
|
inpkg+=" virtualbox-guest-modules-arch"
|
||||||
[[ $VM ]] || rmpkg+=" virtualbox-guest-modules-arch virtualbox-guest-utils"
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# for only gnome or cinnamon we don't need the xfce provided stuff
|
# for only gnome or cinnamon we don't need the xfce provided stuff
|
||||||
@ -295,7 +333,8 @@ package_operations() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
suckless_install() {
|
suckless_install()
|
||||||
|
{
|
||||||
# install and setup dwm
|
# install and setup dwm
|
||||||
printf "\n\n%s\n\n" "Installing and setting up dwm."
|
printf "\n\n%s\n\n" "Installing and setting up dwm."
|
||||||
mkdir -pv $MNT/home/$NEWUSER/suckless
|
mkdir -pv $MNT/home/$NEWUSER/suckless
|
||||||
|
@ -15,7 +15,8 @@ declare -g LUKS_PASS=""
|
|||||||
declare -g LUKS_UUID=""
|
declare -g LUKS_UUID=""
|
||||||
declare -g LUKS_NAME="cryptroot"
|
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
|
||||||
umount_dir $MNT
|
umount_dir $MNT
|
||||||
@ -44,7 +45,8 @@ luks_open() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
luks_pass() {
|
luks_pass()
|
||||||
|
{
|
||||||
local title="$1"
|
local title="$1"
|
||||||
local name="$2"
|
local name="$2"
|
||||||
LUKS_PASS=""
|
LUKS_PASS=""
|
||||||
@ -86,7 +88,8 @@ luks_pass() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
luks_setup() {
|
luks_setup()
|
||||||
|
{
|
||||||
LUKS_PART=""
|
LUKS_PART=""
|
||||||
modprobe -a dm-mod dm_crypt
|
modprobe -a dm-mod dm_crypt
|
||||||
umount_dir $MNT
|
umount_dir $MNT
|
||||||
@ -114,7 +117,8 @@ luks_setup() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
luks_default() {
|
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
|
||||||
|
|
||||||
@ -129,7 +133,8 @@ luks_default() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
luks_keycmd() {
|
luks_keycmd()
|
||||||
|
{
|
||||||
if luks_setup; then
|
if luks_setup; then
|
||||||
tput cnorm
|
tput cnorm
|
||||||
local cipher
|
local cipher
|
||||||
@ -151,13 +156,15 @@ luks_keycmd() {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
luks_show() {
|
luks_show()
|
||||||
|
{
|
||||||
tput civis
|
tput civis
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
msgbox "$_LuksEncrypt" "${_LuksEncryptSucc}\n$(lsblk $LUKS_PART -o NAME,MODEL,TYPE,FSTYPE,SIZE)"
|
msgbox "$_LuksEncrypt" "${_LuksEncryptSucc}\n$(lsblk $LUKS_PART -o NAME,MODEL,TYPE,FSTYPE,SIZE)"
|
||||||
}
|
}
|
||||||
|
|
||||||
luks_menu() {
|
luks_menu()
|
||||||
|
{
|
||||||
tput civis
|
tput civis
|
||||||
local choice
|
local choice
|
||||||
choice="$(menubox "$_PrepLUKS" "${_LuksMenuBody}${_LuksMenuBody2}${_LuksMenuBody3}" 0 0 0 \
|
choice="$(menubox "$_PrepLUKS" "${_LuksMenuBody}${_LuksMenuBody2}${_LuksMenuBody3}" 0 0 0 \
|
||||||
@ -176,7 +183,8 @@ luks_menu() {
|
|||||||
luks_menu
|
luks_menu
|
||||||
}
|
}
|
||||||
|
|
||||||
luks_keyfile() {
|
luks_keyfile()
|
||||||
|
{
|
||||||
# Only used when choosing grub as bootloader.
|
# Only used when choosing grub as bootloader.
|
||||||
# Without a keyfile, during boot the user will be asked
|
# Without a keyfile, during boot the user will be asked
|
||||||
# to enter password for decryption twice, this is annoying
|
# to enter password for decryption twice, this is annoying
|
||||||
|
@ -12,7 +12,8 @@ declare -g LVM=""
|
|||||||
declare -g VOL_GROUP_MB=0
|
declare -g VOL_GROUP_MB=0
|
||||||
declare -g GROUP_PARTS=0
|
declare -g GROUP_PARTS=0
|
||||||
|
|
||||||
lvm_detect() {
|
lvm_detect()
|
||||||
|
{
|
||||||
PHYSICAL_VOLUMES="$(pvs -o pv_name --noheading 2>/dev/null)"
|
PHYSICAL_VOLUMES="$(pvs -o pv_name --noheading 2>/dev/null)"
|
||||||
VOLUME_GROUP="$(vgs -o vg_name --noheading 2>/dev/null)"
|
VOLUME_GROUP="$(vgs -o vg_name --noheading 2>/dev/null)"
|
||||||
VOLUMES="$(lvs -o vg_name,lv_name --noheading --separator - 2>/dev/null)"
|
VOLUMES="$(lvs -o vg_name,lv_name --noheading --separator - 2>/dev/null)"
|
||||||
@ -28,7 +29,8 @@ lvm_detect() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
lvm_show_vg() {
|
lvm_show_vg()
|
||||||
|
{
|
||||||
DEL_VG=""
|
DEL_VG=""
|
||||||
VOL_GROUP_LIST=""
|
VOL_GROUP_LIST=""
|
||||||
|
|
||||||
@ -48,7 +50,8 @@ lvm_show_vg() {
|
|||||||
return 0
|
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"
|
||||||
@ -98,7 +101,8 @@ get_lv_size() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
lvm_volume_name() {
|
lvm_volume_name()
|
||||||
|
{
|
||||||
local msg="$1"
|
local msg="$1"
|
||||||
|
|
||||||
local default="volmain"
|
local default="volmain"
|
||||||
@ -120,7 +124,8 @@ lvm_volume_name() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
lvm_group_name() {
|
lvm_group_name()
|
||||||
|
{
|
||||||
tput cnorm
|
tput cnorm
|
||||||
local group
|
local group
|
||||||
if ! group="$(getinput "$_LvmCreateVG" "$_LvmNameVgBody" "VolGroup")"; then
|
if ! group="$(getinput "$_LvmCreateVG" "$_LvmNameVgBody" "VolGroup")"; then
|
||||||
@ -137,7 +142,8 @@ lvm_group_name() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
lvm_extra_lvs() {
|
lvm_extra_lvs()
|
||||||
|
{
|
||||||
while (( VOL_COUNT > 1 )); do
|
while (( VOL_COUNT > 1 )); do
|
||||||
# get the name and size
|
# get the name and size
|
||||||
lvm_volume_name "$_LvmLvNameBody1" || { break; return 1; }
|
lvm_volume_name "$_LvmLvNameBody1" || { break; return 1; }
|
||||||
@ -154,7 +160,8 @@ lvm_extra_lvs() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
lvm_volume_count() {
|
lvm_volume_count()
|
||||||
|
{
|
||||||
if ! 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 \
|
||||||
@ -164,7 +171,8 @@ lvm_volume_count() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
lvm_partitions() {
|
lvm_partitions()
|
||||||
|
{
|
||||||
find_partitions 'part|crypt' || return 1
|
find_partitions 'part|crypt' || return 1
|
||||||
PARTS="$(awk 'NF > 0 {print $0 " off"}' <<< "$PARTS")"
|
PARTS="$(awk 'NF > 0 {print $0 " off"}' <<< "$PARTS")"
|
||||||
|
|
||||||
@ -177,7 +185,8 @@ lvm_partitions() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
lvm_create_group() {
|
lvm_create_group()
|
||||||
|
{
|
||||||
# get volume group name
|
# get volume group name
|
||||||
lvm_group_name || return 1
|
lvm_group_name || return 1
|
||||||
|
|
||||||
@ -203,7 +212,8 @@ lvm_create_group() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
lvm_create() {
|
lvm_create()
|
||||||
|
{
|
||||||
VOLUME_GROUP=""
|
VOLUME_GROUP=""
|
||||||
GROUP_PARTS=""
|
GROUP_PARTS=""
|
||||||
VOL_GROUP_MB=0
|
VOL_GROUP_MB=0
|
||||||
@ -230,14 +240,16 @@ lvm_create() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
lvm_del_vg() {
|
lvm_del_vg()
|
||||||
|
{
|
||||||
if lvm_show_vg; then
|
if lvm_show_vg; then
|
||||||
yesno "$_LvmDelVG" "$_LvmDelQ" && vgremove -f "$DEL_VG" >/dev/null 2>&1
|
yesno "$_LvmDelVG" "$_LvmDelQ" && vgremove -f "$DEL_VG" >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
lvm_del_all() {
|
lvm_del_all()
|
||||||
|
{
|
||||||
PHYSICAL_VOLUMES="$(pvs -o pv_name --noheading 2>/dev/null)"
|
PHYSICAL_VOLUMES="$(pvs -o pv_name --noheading 2>/dev/null)"
|
||||||
VOLUME_GROUP="$(vgs -o vg_name --noheading 2>/dev/null)"
|
VOLUME_GROUP="$(vgs -o vg_name --noheading 2>/dev/null)"
|
||||||
VOLUMES="$(lvs -o vg_name,lv_name --noheading --separator - 2>/dev/null)"
|
VOLUMES="$(lvs -o vg_name,lv_name --noheading --separator - 2>/dev/null)"
|
||||||
@ -258,7 +270,8 @@ lvm_del_all() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
lvm_menu() {
|
lvm_menu()
|
||||||
|
{
|
||||||
lvm_detect
|
lvm_detect
|
||||||
tput civis
|
tput civis
|
||||||
|
|
||||||
|
@ -13,7 +13,8 @@ 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 " -"}')"
|
||||||
|
|
||||||
mount_install_partitions() {
|
mount_install_partitions()
|
||||||
|
{
|
||||||
# prepare partition list PARTS for dialog
|
# prepare partition list PARTS for dialog
|
||||||
lvm_detect
|
lvm_detect
|
||||||
umount_dir $MNT
|
umount_dir $MNT
|
||||||
@ -39,7 +40,8 @@ mount_install_partitions() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
select_swap() {
|
select_swap()
|
||||||
|
{
|
||||||
# Ask user to select partition or create swapfile
|
# Ask user to select partition or create swapfile
|
||||||
tput civis
|
tput civis
|
||||||
if ! SWAP_PART="$(menubox "$_SelSwpSetup" "$_SelSwpBody" 0 0 0 \
|
if ! SWAP_PART="$(menubox "$_SelSwpSetup" "$_SelSwpBody" 0 0 0 \
|
||||||
@ -70,7 +72,8 @@ select_swap() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
select_mountpoint() {
|
select_mountpoint()
|
||||||
|
{
|
||||||
tput cnorm
|
tput cnorm
|
||||||
if ! EXTRA_MNT="$(getinput "$_PrepMount $part" "$_ExtPartBody1 /home /var\n" "/")"; then
|
if ! EXTRA_MNT="$(getinput "$_PrepMount $part" "$_ExtPartBody1 /home /var\n" "/")"; then
|
||||||
return 1
|
return 1
|
||||||
@ -84,7 +87,8 @@ select_mountpoint() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
select_boot_setup() {
|
select_boot_setup()
|
||||||
|
{
|
||||||
# choose bootloader and mountpoint (if needed)
|
# choose bootloader and mountpoint (if needed)
|
||||||
tput civis
|
tput civis
|
||||||
if ! BOOTLDR="$(menubox "$_PrepMount" "$_MntBootBody" 0 0 0 ${BOOTLDRS[$SYS]})"; then
|
if ! BOOTLDR="$(menubox "$_PrepMount" "$_MntBootBody" 0 0 0 ${BOOTLDRS[$SYS]})"; then
|
||||||
@ -132,7 +136,8 @@ select_boot_setup() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
select_mount_opts() {
|
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"
|
||||||
@ -152,7 +157,8 @@ select_mount_opts() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
select_filesystem() {
|
select_filesystem()
|
||||||
|
{
|
||||||
local part="$1"
|
local part="$1"
|
||||||
local fs cur_fs str title
|
local fs cur_fs str title
|
||||||
cur_fs="$(lsblk -lno FSTYPE $part)"
|
cur_fs="$(lsblk -lno FSTYPE $part)"
|
||||||
@ -177,7 +183,8 @@ select_filesystem() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
select_efi_partition() {
|
select_efi_partition()
|
||||||
|
{
|
||||||
tput civis
|
tput civis
|
||||||
if (( COUNT == 1 )); then
|
if (( COUNT == 1 )); then
|
||||||
BOOT_PART="$(awk 'NF > 0 {print $1}' <<< "$PARTS")"
|
BOOT_PART="$(awk 'NF > 0 {print $1}' <<< "$PARTS")"
|
||||||
@ -198,7 +205,8 @@ select_efi_partition() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
select_boot_partition() {
|
select_boot_partition()
|
||||||
|
{
|
||||||
tput civis
|
tput civis
|
||||||
if ! BOOT_PART="$(menubox "$_PrepMount" "$_SelBiosBody" 0 0 0 "$_Skip" "-" $PARTS)" || [[ $BOOT_PART == "$_Skip" ]]; then
|
if ! BOOT_PART="$(menubox "$_PrepMount" "$_SelBiosBody" 0 0 0 "$_Skip" "-" $PARTS)" || [[ $BOOT_PART == "$_Skip" ]]; then
|
||||||
BOOT_PART=""
|
BOOT_PART=""
|
||||||
@ -213,7 +221,8 @@ select_boot_partition() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
select_root_partition() {
|
select_root_partition()
|
||||||
|
{
|
||||||
# if we used LUKS and no LVM or LUKS+LVM remove the relevant partition labels from the list
|
# if we used LUKS and no LVM or LUKS+LVM remove the relevant partition labels from the list
|
||||||
if [[ $LUKS && ! $LVM ]]; then
|
if [[ $LUKS && ! $LVM ]]; then
|
||||||
ROOT_PART="/dev/mapper/$LUKS_NAME"
|
ROOT_PART="/dev/mapper/$LUKS_NAME"
|
||||||
@ -242,7 +251,8 @@ select_root_partition() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
select_extra_partitions() {
|
select_extra_partitions()
|
||||||
|
{
|
||||||
while (( COUNT > 0 )); do
|
while (( COUNT > 0 )); do
|
||||||
tput civis
|
tput civis
|
||||||
local part
|
local part
|
||||||
|
@ -27,7 +27,8 @@ declare -gA PKG_EXT=(
|
|||||||
[qutebrowser]="qt5ct qt5-styleplugins"
|
[qutebrowser]="qt5ct qt5-styleplugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
select_browsers() {
|
select_browsers()
|
||||||
|
{
|
||||||
local pkgs=""
|
local pkgs=""
|
||||||
pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \
|
pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \
|
||||||
"firefox" "A popular open-source graphical web browser from Mozilla" off \
|
"firefox" "A popular open-source graphical web browser from Mozilla" off \
|
||||||
@ -38,7 +39,8 @@ select_browsers() {
|
|||||||
printf "%s" "$pkgs"
|
printf "%s" "$pkgs"
|
||||||
}
|
}
|
||||||
|
|
||||||
select_editors() {
|
select_editors()
|
||||||
|
{
|
||||||
local pkgs=""
|
local pkgs=""
|
||||||
pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \
|
pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \
|
||||||
"atom" "An open-source text editor developed by GitHub that is licensed under the MIT License" off \
|
"atom" "An open-source text editor developed by GitHub that is licensed under the MIT License" off \
|
||||||
@ -49,7 +51,8 @@ select_editors() {
|
|||||||
printf "%s" "$pkgs"
|
printf "%s" "$pkgs"
|
||||||
}
|
}
|
||||||
|
|
||||||
select_terminals() {
|
select_terminals()
|
||||||
|
{
|
||||||
local pkgs=""
|
local pkgs=""
|
||||||
pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \
|
pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \
|
||||||
"termite" "A minimal VTE-based terminal emulator" off \
|
"termite" "A minimal VTE-based terminal emulator" off \
|
||||||
@ -61,7 +64,8 @@ select_terminals() {
|
|||||||
printf "%s" "$pkgs"
|
printf "%s" "$pkgs"
|
||||||
}
|
}
|
||||||
|
|
||||||
select_music_and_video() {
|
select_music_and_video()
|
||||||
|
{
|
||||||
local pkgs=""
|
local pkgs=""
|
||||||
pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \
|
pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \
|
||||||
"vlc" "A free and open source cross-platform multimedia player" off \
|
"vlc" "A free and open source cross-platform multimedia player" off \
|
||||||
@ -77,7 +81,8 @@ select_music_and_video() {
|
|||||||
printf "%s" "$pkgs"
|
printf "%s" "$pkgs"
|
||||||
}
|
}
|
||||||
|
|
||||||
select_mail_and_chat() {
|
select_mail_and_chat()
|
||||||
|
{
|
||||||
local pkgs=""
|
local pkgs=""
|
||||||
pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \
|
pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \
|
||||||
"thunderbird" "Standalone mail and news reader from mozilla" off \
|
"thunderbird" "Standalone mail and news reader from mozilla" off \
|
||||||
@ -91,7 +96,8 @@ select_mail_and_chat() {
|
|||||||
printf "%s" "$pkgs"
|
printf "%s" "$pkgs"
|
||||||
}
|
}
|
||||||
|
|
||||||
select_office_and_editing() {
|
select_office_and_editing()
|
||||||
|
{
|
||||||
local pkgs=""
|
local pkgs=""
|
||||||
pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \
|
pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \
|
||||||
"libreoffice-fresh" "Full featured office suite" off \
|
"libreoffice-fresh" "Full featured office suite" off \
|
||||||
@ -109,7 +115,8 @@ select_office_and_editing() {
|
|||||||
printf "%s" "$pkgs"
|
printf "%s" "$pkgs"
|
||||||
}
|
}
|
||||||
|
|
||||||
select_managment() {
|
select_managment()
|
||||||
|
{
|
||||||
local pkgs=""
|
local pkgs=""
|
||||||
pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \
|
pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \
|
||||||
"thunar" "A modern file manager for the Xfce Desktop Environment" off \
|
"thunar" "A modern file manager for the Xfce Desktop Environment" off \
|
||||||
@ -126,7 +133,8 @@ select_managment() {
|
|||||||
printf "%s" "$pkgs"
|
printf "%s" "$pkgs"
|
||||||
}
|
}
|
||||||
|
|
||||||
select_extra() {
|
select_extra()
|
||||||
|
{
|
||||||
local pkgs=""
|
local pkgs=""
|
||||||
pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \
|
pkgs="$(checkbox "$_Packages" "$_PackageBody" 0 0 0 \
|
||||||
"steam" "A popular game distribution platform by Valve" off \
|
"steam" "A popular game distribution platform by Valve" off \
|
||||||
|
@ -23,13 +23,15 @@ declare -Agr FS_OPTS=([vfat]="" [ntfs]="" [ext2]="" [ext3]=""
|
|||||||
[f2fs]="data_flush - off disable_roll_forward - off disable_ext_identify - off discard - off fastboot - off flush_merge - off inline_xattr - off inline_data - off inline_dentry - off no_heap - off noacl - off nobarrier - off noextent_cache - off noinline_data - off norecovery - off"
|
[f2fs]="data_flush - off disable_roll_forward - off disable_ext_identify - off discard - off fastboot - off flush_merge - off inline_xattr - off inline_data - off inline_dentry - off no_heap - off noacl - off nobarrier - off noextent_cache - off noinline_data - off norecovery - off"
|
||||||
)
|
)
|
||||||
|
|
||||||
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
|
||||||
echeck "${FS_CMDS[$2]} $1"
|
echeck "${FS_CMDS[$2]} $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
partition() {
|
partition()
|
||||||
|
{
|
||||||
local device
|
local device
|
||||||
if [[ $# -eq 0 ]]; then
|
if [[ $# -eq 0 ]]; then
|
||||||
select_device 'root' || return 1
|
select_device 'root' || return 1
|
||||||
@ -61,7 +63,8 @@ partition() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
decr_count() {
|
decr_count()
|
||||||
|
{
|
||||||
# remove a partition from the dialog list and decrement the number partitions left
|
# remove a partition from the dialog list and decrement the number partitions left
|
||||||
(( $# == 1 )) || return 1
|
(( $# == 1 )) || return 1
|
||||||
|
|
||||||
@ -71,7 +74,8 @@ decr_count() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
enable_swap() {
|
enable_swap()
|
||||||
|
{
|
||||||
if [[ $1 == "$MNT/swapfile" && $SWAP_SIZE ]]; then
|
if [[ $1 == "$MNT/swapfile" && $SWAP_SIZE ]]; then
|
||||||
fallocate -l $SWAP_SIZE $1 2>$ERR
|
fallocate -l $SWAP_SIZE $1 2>$ERR
|
||||||
echeck "fallocate -l $SWAP_SIZE $1"
|
echeck "fallocate -l $SWAP_SIZE $1"
|
||||||
@ -85,7 +89,8 @@ enable_swap() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
device_tree() {
|
device_tree()
|
||||||
|
{
|
||||||
tput civis
|
tput civis
|
||||||
local msg
|
local msg
|
||||||
if [[ $IGNORE_DEV != "" ]]; then
|
if [[ $IGNORE_DEV != "" ]]; then
|
||||||
@ -98,7 +103,8 @@ device_tree() {
|
|||||||
msgbox "$_PrepShowDev" "$msg"
|
msgbox "$_PrepShowDev" "$msg"
|
||||||
}
|
}
|
||||||
|
|
||||||
select_device() {
|
select_device()
|
||||||
|
{
|
||||||
local dev
|
local dev
|
||||||
local msg
|
local msg
|
||||||
[[ $1 == 'boot' ]] && msg="$_DevSelTitle for bootloader\n" || umount_dir $MNT
|
[[ $1 == 'boot' ]] && msg="$_DevSelTitle for bootloader\n" || umount_dir $MNT
|
||||||
@ -121,7 +127,8 @@ select_device() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
confirm_mount() {
|
confirm_mount()
|
||||||
|
{
|
||||||
local part="$1"
|
local part="$1"
|
||||||
local mount="$2"
|
local mount="$2"
|
||||||
local msg="Partition: $part\n"
|
local msg="Partition: $part\n"
|
||||||
@ -135,7 +142,8 @@ confirm_mount() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
check_cryptlvm() {
|
check_cryptlvm()
|
||||||
|
{
|
||||||
local dev=""
|
local dev=""
|
||||||
local part="$1"
|
local part="$1"
|
||||||
local devs
|
local devs
|
||||||
@ -182,7 +190,8 @@ check_cryptlvm() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
auto_partition() {
|
auto_partition()
|
||||||
|
{
|
||||||
local device="$1"
|
local device="$1"
|
||||||
local size
|
local size
|
||||||
size=$(lsblk -lno SIZE $device | awk 'NR == 1 {
|
size=$(lsblk -lno SIZE $device | awk 'NR == 1 {
|
||||||
@ -246,7 +255,8 @@ auto_partition() {
|
|||||||
msgbox "$_PrepParts" "\nAuto partitioning complete.\n\n$(lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE $device)"
|
msgbox "$_PrepParts" "\nAuto partitioning complete.\n\n$(lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE $device)"
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_partition() {
|
mount_partition()
|
||||||
|
{
|
||||||
local part="$1"
|
local part="$1"
|
||||||
local mountp="${MNT}$2"
|
local mountp="${MNT}$2"
|
||||||
local fs
|
local fs
|
||||||
@ -267,7 +277,8 @@ mount_partition() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
find_partitions() {
|
find_partitions()
|
||||||
|
{
|
||||||
local str="$1"
|
local str="$1"
|
||||||
local err=''
|
local err=''
|
||||||
|
|
||||||
@ -300,7 +311,8 @@ find_partitions() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_boot_device() {
|
setup_boot_device()
|
||||||
|
{
|
||||||
[[ $BOOT_PART = /dev/nvme* ]] && BOOT_DEVICE="${BOOT_PART%p[1-9]}" ||
|
[[ $BOOT_PART = /dev/nvme* ]] && BOOT_DEVICE="${BOOT_PART%p[1-9]}" ||
|
||||||
BOOT_DEVICE="${BOOT_PART%[1-9]}"
|
BOOT_DEVICE="${BOOT_PART%[1-9]}"
|
||||||
BOOT_PART_NUM="${BOOT_PART: -1}"
|
BOOT_PART_NUM="${BOOT_PART: -1}"
|
||||||
|
@ -8,23 +8,27 @@
|
|||||||
|
|
||||||
# shellcheck disable=2154
|
# shellcheck disable=2154
|
||||||
|
|
||||||
chrun() {
|
chrun()
|
||||||
|
{
|
||||||
# run a shell command in the chroot dir $MNT
|
# run a shell command in the chroot dir $MNT
|
||||||
arch-chroot $MNT /bin/bash -c "$1"
|
arch-chroot $MNT /bin/bash -c "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
json() {
|
json()
|
||||||
|
{
|
||||||
# get a value from http://api.ipstack.com in json format using my API key
|
# get a value from http://api.ipstack.com in json format using my API key
|
||||||
# this includes: ip, geolocation, country name
|
# this includes: ip, geolocation, country name
|
||||||
curl -s "http://api.ipstack.com/$2" | python3 -c "import sys, json; print(json.load(sys.stdin)['$1'])"
|
curl -s "http://api.ipstack.com/$2" | python3 -c "import sys, json; print(json.load(sys.stdin)['$1'])"
|
||||||
}
|
}
|
||||||
|
|
||||||
src() {
|
src()
|
||||||
|
{
|
||||||
# source a file ($1), if it fails we die with an error message
|
# source a file ($1), if it fails we die with an error message
|
||||||
. "$1" || { printf "\nFailed to source file %s\n" "$1"; die 1; }
|
. "$1" || { printf "\nFailed to source file %s\n" "$1"; die 1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
ssd() {
|
ssd()
|
||||||
|
{
|
||||||
# returns 0 (true) when the device passed ($1) is NOT a rotational device
|
# returns 0 (true) when the device passed ($1) is NOT a rotational device
|
||||||
local dev=$1
|
local dev=$1
|
||||||
dev=${dev#/dev/}
|
dev=${dev#/dev/}
|
||||||
@ -32,7 +36,8 @@ ssd() {
|
|||||||
[[ $(cat /sys/block/$dev/queue/rotational) -eq 0 ]] || return 1
|
[[ $(cat /sys/block/$dev/queue/rotational) -eq 0 ]] || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
die() {
|
die()
|
||||||
|
{
|
||||||
# die peacefully
|
# die peacefully
|
||||||
local exitcode=0
|
local exitcode=0
|
||||||
(( $# == 0 )) || exitcode=$1
|
(( $# == 0 )) || exitcode=$1
|
||||||
@ -52,13 +57,15 @@ die() {
|
|||||||
exit $exitcode
|
exit $exitcode
|
||||||
}
|
}
|
||||||
|
|
||||||
sigint() {
|
sigint()
|
||||||
|
{
|
||||||
# used to trap SIGINT and cleanly exit the program
|
# used to trap SIGINT and cleanly exit the program
|
||||||
printf "\n** CTRL-C caught"
|
printf "\n** CTRL-C caught"
|
||||||
die 1
|
die 1
|
||||||
}
|
}
|
||||||
|
|
||||||
print4() {
|
print4()
|
||||||
|
{
|
||||||
# takes an arbitrary number of input fields and prints them out in fourths on separate lines
|
# takes an arbitrary number of input fields and prints them out in fourths on separate lines
|
||||||
local str="$*"
|
local str="$*"
|
||||||
if [[ ${#str} -gt $(( ${COLUMNS:-$(tput cols)} / 2 )) ]]; then
|
if [[ ${#str} -gt $(( ${COLUMNS:-$(tput cols)} / 2 )) ]]; then
|
||||||
@ -87,14 +94,16 @@ print4() {
|
|||||||
printf "%s\n" "$str"
|
printf "%s\n" "$str"
|
||||||
}
|
}
|
||||||
|
|
||||||
oneshot() {
|
oneshot()
|
||||||
|
{
|
||||||
[[ -e /tmp/.ai_$1 || ! $(type $1) ]] && return 0
|
[[ -e /tmp/.ai_$1 || ! $(type $1) ]] && return 0
|
||||||
$1 || return 1
|
$1 || return 1
|
||||||
touch "/tmp/.ai_$1"
|
touch "/tmp/.ai_$1"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
system_devices() {
|
system_devices()
|
||||||
|
{
|
||||||
IGNORE_DEV="$(lsblk -lno NAME,MOUNTPOINT | awk '/\/run\/archiso\/bootmnt/ {sub(/[1-9]/, ""); print $1}')"
|
IGNORE_DEV="$(lsblk -lno NAME,MOUNTPOINT | awk '/\/run\/archiso\/bootmnt/ {sub(/[1-9]/, ""); print $1}')"
|
||||||
if [[ $IGNORE_DEV ]]; then
|
if [[ $IGNORE_DEV ]]; then
|
||||||
SYS_DEVS="$(lsblk -lno NAME,SIZE,TYPE | awk '/disk/ && !'"/$IGNORE_DEV/"' {print "/dev/" $1 " " $2}')"
|
SYS_DEVS="$(lsblk -lno NAME,SIZE,TYPE | awk '/disk/ && !'"/$IGNORE_DEV/"' {print "/dev/" $1 " " $2}')"
|
||||||
@ -105,7 +114,8 @@ system_devices() {
|
|||||||
declare -grx SYS_DEVS IGNORE_DEV DEV_COUNT
|
declare -grx SYS_DEVS IGNORE_DEV DEV_COUNT
|
||||||
}
|
}
|
||||||
|
|
||||||
system_identify() {
|
system_identify()
|
||||||
|
{
|
||||||
declare -g IS_64BIT=false
|
declare -g IS_64BIT=false
|
||||||
local efidir="/sys/firmware/efi"
|
local efidir="/sys/firmware/efi"
|
||||||
|
|
||||||
@ -129,11 +139,13 @@ system_identify() {
|
|||||||
SYS="BIOS"
|
SYS="BIOS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# shellcheck disable=2034
|
||||||
declare -g BT="$DIST Installer - $SYS (x86_64) - Version $VER"
|
declare -g BT="$DIST Installer - $SYS (x86_64) - Version $VER"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
system_checks() {
|
system_checks()
|
||||||
|
{
|
||||||
[[ $(whoami) == "root" ]] || { infobox "$_ErrTitle" "$_NotRoot\n$_Exit" && die 1; }
|
[[ $(whoami) == "root" ]] || { infobox "$_ErrTitle" "$_NotRoot\n$_Exit" && die 1; }
|
||||||
grep -qw 'lm' /proc/cpuinfo || { infobox "$_ErrTitle" "$_Not64Bit\n$_Exit" && die 1; }
|
grep -qw 'lm' /proc/cpuinfo || { infobox "$_ErrTitle" "$_Not64Bit\n$_Exit" && die 1; }
|
||||||
|
|
||||||
@ -152,7 +164,8 @@ system_checks() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
preinstall_checks() {
|
preinstall_checks()
|
||||||
|
{
|
||||||
[[ $(lsblk -o MOUNTPOINT) =~ $MNT ]] || { msgbox "$_ErrTitle" "$_ErrNoMount"; export SELECTED=4; return 1; }
|
[[ $(lsblk -o MOUNTPOINT) =~ $MNT ]] || { msgbox "$_ErrTitle" "$_ErrNoMount"; export SELECTED=4; return 1; }
|
||||||
if [[ $# -eq 1 ]]; then
|
if [[ $# -eq 1 ]]; then
|
||||||
[[ $CONFIG_DONE == true ]] || { msgbox "$_ErrTitle" "$_ErrNoConfig"; export SELECTED=5; return 1; }
|
[[ $CONFIG_DONE == true ]] || { msgbox "$_ErrTitle" "$_ErrNoConfig"; export SELECTED=5; return 1; }
|
||||||
@ -160,7 +173,8 @@ preinstall_checks() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
echeck() {
|
echeck()
|
||||||
|
{
|
||||||
# return if the last process exited normally
|
# return if the last process exited normally
|
||||||
local last_exit_code=$?
|
local last_exit_code=$?
|
||||||
(( last_exit_code == 0 )) && return 0
|
(( last_exit_code == 0 )) && return 0
|
||||||
@ -182,7 +196,8 @@ echeck() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
debug() {
|
debug()
|
||||||
|
{
|
||||||
set -x
|
set -x
|
||||||
exec 3>| $DBG
|
exec 3>| $DBG
|
||||||
BASH_XTRACEFD=3
|
BASH_XTRACEFD=3
|
||||||
@ -196,7 +211,8 @@ debug() {
|
|||||||
export DEBUG=true
|
export DEBUG=true
|
||||||
}
|
}
|
||||||
|
|
||||||
umount_dir() {
|
umount_dir()
|
||||||
|
{
|
||||||
swapoff -a
|
swapoff -a
|
||||||
[[ -d $1 ]] && umount -R $1 >/dev/null 2>&1
|
[[ -d $1 ]] && umount -R $1 >/dev/null 2>&1
|
||||||
return 0
|
return 0
|
||||||
|
Reference in New Issue
Block a user