From 01c58d6dd4dd6556a69d7de8ae31acd1712bb57d Mon Sep 17 00:00:00 2001 From: natemaia Date: Mon, 30 Jul 2018 00:30:35 -0700 Subject: [PATCH] Split mirrorlist dialog up and front load choices, add format/boot flag setup for boot partitions --- src/installer | 63 ++++++++++++++++++++++++++++-------------- trans/chinese.trans | 3 +- trans/dutch.trans | 3 +- trans/english.trans | 11 ++++---- trans/french.trans | 3 +- trans/hungarian.trans | 3 +- trans/italian.trans | 3 +- trans/p_brasil.trans | 5 ++-- trans/portuguese.trans | 5 ++-- trans/russian.trans | 3 +- trans/spanish.trans | 3 +- 11 files changed, 69 insertions(+), 36 deletions(-) diff --git a/src/installer b/src/installer index 6b0bfac..cecd9c4 100755 --- a/src/installer +++ b/src/installer @@ -15,7 +15,7 @@ # immutable variables { readonly DIST="Archlabs" # Linux distributor -readonly VER="1.6.18" # Installer version +readonly VER="1.6.19" # Installer version readonly LIVE="liveuser" # Live session user readonly TRN="/installer" # Translation path readonly MNT="/mnt/install" # Install mountpoint @@ -133,6 +133,7 @@ initialize_variables() { declare -g CURRENT_MENU="main" declare -g MENU_HIGHLIGHT=0 declare -g EDITOR_CHOICE="" + declare -g MIRROR_CMD="reflector --score 100 -l 50 -f 10 --sort rate" # boolean checks declare -g FIRST_PREP=false @@ -1027,6 +1028,12 @@ select_efi_partition() { } select_bios_boot_partition() { + format_as_ext4() { + infobox "$_FSTitle" "\nFormatting $1 as ext4.\n" + mkfs.ext4 -q "$1" >/dev/null 2>$ERR + check_for_errors "mkfs.ext4 -q $1" || return 1 + } + tput civis BOOT_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" --title "$_PrepMount" \ --menu "$_SelBiosBody" 0 0 0 "$_Skip" "-" $PARTS)" @@ -1034,8 +1041,21 @@ select_bios_boot_partition() { if [[ $? != 0 || $BOOT_PART == "$_Skip" || $BOOT_PART == "" ]]; then BOOT_PART="" else + if grep -q 'ext[34]' <<< "$(fsck -N "$BOOT_PART")"; then + local msg="$_FormBiosBody $BOOT_PART $_FormUefiBody2" + if yesno "$_PrepMount" "$msg" "Format $BOOT_PART" "Skip Formatting" "no"; then + format_as_ext4 "$BOOT_PART" || return 1 + fi + else + format_as_ext4 "$BOOT_PART" || return 1 + fi + # set BOOT_DEVICE for BIOS grub by removing digit from the end BOOT_DEVICE="${BOOT_PART%[1-9]}" + PART_NUM="${BOOT_PART#$BOOT_DEVICE}" + + parted -s $BOOT_DEVICE set $PART_NUM boot on 2>$ERR + check_for_errors "parted -s $BOOT_DEVICE set $PART_NUM boot on" || return 1 fi return 0 @@ -1071,7 +1091,7 @@ select_root_partition() { select_mountpoint() { tput cnorm - EXTRA_MNT="$(getinput "$_PrepMount $part" "$_ExtPartBody1/home /var\n" "/")" + EXTRA_MNT="$(getinput "$_PrepMount $part" "$_ExtPartBody1 /home /var\n" "/")" [[ $? != 0 || $EXTRA_MNT == "" ]] && return 1 # bad mountpoint @@ -1122,8 +1142,8 @@ select_install_partitions() { if [[ $BOOT_PART == "" ]]; then if [[ $SYS == "UEFI" ]]; then select_efi_partition || { BOOT_PART=""; return 1; } - else - (( COUNT > 0 )) && select_bios_boot_partition + elif (( COUNT > 0 )); then + select_bios_boot_partition || return 1 fi else infobox "$_PrepMount" "\nUsing boot partition: $BOOT_PART\n" @@ -1644,6 +1664,9 @@ lvm_menu() { install_main() { if [[ $UNPACKED_BASE != true ]]; then + # whether to use a custom mirror sorting command later + update_mirrorlist_cmd || MIRROR_CMD="reflector --score 100 -l 50 -f 10 --sort rate" + # user can choose to bail at this point unpack_base_system || { initialize_variables; return 1; } UNPACKED_BASE=true @@ -1661,7 +1684,8 @@ install_main() { setup_bootloader || return 1 if [[ $HAS_NETWORK == true && $DONE_UPDATE != true ]]; then - update_mirrorlist && update_system + update_mirrorlist + update_system DONE_UPDATE=true else if pacman -Qsq archlabs-installer >/dev/null 2>&1; then @@ -1754,20 +1778,20 @@ update_system() { --title " $_UpdSysTitle " --progressbox "$_UpdSysBody\n" 30 90 } -update_mirrorlist() { - local cmd="reflector --score 100 -l 50 -f 10 --sort rate" - +update_mirrorlist_cmd() { if ! yesno "$_MirrorTitle" "$_MirrorSetup" "Automatic Sort" "Customize Sort"; then + + infobox "$_MirrorTitle" "\nGathering mirror countries..\n" local countries countries="$(reflector --list-countries | awk 'NF > 1 {print $1 " -"}')" if [[ $countries != "" ]]; then - local country tput civis + local country country="$(dialog --cr-wrap --stdout --backtitle "$BT" --title "$_MirrorTitle" \ --menu "$_MirrorCountry" 22 70 10 $countries)" [[ $? != 0 || $country == "" ]] && return 1 - cmd="reflector --country $country --score 80 --latest 40 --fastest 10 --sort rate" + MIRROR_CMD="reflector --country $country --score 80 --latest 40 --fastest 10 --sort rate" fi local ref=" --score n Limit the list to the n servers with the highest score. @@ -1779,16 +1803,20 @@ update_mirrorlist() { 'delay': MirrorStatus delay." tput cnorm - cmd="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_MirrorTitle " \ + MIRROR_CMD="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_MirrorTitle " \ --inputbox "$_MirrorCmd\n\n$ref\n" 0 0 "$cmd")" - [[ $? != 0 || $cmd == "" ]] && return 1 + [[ $? != 0 || $MIRROR_CMD == "" ]] && return 1 fi + return 0 +} + +update_mirrorlist() { infobox "$_MirrorTitle" "$_MirrorSort" - if ! $cmd --save $MNT/etc/pacman.d/mirrorlist; then - infobox "$_ErrTitle" "\nAn error occurred updating the mirrorlist\n" - update_mirrorlist || return 1 + if ! $MIRROR_CMD --save $MNT/etc/pacman.d/mirrorlist; then + infobox "$_ErrTitle" "\nAn error occurred while updating the mirrorlist.\n\nFalling back to automatic sorting...\n" + reflector --score 100 -l 50 -f 10 --sort rate --save $MNT/etc/pacman.d/mirrorlist fi return 0 @@ -2132,9 +2160,7 @@ edit_config_menu() { done if [[ $existing_files != "" ]]; then - if ! [[ $EDITOR_CHOICE ]] && [[ $DISPLAY ]] && hash geany >/dev/null 2>&1; then - if yesno "$_EditTitle" "\nOpen file(s) in Geany or Vim?\n" "Geany" "Vim"; then EDITOR_CHOICE="geany -i" geany -i $existing_files @@ -2142,11 +2168,8 @@ edit_config_menu() { EDITOR_CHOICE="vim -O" vim -O $existing_files fi - elif [[ $EDITOR_CHOICE != "" ]]; then - $EDITOR_CHOICE $existing_files - else vim -O $existing_files fi diff --git a/trans/chinese.trans b/trans/chinese.trans index b54c3a0..51e6807 100644 --- a/trans/chinese.trans +++ b/trans/chinese.trans @@ -107,7 +107,7 @@ _DevSelBody="系统中存在设备驱动器 (/dev/). /sda, /sdb, 之类." # Extra Partitions _ExtPartBody="选择额外的分区进行挂载, 这将会提示你选择或输入挂载点.\n选择‘完成’将完成操作并继续下一步." -_ExtPartBody1="将分区挂载在扫描位置.\n\n请确保挂载点是以斜线开头(/).\n这些是例子:\n\n" +_ExtPartBody1="将分区挂载在扫描位置.\n\n请确保挂载点是以斜线开头(/).\n这些是例子:" # Auto partition _PartBody1="\n警告:所有在此分区下的数据" @@ -129,6 +129,7 @@ _SelSwpBody="是否启用交换分区? (可选)\n\n选择使用交换文件还 _SelSwpFile="交换文件" _SelUefiBody="选择EFI分区.\n\n这是一个用于启动较新系统的特殊分区. 通常位于硬盘第一个分区,大小100-500M,分区格式为vfat/fat32." _FormUefiBody="[重要]\nEFI分区" +_FormBiosBody="[重要]\nboot分区" _FormUefiBody2="已经被正确地格式化.\n\n要跳过吗?\n\n选择'no'将清除分区所有数据(即引导程序).\n\n如果不确定请选择'Yes'.\n" # LUKS / DM-Crypt / Encryption diff --git a/trans/dutch.trans b/trans/dutch.trans index c5b4df5..249eac5 100644 --- a/trans/dutch.trans +++ b/trans/dutch.trans @@ -157,11 +157,12 @@ _SelSwpFile="Swapbestand" # Selecteer UEFI _SelUefiBody="Selecteer een UEFI Partitie.\n\nDit is een speciale partitie voor het starten van UEFI systemen." _FormUefiBody="[BELANGRIJK]\nDe EFI-partitie" +_FormBiosBody="[BELANGRIJK]\nDe boot-partitie" _FormUefiBody2="is al correct geformatteerd.\n\nWilt u het formatteren overslaan? Als u 'Nee' kiest, worden ALLE gegevens (bootloaders) op de partitie gewist.\n\nKies 'Ja' als u niet zeker bent.\n" # Extra Partities _ExtPartBody="\nSelecteer bijkomende partities in eender welke volgorde, of 'Klaar' om te eindigen." -_ExtPartBody1="\nBepaal een partitie aankoppelpunt. Verzeker je ervan dat de naam begint met een slash (/). Zie voorbeelden:\n\n" +_ExtPartBody1="\nBepaal een partitie aankoppelpunt. Verzeker je ervan dat de naam begint met een slash (/). Zie voorbeelden:" _ExtErrBody="\nPartitie kan niet worden aangekoppeld wegens een probleem met de aankoppelnaam. De naam moet achter een voorwaartse slash komen.\n" #Voorbereidings Menu diff --git a/trans/english.trans b/trans/english.trans index 173aaec..188ccc8 100644 --- a/trans/english.trans +++ b/trans/english.trans @@ -100,9 +100,9 @@ _InstSysBody="\nInstall syslinux to the master boot record (MBR) or to root (/)? # mirrors _MirrorTitle="Setup Mirrorlist" -_MirrorSetup="\nWant the mirrorlist automatically sorted?\n\nThis takes slightly longer but guarantees the fastest mirrors.\n" +_MirrorSetup="\nWant the mirrorlist automatically sorted?\n\nThis will take longer but guarantees the fastest mirrors.\n" _MirrorSort="\nSorting the mirrorlist.\n\nThis will take a minute.\n" -_MirrorCountry="\nSelect a country to use when sorting mirrors, the full command can be changed manually after\n\nNote: Your country may not have the fastest mirrors.\n" +_MirrorCountry="\nSelect a country to use when sorting mirrors, the full command can be changed manually after\n\nNote: Your country may not have the fastest mirrors for your location.\n" _MirrorCmd="\nThe command below will be used to sort the mirrorlist, a short description of each option is provided, edit the command if needed.\n" @@ -156,11 +156,11 @@ _DevSelBody="\nSelect which device to use.\n\nDevices (/dev/) are the available # Extra Partitions _ExtPartBody="\nSelect additional partitions to mount, you will be asked to enter a mountpoint after. Select 'Done' to finish mounting and continue install." -_ExtPartBody1="\nWhere do you want the partition mounted?\n\nEnsure the name begins with a forward slash (/).\nSome examples include:\n" +_ExtPartBody1="\nWhere do you want the partition mounted?\n\nEnsure the name begins with a forward slash (/).\nSome examples include:" # Auto partition _PartBody1="\nWARNING: ALL data on" -_PartBody2="will be destroyed and the following partitions will be created\n\n- 512M boot partition (ext4 for BIOS, vfat/fat32 for UEFI)\n- ext4 partition using all remaining space.\n\nDo you want to continue?\n" +_PartBody2="will be destroyed and the following partitions will be created\n\n- 512M partition with boot/esp flag enabled (ext4 for BIOS, vfat/fat32 for UEFI)\n- ext4 partition using all remaining space.\n\nDo you want to continue?\n" _PartWipeBody2="will be destroyed using 'wipe -Ifre'.\n\nThis process can take a long time depending on the size of the drive.\n\nDo you want to continue?\n" # Partitioning Menu @@ -177,7 +177,7 @@ _InstSysBody="\nInstall syslinux to the Master Boot Record (MBR) or to root (/)? _FSTitle="Choose Filesystem" _FSBody="\nRecommended: ext4\n\nNOTE: Some aren't usable for root (/) or boot (/boot) partitions." _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\nNOTE: It should be formatted as ext3/4 and have the boot flag enabled.\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" _SelSwpSetup="Swap Setup" _SwapSetup="\nDo you want to use a swapfile?" @@ -185,6 +185,7 @@ _SelSwpErr="Swap Setup Error: Must be 1(M|G) or greater, and can only contain wh _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." _FormUefiBody="IMPORTANT:\n\nThe EFI partition" +_FormBiosBody="IMPORTANT:\n\nThe boot partition" _FormUefiBody2="is already correctly formatted.\n\nDo you want to reformat it?\n" # LUKS / DM-Crypt / Encryption diff --git a/trans/french.trans b/trans/french.trans index cbb7073..1177a8d 100644 --- a/trans/french.trans +++ b/trans/french.trans @@ -151,12 +151,13 @@ _SelSwpFile="Fichier d'échange" # Formater UEFI _FormUefiBody="[IMPORTANT]\nLa partition EFI" +_FormBiosBody="[IMPORTANT]\nLa partition boot" _FormUefiBody2="est déjà correctement formaté.\n\nVoulez-vous passer la mise en forme? Choisir 'Non' effacera TOUTES les données (bootloaders) sur la partition.\n\nEn cas de doute, choisissez 'Oui'\n" _SelUefiBody="\nSélectionner une partition UEFI. C'est une partition spéciale permettant le démarrage sur des systèmes UEFI." # Partitions supplémentaires _ExtPartBody="\nSélectionner des partitions additionnelles dans n'importe quel ordre, ou cliquer sur « Terminé » afin de poursuivre." -_ExtPartBody1="\nSpécifier le point de montage de la partition. Assurez-vous que le nom débute par une barre oblique (/). Exemples inclus :\n\n" +_ExtPartBody1="\nSpécifier le point de montage de la partition. Assurez-vous que le nom débute par une barre oblique (/). Exemples inclus:" _ExtErrBody="\nLa partition ne peut être montée, cela est dû à un problème avec le nom du point de montage. Un nom doit être déterminé après la barre oblique.\n" # Bienvenue diff --git a/trans/hungarian.trans b/trans/hungarian.trans index 67122b8..35a510b 100644 --- a/trans/hungarian.trans +++ b/trans/hungarian.trans @@ -152,11 +152,12 @@ _SelSwpFile="Cserefájl" # UEFI kiválasztása _SelUefiBody="\nVálassz UEFI partíciót. Ez egy speciális partíció az UEFI rendszerek indítása számára." _FormUefiBody="[FONTOS]\nAz EFI partíció" +_FormBiosBody="[FONTOS]\nAz boot partíció" _FormUefiBody2="már formázott.\n\nÁt akarja hagyni a formázást? A 'Nem' kiválasztása törli az összes adatot (bootloader) a partíción.\n\nHa bizonytalan, válassza az 'Igen' lehetőséget.\n" # Extra partíciók _ExtPartBody="\nVálassz a további partíciók közül bármilyen sorrendben, vagy nyomd meg a 'Kész' gombot ha végeztél." -_ExtPartBody1="\nAdj meg partíció csatolási pontot. Biztosítsd, hogy a név per (/) jellel kezdődjön. Például:\n\n" +_ExtPartBody1="\nAdj meg partíció csatolási pontot. Biztosítsd, hogy a név per (/) jellel kezdődjön. Például:" _ExtErrBody="\nA partíció nem csatolható a csatolási pont nevének hibája miatt.. A nevet per '/' jel után add meg.\n" # Üdvözöllek diff --git a/trans/italian.trans b/trans/italian.trans index 3c32205..a5f9ba4 100644 --- a/trans/italian.trans +++ b/trans/italian.trans @@ -152,11 +152,12 @@ _SelSwpFile="File di Swap" # Select UEFI _SelUefiBody="\nSelezionare partizione UEFI. È una partizione speciale per l'avvio nei sistemi UEFI." _FormUefiBody="[IMPORTANTE]\nLa partizione EFI" +_FormBiosBody="[IMPORTANTE]\nLa partizione boot" _FormUefiBody2="è già formattato correttamente.\n\nVuoi saltare la formattazione? Scegliendo 'No' verranno cancellati TUTTI i dati (bootloader) sulla partizione.\n\nScegli incerto 'Sì'\n" # Extra Partitions _ExtPartBody="\nSeleziona le partizioni addizionali in qualsiasi ordine, altrimenti scegli 'Fatto' per concludere." -_ExtPartBody1="\nSpecificare mountpoint partizione. Assicurarsi che il nome cominci con uno slash (/). Ad esempio:\n\n" +_ExtPartBody1="\nSpecificare mountpoint partizione. Assicurarsi che il nome cominci con uno slash (/). Ad esempio:" _ExtErrBody="\nImpossibile montare la partizione a case di un problema con il nome mountpoint. Deve essere indicato un nome dopo lo slash.\n" # Install Base diff --git a/trans/p_brasil.trans b/trans/p_brasil.trans index 2530259..5f4a40e 100644 --- a/trans/p_brasil.trans +++ b/trans/p_brasil.trans @@ -151,12 +151,13 @@ _SelSwpFile="Arquivo SWAP" # Selecionar UEFI _SelUefiBody="\nSelecione a partição UEFI. Esta é a partição especial para iniciar sistemas UEFI." -_FormUefiBody="[IMPORTANTE]\nA partição EFI " +_FormUefiBody="[IMPORTANTE]\nA partição EFI" +_FormBiosBody="[IMPORTANTE]\nA partição boot" _FormUefiBody2="já está formatado corretamente.\n\nVocê quer pular a formatação? Escolher 'Não' irá apagar TODOS os dados (bootloaders) na partição.\n\nSe não tiver certeza, escolha 'Sim'.\n" # Partições Extras _ExtPartBody="\nSelecionar partições adicionais em qualquer ordem, ou 'Feito' para finalizar." -_ExtPartBody1="\nEspecifique o ponto de montagem da partição. Certifique-se que o nome comece com uma barra (/). Exemplos:\n\n" +_ExtPartBody1="\nEspecifique o ponto de montagem da partição. Certifique-se que o nome comece com uma barra (/). Exemplos:" _ExtErrBody="\nA partição não pode ser montada devido a um problema com o nome do ponto de montagem. Um nome deve ser dado depois da barra.\n" # Bem-vindo(a) diff --git a/trans/portuguese.trans b/trans/portuguese.trans index 81605a2..0381770 100644 --- a/trans/portuguese.trans +++ b/trans/portuguese.trans @@ -153,12 +153,13 @@ _SelSwpFile="Arquivo SWAP" _SelUefiBody="\nSeleccione a partição UEFI. Esta é a partição especial para iniciar sistemas UEFI." # Formatar UEFI -_FormUefiBody="[IMPORTANTE]\nA partição EFI " +_FormUefiBody="[IMPORTANTE]\nA partição EFI" +_FormBiosBody="[IMPORTANTE]\nA partição boot" _FormUefiBody2="já está formatado corretamente.\n\nVocê quer pular a formatação? Escolher 'Não' irá apagar TODOS os dados (bootloaders) na partição.\n\nSe não tiver certeza, escolha 'Sim'.\n" # Partições Extras _ExtPartBody="\nSeleccionar partições adicionais em qualquer ordem, ou 'Pronto' para finalizar." -_ExtPartBody1="\nEspecifique o ponto de montagem da partição. Verifique se o nome começa com uma barra (/). Exemplos incluem:\n\n" +_ExtPartBody1="\nEspecifique o ponto de montagem da partição. Verifique se o nome começa com uma barra (/). Exemplos incluem:" _ExtErrBody="\nA partição não pode ser montada devido a um problema com o nome do ponto de montagem. Um nome deve ser dado depois da barra.\n" # Instalar Base diff --git a/trans/russian.trans b/trans/russian.trans index b6ff3a0..d6b6af9 100644 --- a/trans/russian.trans +++ b/trans/russian.trans @@ -152,11 +152,12 @@ _SelSwpFile="Swapfile" # Select UEFI _SelUefiBody="\nВыберите UEFI раздел. Это специальный раздел для загрузки UEFI систем." _FormUefiBody="[ВАЖНО]\nРаздел EFI" +_FormBiosBody="[ВАЖНО]\nРаздел boot" _FormUefiBody2="уже правильно отформатирован.\n\nВы хотите пропустить его форматирование? Выбор 'Нет' удалит ВСЕ данные (загрузчики) в разделе.\n\nЕсли неуверенный выбор 'Да'.\n" # Extra Partitions _ExtPartBody="\nВыберите дополнительные разделы в любом порядке или 'Готово' для завершения." -_ExtPartBody1="\nУкажите точку монтирования. Убедитесь, что имя начинается с косой черты (/). Например:\n\n" +_ExtPartBody1="\nУкажите точку монтирования. Убедитесь, что имя начинается с косой черты (/). Например:" _ExtErrBody="\nРаздел не может быть смонтирован из-за проблем с именем точки монтирования. Имя должно быть введено после косой черты.\n" # Install Base diff --git a/trans/spanish.trans b/trans/spanish.trans index ce15eac..709cdc2 100644 --- a/trans/spanish.trans +++ b/trans/spanish.trans @@ -152,11 +152,12 @@ _SelSwpFile="Archivo SWAP" # Seleccionar UEFI _SelUefiBody="\nSeleccione la partición UEFI. Ésta es una partición especial para arrancar los sistemas UEFI." _FormUefiBody="[IMPORTANTE]\nLa partición EFI" +_FormBiosBody="[IMPORTANTE]\nLa partición boot" _FormUefiBody2="ya está formateado correctamente.\n\n¿Quieres omitir el formateo? Elegir 'No' borrará TODOS los datos (cargadores de arranque) en la partición.\n\nSi no está seguro, elija 'Sí'.\n" # Particiones extra _ExtPartBody="\nSeleccione particiones adicionales en cualquier orden, o 'Finalizar' para terminar el proceso." -_ExtPartBody1="\nPunto de montaje de partición específica. Asegúrese de que el nombre empieza con una barra inclinada (/). Ejemplos:\n\n" +_ExtPartBody1="\nPunto de montaje de partición específica. Asegúrese de que el nombre empieza con una barra inclinada (/). Ejemplos:" _ExtErrBody="\nLa partición no se puede montar debido a un problema con el nombre del punto de montaje. Se debe indicar un nombre después de una barra inclinada (/).\n" # Instalar sistema base