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
+ Support for LUKS and/or LVM.
+ Create multiple users.
+ Simple & easy to follow configuration.
+ Automatic partitioning for whole devices.
+ Translations for 10 different languages.

View File

@ -14,12 +14,22 @@
# immutable variables {
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 TRN="/usr/share/archlabs-installer" # Translation path
readonly MNT="/mnt/install" # Install mountpoint
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
for dev in $(lsblk -lno NAME,TRAN | awk '/usb/ {print $1}'); do
USB_DEVS="${dev}$([[ $USB_DEVS ]] && echo -n "|$USB_DEVS")"
@ -392,7 +402,7 @@ set_locale() {
tput civis
declare -g LOCALE
LOCALE="$(dialog --cr-wrap --stdout --no-cancel --backtitle "$BT" \
--title "$_ConfLocale" --menu "$_LocaleBody" 25 70 12 $LOCALES)"
--title " $_ConfLocale " --menu "$_LocaleBody" 25 70 12 $LOCALES)"
[[ $? != 0 || $LOCALE == "" ]] && return 1
return 0
}
@ -510,10 +520,11 @@ window_manager() {
esac
done
if yesno "$_WMLogin" "$_LoginTypeBody\n" "xinit" "lightdm"; then
LOGIN_TYPE="xinit"
# if dwm is not the only WM chosen offer lightdm
if [[ $INSTALL_WMS != 'dwm' ]] && yesno "$_WMLogin" "$_LoginTypeBody\n" "xinit" "lightdm"; then
LOGIN_TYPE='lightdm'
else
LOGIN_TYPE="lightdm"
LOGIN_TYPE='xinit'
fi
if yesno "$_WMLogin" "$_AutoLoginBody\n"; then
@ -621,13 +632,10 @@ extra_packages() {
}
choose_kernel() {
if ! grep -qi "hypervisor" <<< "$(dmesg)"; then
local msg="\nUse the current Linux kernel or the LTS kernel?\n"
if yesno "Choose Kernel" "$msg" "Current" "LTS"; then
KERNEL="linux"
else
KERNEL="linux-lts"
fi
if ! [[ $VM ]] && ! yesno 'Choose Kernel' "\nUse the current Linux kernel or the LTS kernel?\n" 'Current' 'LTS'; then
KERNEL='linux-lts'
else
KERNEL='linux'
fi
return 0
}
@ -644,7 +652,7 @@ mirrorlist_cmd() {
tput civis
local country
country="$(dialog --cr-wrap --stdout --no-cancel --backtitle "$BT" \
--title "$_MirrorTitle" --menu "$_MirrorCountry" 22 70 10 $countries)"
--title " $_MirrorTitle " --menu "$_MirrorCountry" 22 70 10 $countries)"
MIRROR_CMD="reflector --country $country --score 80 --latest 40 --fastest 10 --sort rate"
fi
@ -669,6 +677,12 @@ mirrorlist_cmd() {
## 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() {
# remove a partition from the dialog list and decrement the number partitions left
local p="$1"
@ -776,8 +790,7 @@ auto_partition() {
# 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
parted -s $device rm $i 2>$ERR
check_for_errors "parted -s $device rm $i"
parted -s $device rm $i >/dev/null 2>&1
done
# 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 [[ $table != "$newtable" ]]; then
parted -s $device mklabel $newtable 2>$ERR
check_for_errors "parted -s $device mklabel $newtable"
parted -s $device mklabel $newtable >/dev/null 2>&1
fi
# 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
if [[ $SYS == "BIOS" ]]; then
parted -s $device mkpart primary ext4 1MiB 513MiB 2>$ERR
check_for_errors "parted -s $device mkpart primary ext4 1MiB 513MiB"
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"
parted -s $device mkpart primary ext4 1MiB 513MiB >/dev/null 2>&1
mkfs.ext4 -q $BOOT_PART >/dev/null 2>&1
else
parted -s $device mkpart ESP fat32 1MiB 513MiB 2>$ERR
check_for_errors "parted -s $device mkpart ESP fat32 1MiB 513MiB"
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"
parted -s $device mkpart ESP fat32 1MiB 513MiB >/dev/null 2>&1
mkfs.vfat -F32 $BOOT_PART >/dev/null 2>&1
fi
(( part_num++ )) # increment the partition number
BOOT_DEVICE="$device" # only grub on BIOS systems uses this
ROOT_PART="${device}${nvme}$part_num" # set root partition label to the second partition
parted -s $device mkpart primary ext4 514MiB 100% 2>$ERR
check_for_errors "parted -s $device mkpart primary ext4 514MiB 100%"
mkfs.ext4 -q $ROOT_PART >/dev/null 2>$ERR
check_for_errors "mkfs.ext4 -q $ROOT_PART"
parted -s $device mkpart primary ext4 514MiB 100% >/dev/null 2>&1
mkfs.ext4 -q $ROOT_PART >/dev/null 2>&1
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
lsblk $device -o NAME,MODEL,TYPE,FSTYPE,SIZE >> /tmp/.devlist
dialog --cr-wrap --backtitle "$BT" --title " $_PrepParts " --textbox /tmp/.devlist 0 0
@ -847,9 +851,7 @@ create_partitions() {
if [[ $choice != "$_PartWipe" && $choice != "$_PartAuto" ]]; then
$choice $device
elif [[ $choice == "$_PartWipe" ]]; then
if yesno "$_PartWipe" "$_PartBody1 $device $_PartWipeBody2"; then
wipe -Ifrev $device
fi
yesno "$_PartWipe" "$_PartBody1 $device $_PartWipeBody2" && wipe -Ifrev $device
create_partitions $device
else
# if auto_partition fails we need to re-initialize the variables, just to be sure
@ -950,7 +952,7 @@ select_filesystem() {
cur_fs="$(lsblk -lno FSTYPE $part)"
tput civis
local choice
choice="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_FSTitle: $part" \
choice="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_FSTitle: $part " \
--menu "\nPartition: ${part}$([[ $cur_fs != "" ]] && echo -n "\nCurrent: ${cur_fs}")\n$_FSBody" 0 0 0 \
$([[ $cur_fs != "" ]] && echo -n "$_Skip -") \
"ext4" "${FS_CMDS[ext4]}" "ext3" "${FS_CMDS[ext3]}" \
@ -962,13 +964,10 @@ select_filesystem() {
[[ $choice == "" ]] && return 1
if yesno "$_FSTitle" "\nFormat $part as $choice?\n"; then
infobox "$_FSTitle" "\nFormatting: $part\n\nCommand: ${FS_CMDS[$choice]}\n" 0
${FS_CMDS[$choice]} $part >/dev/null 2>$ERR
check_for_errors "${FS_CMDS[$choice]} $part"
format $part $choice
else
select_filesystem "$part" || return 1
select_filesystem $part || return 1
fi
return 0
}
@ -986,14 +985,12 @@ select_boot_setup() {
if [[ $BOOTLOADER == 'systemd-boot' ]]; then
EDIT_FILES[9]="/boot/loader/entries/$DIST.conf"
elif [[ $BOOTLOADER == 'syslinux' ]]; then
if [[ $SYS == 'BIOS' ]]; then
BOOT_CMDS[$BOOTLOADER]="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_InstSysTitle " --menu "$_InstSysBody" 0 0 0 \
"syslinux-install_update -iam" "Install to MBR (Master Boot Record)" \
"syslinux-install_update -i" "Install to root partition (/)")"
[[ $? != 0 || ${BOOT_CMDS[$BOOTLOADER]} == "" ]] && return 1
fi
elif [[ $BOOTLOADER == 'syslinux' && $SYS == 'BIOS' ]]; then
BOOT_CMDS[$BOOTLOADER]="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_InstSysTitle " --menu "$_InstSysBody" 0 0 0 \
"syslinux-install_update -iam" "Install to MBR (Master Boot Record)" \
"syslinux-install_update -i" "Install to root partition (/)")"
[[ $? != 0 || ${BOOT_CMDS[$BOOTLOADER]} == "" ]] && return 1
else
EDIT_FILES[9]="/etc/default/grub"
fi
@ -1021,12 +1018,6 @@ setup_boot_device() {
}
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
if (( COUNT == 1 )); then
BOOT_PART="$(awk 'NF > 0 {print $1}' <<< "$PARTS")"
@ -1040,34 +1031,27 @@ select_efi_partition() {
if grep -q 'fat' <<< "$(fsck -N "$BOOT_PART")"; then
local msg="$_FormUefiBody $BOOT_PART $_FormUefiBody2"
yesno "$_PrepMount" "$msg" "Format $BOOT_PART" "Do Not Format" "no" &&
format_efi_as_vfat "$BOOT_PART"
format "$BOOT_PART" "vfat"
else
format_efi_as_vfat "$BOOT_PART"
format "$BOOT_PART" "vfat"
fi
return 0
}
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
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)"
if [[ $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"
fi
yesno "$_PrepMount" "$msg" "Format $BOOT_PART" "Skip Formatting" "no" &&
format "$BOOT_PART" "ext4"
else
format_as_ext4 "$BOOT_PART"
format "$BOOT_PART" "ext4"
fi
fi
return 0
@ -1097,8 +1081,8 @@ select_root_partition() {
infobox "$_PrepMount" "$_OnlyOne for root (/): $ROOT_PART\n" 1
elif [[ $ROOT_PART == "" || $LVM -eq 1 ]]; then
tput civis
ROOT_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" --title "$_PrepMount" \
--menu "$_SelRootBody" 0 0 0 $PARTS)"
ROOT_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_PrepMount " --menu "$_SelRootBody" 0 0 0 $PARTS)"
[[ $? != 0 || $ROOT_PART == "" ]] && return 1
else
local msg="\nUsing $([[ $LUKS -eq 1 ]] && echo -n "encrypted ")root partition:"
@ -1129,8 +1113,8 @@ select_extra_partitions() {
while (( COUNT > 0 )); do
tput civis
local part
part="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_PrepMount " \
--menu "$_ExtPartBody" 0 0 0 "$_Done" "-" $PARTS)"
part="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_PrepMount " --menu "$_ExtPartBody" 0 0 0 "$_Done" "-" $PARTS)"
[[ $? != 0 || $part == "$_Done" || $part == "" ]] && break
# choose what filesystem and get mountpoint
@ -1244,8 +1228,8 @@ luks_open() {
infobox "$_LuksOpen" "${_OnlyOne}: $LUKS_PART\n" 1
else
tput civis
LUKS_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_LuksOpen " \
--menu "$_LuksMenuBody" 0 0 0 $PARTS)"
LUKS_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_LuksOpen " --menu "$_LuksMenuBody" 0 0 0 $PARTS)"
[[ $? != 0 || $LUKS_PART == "" ]] && return 1
fi
@ -1308,7 +1292,7 @@ luks_setup() {
else
tput civis
LUKS_PART="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title "$_LuksEncrypt" --menu "$_LuksEncryptBody" 0 0 0 $PARTS)"
--title " $_LuksEncrypt " --menu "$_LuksEncryptBody" 0 0 0 $PARTS)"
[[ $? != 0 || $LUKS_PART == "" ]] && return 1
fi
else
@ -1387,7 +1371,6 @@ luks_menu() {
luks_keyfile() {
# Only used when choosing grub as bootloader.
# Without a keyfile, during boot the user will be asked
# to enter password for decryption twice, this is annoying
@ -1569,7 +1552,7 @@ lvm_partitions() {
# choose partitions
tput civis
GROUP_PARTS="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title "$_LvmCreateVG" --checklist "$_LvmPvSelBody" 0 0 0 $PARTS)"
--title " $_LvmCreateVG " --checklist "$_LvmPvSelBody" 0 0 0 $PARTS)"
[[ $? != 0 || $GROUP_PARTS == "" ]] && return 1
return 0
@ -1662,8 +1645,8 @@ lvm_menu() {
tput civis
local choice
choice="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_PrepLVM " \
--menu "$_LvmMenu" 0 0 0 \
choice="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_PrepLVM " --menu "$_LvmMenu" 0 0 0 \
"$_LvmCreateVG" "vgcreate -f, lvcreate -L -n" \
"$_LvmDelVG" "vgremove -f" \
"$_LvMDelAll" "lvrmeove, vgremove, pvremove -f" \
@ -1722,10 +1705,8 @@ install_main() {
run_mkinitcpio || return 1
install_bootloader || return 1
oneshot create_user || return 1
oneshot set_hwclock
oneshot edit_configs
oneshot create_user || return 1
return 0
}
@ -1744,7 +1725,7 @@ install_base() {
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
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
[[ $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"
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"
fi
@ -2124,7 +2107,7 @@ install_bootloader() {
local msg="$_InstBootloader $BOOTLOADER\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
@ -2154,9 +2137,7 @@ run_mkinitcpio() {
# new HOOKS needed in /etc/mkinitcpio.conf if we used LUKS and/or LVM
(( LVM == 1 )) && add="lvm2"
(( LUKS == 1 )) && add="encrypt$([[ $add != "" ]] && echo -n " $add")"
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"
sed -i "s/block filesystems/block ${add} filesystems ${MKINIT_HOOKS}/g" $conf
tput civis
chroot_cmd "mkinitcpio -p $KERNEL" 2>$ERR
@ -2236,7 +2217,7 @@ main() {
4) lvm_menu ;;
5) select_partitions ;;
6) config_install ;;
7) install_main ;;
7) install_main && edit_configs ;;
*) wrap_up "$_CloseInstBody" 'Exit' 'Back' 'exit'
esac
}

View File

@ -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 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
_NotRoot="\nThe installer must be run as root or using sudo.\n"