Only ignore usb device that is used for booting
This commit is contained in:
parent
63b8592c28
commit
3c37a64e15
@ -15,29 +15,25 @@
|
||||
# immutable variables {
|
||||
|
||||
readonly DIST="Archlabs" # Linux distributor
|
||||
readonly VER="1.6.31" # Installer version
|
||||
readonly VER="1.6.33" # Installer version
|
||||
readonly LIVE="liveuser" # Live session user
|
||||
readonly TRN="/usr/share/archlabs-installer" # Translation path
|
||||
readonly MNT="/mnt/install" # Install mountpoint
|
||||
readonly ERR="/tmp/errlog" # Built-in error log
|
||||
|
||||
readonly KBD="$(find /usr/share/kbd/keymaps -name '*.map.gz')"
|
||||
readonly SYS_MEM=$(grep 'MemTotal' /proc/meminfo | awk '{print int($2 / 1024)}')
|
||||
readonly SYS_DEVS="$(lsblk -lno NAME,SIZE,TYPE,TRAN | awk '/disk/ && !/usb/ {print "/dev/" $1 " " $2}')"
|
||||
readonly DEV_COUNT="$(wc -l <<< "$SYS_DEVS")"
|
||||
# create a regex string of all usb devices on the system
|
||||
for dev in $(lsblk -lno NAME,TRAN | awk '/usb/ {print $1}'); do USB_DEVS="${dev}$([[ $USB_DEVS ]] && echo -n "|$USB_DEVS")"; done
|
||||
|
||||
# determine which device was used for booting to ignore later during partition select
|
||||
readonly IGNORE_DEV="$(lsblk -lno NAME,TYPE,TRAN,MOUNTPOINT | awk "/$USB_DEVS/"' && /\/run\/archiso\/bootmnt/ {sub(/[1-9]/, ""); print $1}')"
|
||||
readonly SYS_DEVS="$(lsblk -lno NAME,SIZE,TYPE,TRAN | awk '/disk/ && !'"/$IGNORE_DEV/"' {print "/dev/" $1 " " $2}')"
|
||||
readonly LOCALES="$(awk '/\.UTF-8/ {gsub(/# .*|#/, ""); if($1) print $1 " -"}' /etc/locale.gen)"
|
||||
readonly SYS_MEM=$(grep 'MemTotal' /proc/meminfo | awk '{print int($2 / 1024)}')
|
||||
readonly DEV_COUNT="$(wc -l <<< "$SYS_DEVS")"
|
||||
readonly KBD="$(find /usr/share/kbd/keymaps -name '*.map.gz')"
|
||||
readonly CONSOLE_MAPS="$(awk '{gsub(/\.map\.gz|.*\//, ""); print $1 " -"}' <<< "$KBD" | sort -r)"
|
||||
|
||||
# create a regex string of all usb devices on the system
|
||||
# ignore these devices entirely during partition list creation
|
||||
for dev in $(lsblk -lno NAME,TRAN | awk '/usb/ {print $1}'); do
|
||||
USB_DEVS="${dev}$([[ $USB_DEVS ]] && echo -n "|$USB_DEVS")"
|
||||
done
|
||||
|
||||
# static string of zones to avoid loops and subprocess calls
|
||||
readonly ZONES="America - Australia - Asia - Atlantic - Africa - Europe - Indian - Pacific - Arctic - Antarctica -"
|
||||
|
||||
# create associative array for subzones, value is: 'subzone country_code'
|
||||
# create associative array for SUBZONES[zone], value is: 'sub-zone country_code'
|
||||
declare -Ag SUBZONES
|
||||
for zone in America Australia Asia Atlantic Africa Europe Indian Pacific Arctic Antarctica; do
|
||||
SUBZONES[$zone]="$(awk "/$zone\// {gsub(/$zone\//, \"\"); print \$3 \" \"\$1}" /usr/share/zoneinfo/zone.tab)"
|
||||
@ -181,9 +177,9 @@ chroot_cmd() {
|
||||
|
||||
show_devices() {
|
||||
tput civis
|
||||
if [[ $USB_DEVS != "" ]]; then
|
||||
if [[ $IGNORE_DEV != "" ]]; then
|
||||
lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE,MOUNTPOINT |
|
||||
awk "!/$USB_DEVS/"' && /disk|part|lvm|crypt|NAME/ {print $0}' > /tmp/.devlist
|
||||
awk "!/$IGNORE_DEV/"' && /disk|part|lvm|crypt|NAME/ {print $0}' > /tmp/.devlist
|
||||
else
|
||||
lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE,MOUNTPOINT |
|
||||
awk '/disk|part|lvm|crypt|NAME/ {print $0}' > /tmp/.devlist
|
||||
@ -441,7 +437,8 @@ set_timezone() {
|
||||
|
||||
local zone
|
||||
zone="$(dialog --cr-wrap --stdout --no-cancel --backtitle "$BT" \
|
||||
--title " $_TimeZTitle " --menu "$_TimeZBody" 20 70 10 $ZONES)"
|
||||
--title " $_TimeZTitle " --menu "$_TimeZBody" 20 70 10 America - Australia - \
|
||||
Asia - Atlantic - Africa - Europe - Indian - Pacific - Arctic - Antarctica -)"
|
||||
local subzone
|
||||
subzone="$(dialog --cr-wrap --stdout --no-cancel --backtitle "$BT" \
|
||||
--title " $_TimeZTitle " --menu "$_TimeSubZBody" 20 70 12 ${SUBZONES[$zone]})"
|
||||
@ -683,6 +680,8 @@ choose_window_manager() {
|
||||
[[ $LOGIN_WM == "" ]] && LOGIN_WM="$(awk '{print $1}' <<< "$INSTALL_WMS")"
|
||||
fi
|
||||
|
||||
[[ $LOGIN_WM == 'i3-gaps' ]] && LOGIN_WM="i3"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -764,10 +763,12 @@ find_partitions() {
|
||||
local err='NONE'
|
||||
|
||||
# string of partitions as /TYPE/PART SIZE
|
||||
if [[ $USB_DEVS != "" ]]; then
|
||||
PARTS="$(lsblk -lno TYPE,NAME,SIZE | awk "/$str/"' && !'"/$USB_DEVS/"' {sub(/^part/, "/dev/"); sub(/^lvm|^crypt/, "/dev/mapper/"); print $1$2 " " $3}')"
|
||||
if [[ $IGNORE_DEV != "" ]]; then
|
||||
PARTS="$(lsblk -lno TYPE,NAME,SIZE |
|
||||
awk "/$str/"' && !'"/$IGNORE_DEV/"' {sub(/^part/, "/dev/"); sub(/^lvm|^crypt/, "/dev/mapper/"); print $1$2 " " $3}')"
|
||||
else
|
||||
PARTS="$(lsblk -lno TYPE,NAME,SIZE | awk "/$str/"' {sub(/^part/, "/dev/"); sub(/^lvm|^crypt/, "/dev/mapper/"); print $1$2 " " $3}')"
|
||||
PARTS="$(lsblk -lno TYPE,NAME,SIZE |
|
||||
awk "/$str/"' {sub(/^part/, "/dev/"); sub(/^lvm|^crypt/, "/dev/mapper/"); print $1$2 " " $3}')"
|
||||
fi
|
||||
|
||||
# number of partitions total
|
||||
|
Reference in New Issue
Block a user