Clean up and minor changes to translations

This commit is contained in:
natemaia 2018-08-26 09:42:01 -07:00
parent a47c562f16
commit 42c1ae9f07
3 changed files with 73 additions and 93 deletions

View File

@ -2,7 +2,6 @@
#### Features #### Features
+ Support for LUKS and/or LVM. + Support for LUKS and/or LVM.
+ Create multiple users.
+ Simple & easy to follow configuration. + Simple & easy to follow configuration.
+ Automatic partitioning for whole devices. + Automatic partitioning for whole devices.
+ Translations for 10 different languages. + Translations for 10 different languages.

View File

@ -14,12 +14,22 @@
# immutable variables { # immutable variables {
readonly DIST="Archlabs" # Linux distributor readonly DIST="Archlabs" # Linux distributor
readonly VER="1.6.50" # Installer version readonly VER="1.6.51" # Installer version
readonly LIVE="liveuser" # Live session user readonly LIVE="liveuser" # Live session user
readonly TRN="/usr/share/archlabs-installer" # Translation path readonly TRN="/usr/share/archlabs-installer" # Translation path
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
# bash colour escapes
readonly BLUE='\E[1;34m'
readonly RED='\E[1;31m'
readonly GREEN='\E[1;32m'
readonly YELLOW='\E[1;33m'
readonly NORM='\E[0m'
# hardware check
readonly VM="$(dmesg | grep -i "hypervisor")"
# create a regex string of all usb devices on the system # create a regex string of all usb devices on the system
for dev in $(lsblk -lno NAME,TRAN | awk '/usb/ {print $1}'); do for dev in $(lsblk -lno NAME,TRAN | awk '/usb/ {print $1}'); do
USB_DEVS="${dev}$([[ $USB_DEVS ]] && echo -n "|$USB_DEVS")" USB_DEVS="${dev}$([[ $USB_DEVS ]] && echo -n "|$USB_DEVS")"
@ -510,10 +520,11 @@ window_manager() {
esac esac
done done
if yesno "$_WMLogin" "$_LoginTypeBody\n" "xinit" "lightdm"; then # if dwm is not the only WM chosen offer lightdm
LOGIN_TYPE="xinit" if [[ $INSTALL_WMS != 'dwm' ]] && yesno "$_WMLogin" "$_LoginTypeBody\n" "xinit" "lightdm"; then
LOGIN_TYPE='lightdm'
else else
LOGIN_TYPE="lightdm" LOGIN_TYPE='xinit'
fi fi
if yesno "$_WMLogin" "$_AutoLoginBody\n"; then if yesno "$_WMLogin" "$_AutoLoginBody\n"; then
@ -621,13 +632,10 @@ extra_packages() {
} }
choose_kernel() { choose_kernel() {
if ! grep -qi "hypervisor" <<< "$(dmesg)"; then if ! [[ $VM ]] && ! yesno 'Choose Kernel' "\nUse the current Linux kernel or the LTS kernel?\n" 'Current' 'LTS'; then
local msg="\nUse the current Linux kernel or the LTS kernel?\n" KERNEL='linux-lts'
if yesno "Choose Kernel" "$msg" "Current" "LTS"; then
KERNEL="linux"
else else
KERNEL="linux-lts" KERNEL='linux'
fi
fi fi
return 0 return 0
} }
@ -669,6 +677,12 @@ mirrorlist_cmd() {
## Partitioning Functions ## ## Partitioning Functions ##
###################################################################### ######################################################################
format() {
infobox "$_FSTitle" "\nFormatting: $1\n\nCommand: ${FS_CMDS[$2]}\n" 0
${FS_CMDS[$2]} $1 2>$ERR
check_for_errors "${FS_CMDS[$2]} $1"
}
decrease_part_count() { decrease_part_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
local p="$1" local p="$1"
@ -776,8 +790,7 @@ auto_partition() {
# walk the partitions on the device in reverse order and delete them # walk the partitions on the device in reverse order and delete them
for i in $(awk '/^ [1-9][0-9]?/ {print $1}' <<< "$dev_info" | sort -r); do for i in $(awk '/^ [1-9][0-9]?/ {print $1}' <<< "$dev_info" | sort -r); do
parted -s $device rm $i 2>$ERR parted -s $device rm $i >/dev/null 2>&1
check_for_errors "parted -s $device rm $i"
done done
# make sure we have the correct device table for the system type, gpt or msdos # make sure we have the correct device table for the system type, gpt or msdos
@ -787,8 +800,7 @@ auto_partition() {
# if the current device table isn't correct run mklabel # if the current device table isn't correct run mklabel
if [[ $table != "$newtable" ]]; then if [[ $table != "$newtable" ]]; then
parted -s $device mklabel $newtable 2>$ERR parted -s $device mklabel $newtable >/dev/null 2>&1
check_for_errors "parted -s $device mklabel $newtable"
fi fi
# when device contains the string 'nvme' then add 'p' before the part number # when device contains the string 'nvme' then add 'p' before the part number
@ -799,31 +811,23 @@ auto_partition() {
BOOT_PART="$device${nvme}$part_num" # set the boot partition label to the first partition BOOT_PART="$device${nvme}$part_num" # set the boot partition label to the first partition
if [[ $SYS == "BIOS" ]]; then if [[ $SYS == "BIOS" ]]; then
parted -s $device mkpart primary ext4 1MiB 513MiB 2>$ERR parted -s $device mkpart primary ext4 1MiB 513MiB >/dev/null 2>&1
check_for_errors "parted -s $device mkpart primary ext4 1MiB 513MiB" mkfs.ext4 -q $BOOT_PART >/dev/null 2>&1
mkfs.ext4 -q $BOOT_PART >/dev/null 2>$ERR
check_for_errors "mkfs.ext4 -q $BOOT_PART"
parted -s $device set $part_num boot on 2>$ERR
check_for_errors "parted -s $device set $part_num boot on"
else else
parted -s $device mkpart ESP fat32 1MiB 513MiB 2>$ERR parted -s $device mkpart ESP fat32 1MiB 513MiB >/dev/null 2>&1
check_for_errors "parted -s $device mkpart ESP fat32 1MiB 513MiB" mkfs.vfat -F32 $BOOT_PART >/dev/null 2>&1
mkfs.vfat -F32 $BOOT_PART >/dev/null 2>$ERR
check_for_errors "mkfs.vfat -F32 $BOOT_PART"
parted -s $device set $part_num esp on 2>$ERR
check_for_errors "parted -s $device set $part_num esp on"
fi fi
(( part_num++ )) # increment the partition number (( part_num++ )) # increment the partition number
BOOT_DEVICE="$device" # only grub on BIOS systems uses this BOOT_DEVICE="$device" # only grub on BIOS systems uses this
ROOT_PART="${device}${nvme}$part_num" # set root partition label to the second partition ROOT_PART="${device}${nvme}$part_num" # set root partition label to the second partition
parted -s $device mkpart primary ext4 514MiB 100% 2>$ERR parted -s $device mkpart primary ext4 514MiB 100% >/dev/null 2>&1
check_for_errors "parted -s $device mkpart primary ext4 514MiB 100%" mkfs.ext4 -q $ROOT_PART >/dev/null 2>&1
mkfs.ext4 -q $ROOT_PART >/dev/null 2>$ERR
check_for_errors "mkfs.ext4 -q $ROOT_PART" tput civis
sleep 0.5 # slow the process down, otherwise lsblk output can be wrong for some things
tput civis; sleep 0.5
echo -e "\nAuto partitioning complete.\n" > /tmp/.devlist echo -e "\nAuto partitioning complete.\n" > /tmp/.devlist
lsblk $device -o NAME,MODEL,TYPE,FSTYPE,SIZE >> /tmp/.devlist lsblk $device -o NAME,MODEL,TYPE,FSTYPE,SIZE >> /tmp/.devlist
dialog --cr-wrap --backtitle "$BT" --title " $_PrepParts " --textbox /tmp/.devlist 0 0 dialog --cr-wrap --backtitle "$BT" --title " $_PrepParts " --textbox /tmp/.devlist 0 0
@ -847,9 +851,7 @@ create_partitions() {
if [[ $choice != "$_PartWipe" && $choice != "$_PartAuto" ]]; then if [[ $choice != "$_PartWipe" && $choice != "$_PartAuto" ]]; then
$choice $device $choice $device
elif [[ $choice == "$_PartWipe" ]]; then elif [[ $choice == "$_PartWipe" ]]; then
if yesno "$_PartWipe" "$_PartBody1 $device $_PartWipeBody2"; then yesno "$_PartWipe" "$_PartBody1 $device $_PartWipeBody2" && wipe -Ifrev $device
wipe -Ifrev $device
fi
create_partitions $device create_partitions $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
@ -962,13 +964,10 @@ select_filesystem() {
[[ $choice == "" ]] && return 1 [[ $choice == "" ]] && return 1
if yesno "$_FSTitle" "\nFormat $part as $choice?\n"; then if yesno "$_FSTitle" "\nFormat $part as $choice?\n"; then
infobox "$_FSTitle" "\nFormatting: $part\n\nCommand: ${FS_CMDS[$choice]}\n" 0 format $part $choice
${FS_CMDS[$choice]} $part >/dev/null 2>$ERR
check_for_errors "${FS_CMDS[$choice]} $part"
else else
select_filesystem "$part" || return 1 select_filesystem $part || return 1
fi fi
return 0 return 0
} }
@ -986,14 +985,12 @@ select_boot_setup() {
if [[ $BOOTLOADER == 'systemd-boot' ]]; then if [[ $BOOTLOADER == 'systemd-boot' ]]; then
EDIT_FILES[9]="/boot/loader/entries/$DIST.conf" EDIT_FILES[9]="/boot/loader/entries/$DIST.conf"
elif [[ $BOOTLOADER == 'syslinux' ]]; then elif [[ $BOOTLOADER == 'syslinux' && $SYS == 'BIOS' ]]; then
if [[ $SYS == 'BIOS' ]]; then
BOOT_CMDS[$BOOTLOADER]="$(dialog --cr-wrap --stdout --backtitle "$BT" \ BOOT_CMDS[$BOOTLOADER]="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_InstSysTitle " --menu "$_InstSysBody" 0 0 0 \ --title " $_InstSysTitle " --menu "$_InstSysBody" 0 0 0 \
"syslinux-install_update -iam" "Install to MBR (Master Boot Record)" \ "syslinux-install_update -iam" "Install to MBR (Master Boot Record)" \
"syslinux-install_update -i" "Install to root partition (/)")" "syslinux-install_update -i" "Install to root partition (/)")"
[[ $? != 0 || ${BOOT_CMDS[$BOOTLOADER]} == "" ]] && return 1 [[ $? != 0 || ${BOOT_CMDS[$BOOTLOADER]} == "" ]] && return 1
fi
else else
EDIT_FILES[9]="/etc/default/grub" EDIT_FILES[9]="/etc/default/grub"
fi fi
@ -1021,12 +1018,6 @@ setup_boot_device() {
} }
select_efi_partition() { select_efi_partition() {
format_efi_as_vfat() {
infobox "$_FSTitle" "\nFormatting $1 as vfat/fat32.\n" 0
mkfs.vfat -F32 "$1" >/dev/null 2>$ERR
check_for_errors "mkfs.vfat -F32 $1"
}
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")"
@ -1040,20 +1031,14 @@ select_efi_partition() {
if grep -q 'fat' <<< "$(fsck -N "$BOOT_PART")"; then if grep -q 'fat' <<< "$(fsck -N "$BOOT_PART")"; then
local msg="$_FormUefiBody $BOOT_PART $_FormUefiBody2" local msg="$_FormUefiBody $BOOT_PART $_FormUefiBody2"
yesno "$_PrepMount" "$msg" "Format $BOOT_PART" "Do Not Format" "no" && yesno "$_PrepMount" "$msg" "Format $BOOT_PART" "Do Not Format" "no" &&
format_efi_as_vfat "$BOOT_PART" format "$BOOT_PART" "vfat"
else else
format_efi_as_vfat "$BOOT_PART" format "$BOOT_PART" "vfat"
fi fi
return 0 return 0
} }
select_boot_partition() { select_boot_partition() {
format_as_ext4() {
infobox "$_FSTitle" "\nFormatting $1 as ext4.\n" 0
mkfs.ext4 -q "$1" >/dev/null 2>$ERR
check_for_errors "mkfs.ext4 -q $1"
}
tput civis tput civis
BOOT_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" \ BOOT_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_PrepMount " --menu "$_SelBiosBody" 0 0 0 "$_Skip" "-" $PARTS)" --title " $_PrepMount " --menu "$_SelBiosBody" 0 0 0 "$_Skip" "-" $PARTS)"
@ -1063,11 +1048,10 @@ select_boot_partition() {
else else
if grep -q 'ext[34]' <<< "$(fsck -N "$BOOT_PART")"; then if grep -q 'ext[34]' <<< "$(fsck -N "$BOOT_PART")"; then
local msg="$_FormBiosBody $BOOT_PART $_FormUefiBody2" local msg="$_FormBiosBody $BOOT_PART $_FormUefiBody2"
if yesno "$_PrepMount" "$msg" "Format $BOOT_PART" "Skip Formatting" "no"; then yesno "$_PrepMount" "$msg" "Format $BOOT_PART" "Skip Formatting" "no" &&
format_as_ext4 "$BOOT_PART" format "$BOOT_PART" "ext4"
fi
else else
format_as_ext4 "$BOOT_PART" format "$BOOT_PART" "ext4"
fi fi
fi fi
return 0 return 0
@ -1097,8 +1081,8 @@ select_root_partition() {
infobox "$_PrepMount" "$_OnlyOne for root (/): $ROOT_PART\n" 1 infobox "$_PrepMount" "$_OnlyOne for root (/): $ROOT_PART\n" 1
elif [[ $ROOT_PART == "" || $LVM -eq 1 ]]; then elif [[ $ROOT_PART == "" || $LVM -eq 1 ]]; then
tput civis tput civis
ROOT_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" --title "$_PrepMount" \ ROOT_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--menu "$_SelRootBody" 0 0 0 $PARTS)" --title " $_PrepMount " --menu "$_SelRootBody" 0 0 0 $PARTS)"
[[ $? != 0 || $ROOT_PART == "" ]] && return 1 [[ $? != 0 || $ROOT_PART == "" ]] && return 1
else else
local msg="\nUsing $([[ $LUKS -eq 1 ]] && echo -n "encrypted ")root partition:" local msg="\nUsing $([[ $LUKS -eq 1 ]] && echo -n "encrypted ")root partition:"
@ -1129,8 +1113,8 @@ select_extra_partitions() {
while (( COUNT > 0 )); do while (( COUNT > 0 )); do
tput civis tput civis
local part local part
part="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_PrepMount " \ part="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--menu "$_ExtPartBody" 0 0 0 "$_Done" "-" $PARTS)" --title " $_PrepMount " --menu "$_ExtPartBody" 0 0 0 "$_Done" "-" $PARTS)"
[[ $? != 0 || $part == "$_Done" || $part == "" ]] && break [[ $? != 0 || $part == "$_Done" || $part == "" ]] && break
# choose what filesystem and get mountpoint # choose what filesystem and get mountpoint
@ -1244,8 +1228,8 @@ luks_open() {
infobox "$_LuksOpen" "${_OnlyOne}: $LUKS_PART\n" 1 infobox "$_LuksOpen" "${_OnlyOne}: $LUKS_PART\n" 1
else else
tput civis tput civis
LUKS_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_LuksOpen " \ LUKS_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--menu "$_LuksMenuBody" 0 0 0 $PARTS)" --title " $_LuksOpen " --menu "$_LuksMenuBody" 0 0 0 $PARTS)"
[[ $? != 0 || $LUKS_PART == "" ]] && return 1 [[ $? != 0 || $LUKS_PART == "" ]] && return 1
fi fi
@ -1387,7 +1371,6 @@ 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
@ -1662,8 +1645,8 @@ lvm_menu() {
tput civis tput civis
local choice local choice
choice="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_PrepLVM " \ choice="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--menu "$_LvmMenu" 0 0 0 \ --title " $_PrepLVM " --menu "$_LvmMenu" 0 0 0 \
"$_LvmCreateVG" "vgcreate -f, lvcreate -L -n" \ "$_LvmCreateVG" "vgcreate -f, lvcreate -L -n" \
"$_LvmDelVG" "vgremove -f" \ "$_LvmDelVG" "vgremove -f" \
"$_LvMDelAll" "lvrmeove, vgremove, pvremove -f" \ "$_LvMDelAll" "lvrmeove, vgremove, pvremove -f" \
@ -1722,10 +1705,8 @@ install_main() {
run_mkinitcpio || return 1 run_mkinitcpio || return 1
install_bootloader || return 1 install_bootloader || return 1
oneshot create_user || return 1
oneshot set_hwclock oneshot set_hwclock
oneshot edit_configs oneshot create_user || return 1
return 0 return 0
} }
@ -1744,7 +1725,7 @@ install_base() {
sed -i "s/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g" $MNT/etc/sudoers sed -i "s/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g" $MNT/etc/sudoers
# for virtual machines remove configs for xorg, these cause mouse issues # for virtual machines remove configs for xorg, these cause mouse issues
grep -qi "hypervisor" <<< "$(dmesg)" && rm -rf $MNT/etc/X11/xorg.conf.d [[ $VM ]] && rm -rf $MNT/etc/X11/xorg.conf.d
# if not installing the lts kernel, copy the kernel image # if not installing the lts kernel, copy the kernel image
[[ $KERNEL != 'linux-lts' ]] && cp -f /run/archiso/bootmnt/arch/boot/x86_64/vmlinuz $MNT/boot/vmlinuz-linux [[ $KERNEL != 'linux-lts' ]] && cp -f /run/archiso/bootmnt/arch/boot/x86_64/vmlinuz $MNT/boot/vmlinuz-linux
@ -1825,7 +1806,9 @@ update_system() {
pkgcmd="pacman -Rs archlabs-installer --noconfirm ; $pkgcmd" pkgcmd="pacman -Rs archlabs-installer --noconfirm ; $pkgcmd"
if ! grep -qi "hypervisor" <<< "$(dmesg)"; then if [[ $KERNEL == 'linux-lts' && $VM ]]; then
pkgcmd="pacman -Rs virtualbox-guest-modules-arch --noconfirm ; pacman -S virtualbox-guest-dkms --noconfirm ; $pkgcmd"
elif ! [[ $VM ]]; then
pkgcmd="pacman -Rs virtualbox-guest-utils virtualbox-guest-modules-arch --noconfirm ; $pkgcmd" pkgcmd="pacman -Rs virtualbox-guest-utils virtualbox-guest-modules-arch --noconfirm ; $pkgcmd"
fi fi
@ -2124,7 +2107,7 @@ install_bootloader() {
local msg="$_InstBootloader $BOOTLOADER\n" local msg="$_InstBootloader $BOOTLOADER\n"
[[ $BOOT_PART != "" ]] && msg="$msg\n$_InstBootDev $BOOT_PART\n" [[ $BOOT_PART != "" ]] && msg="$msg\n$_InstBootDev $BOOT_PART\n"
echo -e "$msg\nMountpoint: ${BOOT_MNTS[$SYS-$BOOTLOADER]}\n" 0 echo -e "$msg\nMountpoint: ${BOOT_MNTS[$SYS-$BOOTLOADER]}\n"
prep_for_bootloader prep_for_bootloader
@ -2154,9 +2137,7 @@ run_mkinitcpio() {
# new HOOKS needed in /etc/mkinitcpio.conf if we used LUKS and/or LVM # new HOOKS needed in /etc/mkinitcpio.conf if we used LUKS and/or LVM
(( LVM == 1 )) && add="lvm2" (( LVM == 1 )) && add="lvm2"
(( LUKS == 1 )) && add="encrypt$([[ $add != "" ]] && echo -n " $add")" (( LUKS == 1 )) && add="encrypt$([[ $add != "" ]] && echo -n " $add")"
sed -i "s/block filesystems/block ${add} filesystems ${MKINIT_HOOKS}/g" $conf
sed -i "s/block filesystems/block ${add} filesystems ${MKINIT_HOOKS}/g" $conf 2>$ERR
check_for_errors "sed -i 's/block filesystems/block ${add} filesystems ${MKINIT_HOOKS}/g' $conf"
tput civis tput civis
chroot_cmd "mkinitcpio -p $KERNEL" 2>$ERR chroot_cmd "mkinitcpio -p $KERNEL" 2>$ERR
@ -2236,7 +2217,7 @@ main() {
4) lvm_menu ;; 4) lvm_menu ;;
5) select_partitions ;; 5) select_partitions ;;
6) config_install ;; 6) config_install ;;
7) install_main ;; 7) install_main && edit_configs ;;
*) wrap_up "$_CloseInstBody" 'Exit' 'Back' 'exit' *) wrap_up "$_CloseInstBody" 'Exit' 'Back' 'exit'
esac esac
} }

View File

@ -17,7 +17,7 @@ _Final="\nThe install is almost finished.\n"
# Welcome # Welcome
_WelTitle="Welcome to" _WelTitle="Welcome to"
_WelBody="This will unpack and setup $DIST on your system\n\nMenu Navigation:\nSelect items by pressing the option number or using the arrow keys.\nSwitch between buttons using [Tab] or the arrow keys.\nLong lists can be navigated using [Page Up] and [Page Down], or by pressing the first letter of the desired option.\nUse [Space] to select/deselect options and [Enter] to confirm.\n" _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"
# 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"