From 08adbd29846b7fa54ecd1a6544e31a2af981fbf1 Mon Sep 17 00:00:00 2001 From: natemaia Date: Sat, 28 Jul 2018 12:36:08 -0700 Subject: [PATCH] Clean up filesystem selection, remove dialogrc --- src/dialogrc | 79 ------------------------------------------- src/installer | 76 +++++++++++++++++------------------------ trans/dutch.trans | 2 +- trans/english.trans | 2 +- trans/hungarian.trans | 2 +- 5 files changed, 34 insertions(+), 127 deletions(-) delete mode 100644 src/dialogrc diff --git a/src/dialogrc b/src/dialogrc deleted file mode 100644 index b76d436..0000000 --- a/src/dialogrc +++ /dev/null @@ -1,79 +0,0 @@ -# -# Run-time configuration file for dialog -# -# Types of values: -# -# Number - -# String - "string" -# Boolean - -# Attribute - (foreground,background,highlight?) - -aspect = 14 - -separate_widget = "" - -tab_len = 0 - -visit_items = OFF - -use_shadow = ON -use_colors = ON - -screen_color = (CYAN,BLACK,ON) - -shadow_color = (BLACK,BLACK,ON) - -dialog_color = (WHITE,BLACK,ON) - -title_color = (RED,BLACK,ON) - -border_color = (WHITE,BLACK,ON) -border2_color = border_color - -button_active_color = (BLACK,BLUE,ON) -button_inactive_color = (WHITE,BLACK,ON) - -button_key_active_color = (RED,BLUE,ON) -button_key_inactive_color = (RED,BLACK,ON) - -button_label_active_color = (BLACK,BLUE,ON) -button_label_inactive_color = (WHITE,BLACK,ON) - -inputbox_color = (WHITE,BLACK,ON) - -inputbox_border_color = (WHITE,BLACK,ON) -inputbox_border2_color = inputbox_border_color - -searchbox_color = (WHITE,BLACK,ON) -searchbox_title_color = (BLUE,BLACK,ON) - -searchbox_border_color = (WHITE,BLACK,ON) -searchbox_border2_color = searchbox_border_color - -position_indicator_color = (GREEN,BLACK,ON) - -menubox_color = (WHITE,BLACK,ON) - -menubox_border_color = (WHITE,BLACK,ON) -menubox_border2_color = menubox_border_color - -item_color = (WHITE,BLACK,OFF) -item_selected_color = (BLACK,BLUE,ON) - -tag_color = (WHITE,BLACK,OFF) -tag_selected_color = (BLACK,BLUE,ON) - -tag_key_color = (RED,BLACK,ON) -tag_key_selected_color = (BLACK,BLUE,ON) - -check_color = (WHITE,BLACK,ON) -check_selected_color = (BLACK,BLUE,ON) - -uarrow_color = (GREEN,BLACK,ON) -darrow_color = (GREEN,BLACK,ON) - -itemhelp_color = (BLACK,WHITE,ON) - -form_text_color = (WHITE,BLACK,ON) -form_active_text_color = (BLACK,BLUE,ON) -form_item_readonly_color = (WHITE,BLACK,ON) diff --git a/src/installer b/src/installer index 01156c1..121fd25 100755 --- a/src/installer +++ b/src/installer @@ -15,7 +15,7 @@ # immutable variables { readonly DIST="Archlabs" # Linux distributor -readonly VER="1.6.9" # Installer version +readonly VER="1.6.10" # Installer version readonly LIVE="liveuser" # Live session user name readonly TRN="/installer" # Translation path readonly MNT="/mnt/install" # Install mountpoint @@ -28,6 +28,12 @@ readonly DEV_COUNT="$(wc -l <<< "$SYS_DEVS")" readonly LOCALES="$(awk '/\.UTF-8/ {gsub(/# .*|#/, ""); if($1) print $1 " -"}' /etc/locale.gen)" 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 -" @@ -170,7 +176,8 @@ chroot_cmd() { show_devices() { tput civis - lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE,MOUNTPOINT | grep "disk\|part\|lvm\|crypt\|NAME" > /tmp/.devlist + lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE,MOUNTPOINT | + awk "!/$USB_DEVS/"' && /disk|part|lvm|crypt|NAME/ {print $0}' > /tmp/.devlist dialog --cr-wrap --backtitle "$BT" --title " $_PrepShowDev " --textbox /tmp/.devlist 0 0 } @@ -711,17 +718,8 @@ find_partitions() { local str="$1" local err='NONE' - # create a regex string of all usb devices on the system - # ignore these devices entirely during partition list creation below - local usb="" - for d in $(lsblk -lno NAME,TRAN | awk '/usb/ {print $1}'); do - usb="${d}$([[ $usb ]] && echo -n "|$usb")" - done - - # string of partitions as: /TYPE/PART SIZE - # only list partitions of $str types and ignores $usb devices, this also - # substitutes: 'lvm' -> '/dev/mapper/' and 'part' -> '/dev/' - PARTS="$(lsblk -lno TYPE,NAME,SIZE | awk "/$str/"' && !'"/$usb/"' {sub(/^part/, "/dev/"); sub(/^lvm|^crypt/, "/dev/mapper/"); print $1$2 " " $3}')" + # string of partitions as /TYPE/PART SIZE + PARTS="$(lsblk -lno TYPE,NAME,SIZE | awk "/$str/"' && !'"/$USB_DEVS/"' {sub(/^part/, "/dev/"); sub(/^lvm|^crypt/, "/dev/mapper/"); print $1$2 " " $3}')" # number of partitions total COUNT=$(wc -l <<< "$PARTS") @@ -806,7 +804,7 @@ auto_partition() { tput civis sleep 0.5 echo -e "\nAuto partitioning complete.\n" > /tmp/.devlist - lsblk $device -o NAME,TYPE,FSTYPE,SIZE | grep "disk\|part\|lvm\|crypt\|NAME" >> /tmp/.devlist + lsblk $device -o NAME,MODEL,TYPE,FSTYPE,SIZE >> /tmp/.devlist dialog --cr-wrap --backtitle "$BT" --title " $_PrepParts " --textbox /tmp/.devlist 0 0 return 0 @@ -917,28 +915,17 @@ select_filesystem() { local cur_fs="$(lsblk -lno FSTYPE $part)" tput civis + local choice - if [[ $cur_fs != "" ]]; then - choice="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_FSTitle: $part" \ - --menu "\nPartition: $part\nCurrent: ${cur_fs}$_FSBody" 0 0 0 \ - "$_Skip" "-" "ext4" "${FS_CMDS[ext4]}" "ext3" "${FS_CMDS[ext3]}" \ - "ext2" "${FS_CMDS[ext2]}" "vfat" "${FS_CMDS[vfat]}" \ - "btrfs" "${FS_CMDS[btrfs]}" "ntfs" "${FS_CMDS[ntfs]}" \ - "f2fs" "${FS_CMDS[f2fs]}" "jfs" "${FS_CMDS[jfs]}" \ - "nilfs2" "${FS_CMDS[nilfs2]}" "reiserfs" "${FS_CMDS[reiserfs]}" \ - "xfs" "${FS_CMDS[xfs]}")" - [[ $? != 0 || $choice == "$_Skip" || $choice == "" ]] && return 0 - else - choice="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_FSTitle: $part" \ - --menu "\nPartition: $part\n$_FSBody" 0 0 0 \ - "ext4" "${FS_CMDS[ext4]}" "ext3" "${FS_CMDS[ext3]}" \ - "ext2" "${FS_CMDS[ext2]}" "vfat" "${FS_CMDS[vfat]}" \ - "btrfs" "${FS_CMDS[btrfs]}" "ntfs" "${FS_CMDS[ntfs]}" \ - "f2fs" "${FS_CMDS[f2fs]}" "jfs" "${FS_CMDS[jfs]}" \ - "nilfs2" "${FS_CMDS[nilfs2]}" "reiserfs" "${FS_CMDS[reiserfs]}" \ - "xfs" "${FS_CMDS[xfs]}")" - [[ $? != 0 || $choice == "" ]] && return 1 - fi + choice="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_FSTitle: $part" \ + --menu "\nPartition: $part\n$_FSBody" 0 0 0 $([[ $cur_fs != "" ]] && echo -n "$_Skip -") \ + "ext4" "${FS_CMDS[ext4]}" "ext3" "${FS_CMDS[ext3]}" \ + "ext2" "${FS_CMDS[ext2]}" "vfat" "${FS_CMDS[vfat]}" \ + "btrfs" "${FS_CMDS[btrfs]}" "ntfs" "${FS_CMDS[ntfs]}" \ + "f2fs" "${FS_CMDS[f2fs]}" "jfs" "${FS_CMDS[jfs]}" \ + "nilfs2" "${FS_CMDS[nilfs2]}" "reiserfs" "${FS_CMDS[reiserfs]}" \ + "xfs" "${FS_CMDS[xfs]}")" + [[ $? != 0 || $choice == "$_Skip" || $choice == "" ]] && return 0 if yesno "$_FSTitle" "\nFormat $part as $choice?\n"; then infobox "$_FSTitle" "\nFormatting: $part\n\nCommand: ${FS_CMDS[$choice]}\n" @@ -1031,7 +1018,7 @@ select_bios_boot_partition() { decrease_part_count "$BOOT_PART" fi - # set BOOT_DEVICE for BIOS grub by removing any digits from the end of our boot partition + # set BOOT_DEVICE for BIOS grub by removing digit from the end BOOT_DEVICE="${boot%[1-9]}" return 0 } @@ -1081,8 +1068,8 @@ select_extra_partitions() { part="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_PrepMount " \ --menu "$_ExtPartBody" 0 0 0 "$_Done" "-" $PARTS)" - # return cancel or done - [[ $part == "$_Done" || $part == "" ]] && break + # cancel or done, exit normally + [[ $? != 0 || $part == "$_Done" || $part == "" ]] && break # choose what filesystem and get mountpoint select_filesystem "$part" || { break; return 1; } @@ -1091,10 +1078,8 @@ select_extra_partitions() { # mount it mount_partition "$part" "$EXTRA_MNT" || { break; return 1; } - # if the mountpoint was /usr and MKINIT_HOOKS doesn't contain 'usr' then add it - if [[ $EXTRA_MNT == "/usr" && $MKINIT_HOOKS != *usr* ]]; then - MKINIT_HOOKS="usr $MKINIT_HOOKS" - fi + # if the mountpoint was /usr add 'usr' to MKINIT_HOOKS + [[ $EXTRA_MNT == "/usr" && $MKINIT_HOOKS != *usr* ]] && MKINIT_HOOKS="usr $MKINIT_HOOKS" done return 0 } @@ -1116,7 +1101,7 @@ select_install_partitions() { if [[ $SYS == "UEFI" ]]; then select_efi_partition || { BOOT_PART=""; return 1; } else - select_bios_boot_partition || { BOOT_PART=""; BOOT_DEVICE=""; return 1; } + select_bios_boot_partition fi else infobox "$_PrepMount" "\nUsing boot partition: $BOOT_PART\n" @@ -1126,7 +1111,7 @@ select_install_partitions() { select_swap || return 1 - select_extra_partitions || { BOOTLOADER=""; return 1; } + select_extra_partitions || return 1 return 0 } @@ -2032,7 +2017,8 @@ prepare_menu() { if [[ $ROOT_PART != "" && $BOOTLOADER != "" ]]; then if check_parts_are_mounted; then # this is where all the action happens, the rest is mostly automated - # the user will likely reboot after but if we return, then return to main menu + # the user will likely reboot after and never get back here, but if we do + # returning goes to the main menu install_main && return 0 fi fi diff --git a/trans/dutch.trans b/trans/dutch.trans index 694b187..7e8cc23 100644 --- a/trans/dutch.trans +++ b/trans/dutch.trans @@ -1,7 +1,7 @@ # Generic _All="Alle" _Done="Klaar" -_Skip="Sla over/Geen" +_Skip="Overspringen/Geen" _ErrTitle="Fout" _NoFileErr="\nBestand bestaat niet.\n" _PlsWait="\nEven geduld aub...\n" diff --git a/trans/english.trans b/trans/english.trans index fdf395c..f1b68bf 100644 --- a/trans/english.trans +++ b/trans/english.trans @@ -17,7 +17,7 @@ _Final="\nThe install is almost finished.\n" # Welcome _WelTitle="Welcome to" -_WelBody="This will unpack and setup $DIST on your system\n\nMenu Navigation:\nSelect by pressing the option number or using the arrow keys. Switch between buttons using [Tab] or the arrow keys. Long lists can be navigated using [Page Up] and [Page Down], or by pressing the first letter of the desired option.\n\nUse [Space] to select/deselect options and [Enter] to confirm.\n[Ctrl][Shift][Page Up] / [Ctrl][Shift][Page Down] to increase / decrease font size.\n" +_WelBody="This will unpack and setup $DIST on your system\n\nMenu Navigation:\nSelect by pressing the option number or using the arrow keys. Switch between buttons using [Tab] or the arrow keys. Long lists can be navigated using [Page Up] and [Page Down], or by pressing the first letter of the desired option.\n\nUse [Space] to select/deselect options and [Enter] to confirm.\n[Ctrl]+ to increase font size, [Ctrl]- to decrease it, and [Ctrl]= to reset it.\n" # Requirements _NotRoot="\nThe installer must be run as root or using sudo.\n" diff --git a/trans/hungarian.trans b/trans/hungarian.trans index 06ce1e5..4e2621e 100644 --- a/trans/hungarian.trans +++ b/trans/hungarian.trans @@ -1,7 +1,7 @@ # Általános _All="Összes" _Done="Kész" -_Skip="Kihagyás/egyik sem" +_Skip="Ugrás/Nincs" _ErrTitle="Hiba" _NoFileErr="\nA fájl nem létezik.\n" _PlsWait="\nKérlek várj...\n"