diff --git a/README.md b/README.md index 79c2f49..81aef19 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,6 @@ - `dialog` for all user input/output. - `vim` for editing files post install. - `parted` for partition creation. -- `wipe` for the secure wipe. - `arch-chroot` to perform operations in a chroot. - `chpasswd` to set root and user passwords. - `awk` `sed` `grep` `uniq` `sort` `find` `ping` `mkfs` `lsblk` `curl` diff --git a/lang/english.trans b/lang/english.trans index d20fd58..94aed38 100644 --- a/lang/english.trans +++ b/lang/english.trans @@ -41,7 +41,7 @@ _ConfLocale="Language and Timezone" # Select Config Files _EditTitle="Edit Files" -_EditBody="\nBefore exiting the installer you may select configuration files to review/change." +_EditBody="\nBefore exiting you can select configuration files from below to review/change.\n\nIf you need to make additional changes with the drives still mounted, use Ctrl-z to pause the installer and return to the terminal, when finished type 'fg' and Enter or Ctrl-z again to resume the installer." # Close Installer _CloseInst="Close Installer" @@ -58,14 +58,14 @@ _TimeSubZBody="\nSelect the nearest city to your location from the list below." _TimeZQ="\nSet time zone as:" # bootloader -_MntBootBody="\nSelect which bootloader you want to use, if you have a boot partition the mountpoint on the right will be used.\n\nSystemd-boot automatically detects other bootloaders and is recommended for multiboot, grub also does this however you will need to run 'grub-mkconfig' manually after first boot in order to detect other bootloaders and add menu entries for them." +_MntBootBody="\nSelect which bootloader to use." _InstSysTitle="Install Syslinux" _InstSysBody="\nInstall syslinux to the master boot record (MBR) or to root (/)?" # mirrors _MirrorTitle="Setup Mirrorlist" -_MirrorSetup="\nWant the mirrorlist automatically sorted?\n\nThis will take longer but guarantees the fastest mirrors.\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" +_MirrorSetup="\nWant the mirrorlist automatically sorted?\n\nThis will take longer but gets the fastest mirrors.\n" +_MirrorCmd="\nThe command below will be used to sort the mirrorlist, edit the command if needed.\n" # window managers and packages _WMChoice="Select WMs or DEs" @@ -154,7 +154,7 @@ _SelSwpNone="None" _SelSwpErr="Swap Setup Error: Must be 1(M|G) or greater, and can only contain whole numbers\n\nSize Entered:" _SelSwpSize="\nEnter the size to use for swap in MB or GB.\n\nFor ease of use and as an example the size has been filled in to the size of your system memory (RAM).\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 modern UEFI systems. It's usually the first partition on the drive, less than 512M, and will be formatted as vfat/fat32 if not already." +_SelUefiBody="\nSelect the system EFI boot partition.\n\nThis is a required partition for booting UEFI systems. It's usually the first partition on the drive, less than 512M, and will be formatted as vfat/fat32 if not already." _FormUefiBody="IMPORTANT:\n\nThe EFI partition" _FormBiosBody="IMPORTANT:\n\nThe boot partition" _FormUefiBody2="is already formatted as vfat/fat32.\n\nFor a clean install, previously existing partitions should be reformatted, however this removes ALL data (bootloaders) on the partition so choose carefully.\n\nDo you want to reformat the partition?\n" diff --git a/src/archlabs-installer b/src/archlabs-installer index d54c809..abab2ad 100755 --- a/src/archlabs-installer +++ b/src/archlabs-installer @@ -10,7 +10,7 @@ # immutable globals -readonly VER="1.7.40" # Installer version +readonly VER="1.7.43" # Installer version readonly DIST="ArchLabs" # Linux distributor readonly MNT="/mnt" # Install mountpoint readonly ERR="/tmp/errlog" # Built-in error log @@ -18,13 +18,13 @@ readonly DBG="/tmp/debuglog" # Built-in error log main() { - if [[ $CURRENT_MENU != "main" ]]; then + if [[ $CURRENT_MENU != "main" && $SAVED ]]; then + CURRENT_MENU="main" + SELECTED=$((SAVED + 1)) + unset SAVED + elif [[ $CURRENT_MENU != "main" ]]; then SELECTED=1 CURRENT_MENU="main" - if [[ $SAVED ]]; then - SELECTED=$((SAVED + 1)) - unset SAVED - fi elif (( SELECTED < 8 )); then ((SELECTED++)) # increment the highlighted menu item fi @@ -33,31 +33,29 @@ main() SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \ --title " $_PrepTitle " --default-item $SELECTED \ --cancel-label "Exit" --menu "$_PrepBody" 0 0 0 \ - "1" "$_PrepShowDev" "2" "$_PrepParts" \ - "3" "$_PrepLUKS" "4" "$_PrepLVM" \ - "5" "$_PrepMount" "6" "$_PrepConfig" \ - "7" "Check Choices" "8" "$_PrepInstall") + "1" "$_PrepShowDev" \ + "2" "$_PrepParts" \ + "3" "$_PrepLUKS" \ + "4" "$_PrepLVM" \ + "5" "$_PrepMount" \ + "6" "$_PrepConfig" \ + "7" "Check Choices" \ + "8" "$_PrepInstall") - if [[ $SELECTED ]]; then - if (( SELECTED == 8 )); then - preinstall_checks 1 || return 1 - elif (( SELECTED == 6 )); then - preinstall_checks || return 1 - elif [[ $WARN != true ]] && (( SELECTED == 2 || SELECTED == 5 )); then - msgbox "$_PrepTitle" "$_WarnMount" - WARN=true - fi + if [[ $WARN != true && $SELECTED =~ (2|5) ]]; then + WARN=true + msgbox "$_PrepTitle" "$_WarnMount" fi case $SELECTED in 1) device_tree ;; 2) partition || SELECTED=$((SELECTED - 1)) ;; 3) luks_menu || SELECTED=$((SELECTED - 1)) ;; - 4) lvm_menu || SELECTED=$((SELECTED - 1)) ;; - 5) mnt_menu || SELECTED=$((SELECTED - 1)) ;; - 6) cfg_menu || SELECTED=$((SELECTED - 1)) ;; + 4) lvm_menu || SELECTED=$((SELECTED - 1)) ;; + 5) mnt_menu || SELECTED=$((SELECTED - 1)) ;; + 6) preinstall_checks && { cfg_menu || SELECTED=$((SELECTED - 1)); } ;; 7) show_cfg ;; - 8) install ;; + 8) preinstall_checks 1 && install ;; *) yesno "$_CloseInst" "$_CloseInstBody" "Exit" "Back" && die esac } diff --git a/src/lib/boot.sh b/src/lib/boot.sh index 1247f9f..b0004ee 100644 --- a/src/lib/boot.sh +++ b/src/lib/boot.sh @@ -19,14 +19,13 @@ declare -Ag BMNTS=( [BIOS-grub]="/boot" [UEFI-grub]="/boot/efi" [BIOS-syslinux]="/boot" -[UEFI-syslinux]="/boot" [UEFI-systemd-boot]="/boot" ) # bootloader options with respective boot partition mountpoint declare -Ag BOOTLDRS=( [BIOS]="grub ${BMNTS[BIOS-grub]} syslinux ${BMNTS[BIOS-syslinux]}" -[UEFI]="systemd-boot ${BMNTS[UEFI-systemd-boot]} grub ${BMNTS[UEFI-grub]} syslinux ${BMNTS[UEFI-syslinux]}" +[UEFI]="systemd-boot ${BMNTS[UEFI-systemd-boot]} grub ${BMNTS[UEFI-grub]}" ) setup_boot() @@ -58,16 +57,10 @@ setup_grub() luks_pass "$_LuksOpen" "$ROOT_PART" || return 1 fi - if [[ $IS_64BIT == true ]]; then - local ttype='x86_64-efi' - else - local ttype="i386-efi" - fi - # the mount mess is needed for os-prober to work properly in the chroot BCMDS[grub]="mkdir -p /run/udev && mkdir -p /run/lvm && mount --bind /hostrun/udev /run/udev && mount --bind /hostrun/lvm /run/lvm && - ${BCMDS[grub]} --target=$ttype --efi-directory=${BMNTS[UEFI-grub]} --bootloader-id=$DIST && + ${BCMDS[grub]} --efi-directory=${BMNTS[UEFI-grub]} --bootloader-id=$DIST && grub-mkconfig -o /boot/grub/grub.cfg && umount /run/udev && umount /run/lvm" fi @@ -77,17 +70,7 @@ setup_grub() setup_syslinux() { - if [[ $SYS == 'BIOS' ]]; then - EDIT_FILES[9]="/boot/syslinux/syslinux.cfg" - if ! BCMDS[syslinux]="$(menubox "$_InstSysTitle" "$_InstSysBody" 0 0 0 \ - "syslinux-install_update -iam" "Install to MBR (Master Boot Record)" \ - "syslinux-install_update -i" "Install to root partition (/)")"; then - return 1 - fi - else - EDIT_FILES[9]="/boot/EFI/syslinux/syslinux.cfg" - BCMDS[syslinux]="efibootmgr -c -d $BOOT_DEVICE -p $BOOT_PART_NUM -l /EFI/syslinux/syslinux.efi -L $DIST" - fi + EDIT_FILES[9]="/boot/syslinux/syslinux.cfg" } setup_systemd-boot() @@ -148,13 +131,13 @@ prerun_systemd-boot() [[ $ROOT_PART =~ /dev/mapper ]] || ROOT_PART_ID="PART$ROOT_PART_ID" # create the boot entry configs - mkdir -p ${MNT}${BMNTS[$SYS-$BOOTLDR]}/loader/entries - cat > ${MNT}${BMNTS[$SYS-$BOOTLDR]}/loader/loader.conf << EOF + mkdir -p ${MNT}${BMNTS[$SYS-systemd-boot]}/loader/entries + cat > ${MNT}${BMNTS[$SYS-systemd-boot]}/loader/loader.conf << EOF default $DIST timeout 5 editor no EOF - cat > ${MNT}${BMNTS[$SYS-$BOOTLDR]}/loader/entries/${DIST}.conf << EOF + cat > ${MNT}${BMNTS[$SYS-systemd-boot]}/loader/entries/${DIST}.conf << EOF title $DIST Linux linux /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd %s" "/${UCODE}.img") initrd /initramfs-$KERNEL.img @@ -180,17 +163,9 @@ EOF prerun_syslinux() { - if [[ $SYS == 'UEFI' ]]; then - local cfgdir="${MNT}${BMNTS[$SYS-$BOOTLDR]}/EFI/syslinux" - local cfgsrcdir="/usr/lib/syslinux/efi32" - [[ $IS_64BIT == true ]] && cfgsrcdir="/usr/lib/syslinux/efi64/" - else - local cfgdir="$MNT${BMNTS[$SYS-$BOOTLDR]}/syslinux" - local cfgsrcdir="/usr/lib/syslinux/bios" - fi + mkdir -pv $MNT${BMNTS[$SYS-syslinux]}/syslinux + cp -rfv /usr/lib/syslinux/bios/* $MNT${BMNTS[$SYS-syslinux]}/syslinux/ - mkdir -p $cfgdir - cp -rf $cfgsrcdir/* $cfgdir/ cat > $cfgdir/syslinux.cfg << EOF UI menu.c32 PROMPT 0 @@ -217,11 +192,7 @@ EOF install_bootloader() { if ! [[ $ROOT_PART =~ /dev/mapper ]]; then - if [[ $BOOTLDR == 'syslinux' ]]; then - ROOT_PART_ID="UUID=$(blkid -s UUID -o value $ROOT_PART)" - else - ROOT_PART_ID="UUID=$(blkid -s PARTUUID -o value $ROOT_PART)" - fi + ROOT_PART_ID="UUID=$(blkid -s PARTUUID -o value $ROOT_PART)" else # for LVM we just use the partition label ROOT_PART_ID="$ROOT_PART" @@ -232,7 +203,7 @@ install_bootloader() # remove old UEFI boot entries if [[ $SYS == 'UEFI' ]]; then - find ${MNT}${BMNTS[$SYS-$BOOTLDR]}/EFI/ \ + find ${MNT}${BMNTS[UEFI-$BOOTLDR]}/EFI/ \ -maxdepth 1 -mindepth 1 -name '[aA][rR][cC][hH][lL]abs' \ -type d -exec rm -rf '{}' \; >/dev/null 2>&1 fi @@ -249,7 +220,7 @@ install_bootloader() fi # copy efi stub to generic catch all - if [[ $SYS == 'UEFI' && ($BOOTLDR == 'grub' || $BOOTLDR == 'syslinux') ]]; then + if [[ $SYS == 'UEFI' && $BOOTLDR == 'grub' ]]; then uefi_boot_fallback fi @@ -260,36 +231,24 @@ uefi_boot_fallback() { # some UEFI firmware requires a dir in the ESP with a generic bootx64.efi # see: https://wiki.archlinux.org/index.php/GRUB#UEFI - # also: https://wiki.archlinux.org/index.php/syslinux#UEFI_Systems - local esp="${MNT}${BMNTS[$SYS-$BOOTLDR]}" + local esp="${MNT}${BMNTS[UEFI-grub]}" local default="boot" default="$(find $esp/EFI/ -maxdepth 1 -mindepth 1 -name '[Bb][oO][oO][tT]' -type d)" default="$(basename $default)" if [[ -d $esp/EFI/$default ]]; then - rm -rf $esp/EFI/$default/* + rm -rfv $esp/EFI/$default/* else - mkdir -p $esp/EFI/$default + mkdir -pv $esp/EFI/$default fi - if [[ $BOOTLDR == 'syslinux' ]]; then - cp -rf $esp/EFI/syslinux/* $esp/EFI/$default/ - cp -f $esp/EFI/syslinux/syslinux.efi $esp/EFI/$default/bootx64.efi - elif [[ $BOOTLDR == 'grub' && $IS_64BIT == true ]]; then - cp -f $esp/EFI/$DIST/grubx64.efi $esp/EFI/$default/bootx64.efi - elif [[ $BOOTLDR == 'grub' ]]; then - cp -f $esp/EFI/$DIST/grubia32.efi $esp/EFI/$default/bootia32.efi - fi + cp -fv $esp/EFI/$DIST/grubx64.efi $esp/EFI/$default/bootx64.efi return 0 } shim_secure_boot() { - # still a W.I.P - local shim_file="shim.efi" - [[ $IS_64BIT == true ]] && shim_file="shim64.efi" - efibootmgr -c -w -L $DIST -d $BOOT_DEVICE -p $BOOT_PART_NUM -l ${MNT}${BMNTS[$SYS-$BOOTLDR]}/$shim_file - return 0 + efibootmgr -c -w -L $DIST -d $BOOT_DEVICE -p $BOOT_PART_NUM -l ${MNT}${BMNTS[$SYS-$BOOTLDR]}/shim64.efi } diff --git a/src/lib/dialogs.sh b/src/lib/dialogs.sh index dfaadf4..d690497 100644 --- a/src/lib/dialogs.sh +++ b/src/lib/dialogs.sh @@ -164,13 +164,18 @@ select_language() { tput civis local lang - local title="\nLanguage - sprache - taal - språk - lingua - idioma - nyelv - língua\n" - lang=$(menubox "Select Language" "$title" 0 0 0 \ - "1" "English (en_**)" "2" "Español (es_ES)" \ - "3" "Português [Brasil] (pt_BR)" "4" "Português (pt_PT)" \ - "5" "Français (fr_FR)" "6" "Russkiy (ru_RU)" \ - "7" "Italiano (it_IT)" "8" "Nederlands (nl_NL)" \ - "9" "Magyar (hu_HU)" "10" "Chinese (zh_CN)") + lang=$(menubox "Select Language" \ + "\nLanguage - sprache - taal - språk - lingua - idioma - nyelv - língua\n" 0 0 0 \ + "1" "English (en_**)" \ + "2" "Español (es_ES)" \ + "3" "Português [Brasil] (pt_BR)" \ + "4" "Português (pt_PT)" \ + "5" "Français (fr_FR)" \ + "6" "Russkiy (ru_RU)" \ + "7" "Italiano (it_IT)" \ + "8" "Nederlands (nl_NL)" \ + "9" "Magyar (hu_HU)" \ + "10" "Chinese (zh_CN)") local srcdir="/usr/share/archlabs/installer/lang" src $srcdir/english.trans @@ -395,11 +400,18 @@ select_packages() fi tput civis - SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_Packages " \ - --default-item $SELECTED --menu "$_PackageMenu" 0 0 0 \ - "1" "Browsers" "2" "Editors" "3" "Terminals" \ - "4" "Multimedia" "5" "Chat/Mail" "6" "Professional" \ - "7" "System" "8" "Miscellaneous" "9" "$_Done") + SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \ + --title " $_Packages " --default-item $SELECTED \ + --menu "$_PackageMenu" 0 0 0 \ + "1" "Browsers" \ + "2" "Editors" \ + "3" "Terminals" \ + "4" "Multimedia" \ + "5" "Chat/Mail" \ + "6" "Professional" \ + "7" "System" \ + "8" "Miscellaneous" \ + "9" "$_Done") if [[ $SELECTED -lt 9 ]]; then case $SELECTED in @@ -488,11 +500,19 @@ edit_configs() fi SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \ - --title " $_EditTitle " --default-item $SELECTED --menu "$_EditBody" 0 0 0 \ - "1" "$exitstr" "2" "${EDIT_FILES[2]}" "3" "${EDIT_FILES[3]}" \ - "4" "${EDIT_FILES[4]}" "5" "${EDIT_FILES[5]}" "6" "${EDIT_FILES[6]}" \ - "7" "${EDIT_FILES[7]}" "8" "${EDIT_FILES[8]}" "9" "${EDIT_FILES[9]}" \ - "10" "${EDIT_FILES[10]}" "11" "${EDIT_FILES[11]}") + --title " $_EditTitle " --default-item $SELECTED \ + --menu "$_EditBody" 0 0 0 \ + "1" "$exitstr" \ + "2" "${EDIT_FILES[2]}" \ + "3" "${EDIT_FILES[3]}" \ + "4" "${EDIT_FILES[4]}" \ + "5" "${EDIT_FILES[5]}" \ + "6" "${EDIT_FILES[6]}" \ + "7" "${EDIT_FILES[7]}" \ + "8" "${EDIT_FILES[8]}" \ + "9" "${EDIT_FILES[9]}" \ + "10" "${EDIT_FILES[10]}" \ + "11" "${EDIT_FILES[11]}") if [[ ! $SELECTED || $SELECTED -eq 1 ]]; then [[ $DEBUG == true && -r $DBG ]] && vim $DBG diff --git a/src/lib/install.sh b/src/lib/install.sh index b46a166..984e046 100644 --- a/src/lib/install.sh +++ b/src/lib/install.sh @@ -23,7 +23,6 @@ install() oneshot install_base # generate /etc/fstab and touch it up if we used a swapfile - printf "\n\n" genfstab -U $MNT > $MNT/etc/fstab 2>$ERR echeck "genfstab -U $MNT > $MNT/etc/fstab" [[ -f $MNT/swapfile ]] && sed -i "s~${MNT}~~" $MNT/etc/fstab @@ -57,43 +56,30 @@ install() install_base() { - # compressed image? if [[ -e /run/archiso/sfs/airootfs/etc/skel ]]; then - printf "\n\nUnpacking base system --- Total: ~ 2.6G\n\n" + printf "\n\nUnpacking base system --- Total: ~ 2.6G\n" rsync -ah --info=progress2 /run/archiso/sfs/airootfs/ $MNT/ else - # update the mirrorlist.. MUST be done before pacstrapping or it may be slow oneshot mirrorlist_sort - - printf "\nPacstrapping the base system.\n\n" local vmpkgs if [[ $VM && $KERNEL == 'linux-lts' ]]; then vmpkgs="virtualbox-guest-utils virtualbox-guest-dkms linux-lts-headers" elif [[ $VM && $KERNEL == 'linux' ]]; then vmpkgs="virtualbox-guest-utils virtualbox-guest-modules-arch" fi - local packages packages="$(grep -hv '^#' /usr/share/archlabs/installer/packages.txt)" - pacstrap $MNT base $KERNEL $UCODE $packages $vmpkgs fi - # remove archiso init files and clean up install files rm -rf $MNT/etc/mkinitcpio-archiso.conf find $MNT/usr/lib/initcpio -name 'archiso*' -type f -exec rm '{}' \; - - # journal sed -i 's/volatile/auto/g' $MNT/etc/systemd/journald.conf - - # allow members of group 'wheel' to execute sudo commands sed -i "s/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g" $MNT/etc/sudoers if [[ $VM ]]; then - # in a VM remove xorg configs, these cause issues - rm -rf $MNT/etc/X11/xorg.conf.d + rm -rfv $MNT/etc/X11/xorg.conf.d/*?.conf elif [[ $(lspci | grep ' VGA ' | grep 'Intel') != "" ]]; then - # xorg config for intel, this should never happen in a VM cat > $MNT/etc/X11/xorg.conf.d/20-intel.conf < manufacturer-ucode.img - [[ $UCODE ]] && cp -f $RUN/${UCODE/-/_}.img $MNT/boot/${UCODE}.img + [[ $KERNEL != 'linux-lts' ]] && cp -vf $RUN/x86_64/vmlinuz $MNT/boot/vmlinuz-linux + [[ $UCODE && ! $VM ]] && cp -vf $RUN/${UCODE/-/_}.img $MNT/boot/${UCODE}.img fi - # copy network settings if [[ -e /etc/NetworkManager/system-connections ]]; then - cp -rf /etc/NetworkManager/system-connections $MNT/etc/NetworkManager/ + cp -rvf /etc/NetworkManager/system-connections $MNT/etc/NetworkManager/ fi - cp -f /etc/resolv.conf $MNT/etc/ + cp -fv /etc/resolv.conf $MNT/etc/ - - # set the locale - printf "\n\n" cat > $MNT/etc/locale.conf << EOF LANG=$LOCALE EOF @@ -127,18 +106,15 @@ EOF LANG=$LOCALE EOF sed -i "s/#en_US.UTF-8/en_US.UTF-8/g; s/#${LOCALE}/${LOCALE}/g" $MNT/etc/locale.gen - chrun "locale-gen" 2>/dev/null + chrun "echo && locale-gen" 2>/dev/null - # set the timezone - chrun "ln -sf /usr/share/zoneinfo/$ZONE/$SUBZONE /etc/localtime" 2>/dev/null + chrun "ln -svf /usr/share/zoneinfo/$ZONE/$SUBZONE /etc/localtime" 2>/dev/null if [[ $BROADCOM_WL == true ]]; then echo 'blacklist bcma' >> $MNT/etc/modprobe.d/blacklist.conf rm -f $MNT/etc/modprobe/ fi - # set the keymaps - mkdir -p $MNT/etc/X11/xorg.conf.d cat > $MNT/etc/X11/xorg.conf.d/00-keyboard.conf < $MNT/etc/vconsole.conf < $MNT/etc/hostname << EOF $HOSTNAME EOF @@ -186,7 +156,7 @@ create_user() if [[ $MYSHELL != *zsh ]]; then chrun "usermod -s $MYSHELL root" - cp -f $MNT/etc/skel/.mkshrc /root/.mkshrc + cp -fv $MNT/etc/skel/.mkshrc /root/.mkshrc fi local groups='audio,autologin,floppy,log,network,rfkill,scanner,storage,optical,power,wheel' @@ -201,8 +171,8 @@ create_user() # for neovim set up ~/.config/nvim if [[ $PACKAGES =~ neovim ]]; then mkdir -p $MNT/home/$NEWUSER/.config/nvim - cp -f $MNT/home/$NEWUSER/.vimrc $MNT/home/$NEWUSER/.config/nvim/init.vim - cp -rf $MNT/home/$NEWUSER/.vim/colors $MNT/home/$NEWUSER/.config/nvim/colors + cp -fv $MNT/home/$NEWUSER/.vimrc $MNT/home/$NEWUSER/.config/nvim/init.vim + cp -rfv $MNT/home/$NEWUSER/.vim/colors $MNT/home/$NEWUSER/.config/nvim/colors fi [[ $INSTALL_WMS =~ dwm ]] && suckless_install @@ -313,9 +283,6 @@ run_mkinitcpio() local add="" # setup a keyfile for LUKS.. Only when choosing grub and system is UEFI if [[ $LUKS && ! $LVM && $SYS == 'UEFI' && $BOOTLDR == 'grub' ]]; then - if [[ $LUKS_PASS ]]; then - luks_pass "$_LuksOpen" "$LUKS_NAME" || return 1 - fi luks_keyfile fi diff --git a/src/lib/lvm.sh b/src/lib/lvm.sh index 62c0858..3076503 100644 --- a/src/lib/lvm.sh +++ b/src/lib/lvm.sh @@ -9,8 +9,8 @@ # shellcheck disable=2154,2034 declare -g LVM="" +declare -g GROUP_PARTS="" declare -g VOL_GROUP_MB=0 -declare -g GROUP_PARTS=0 lvm_detect() { diff --git a/src/lib/mount.sh b/src/lib/mount.sh index a3ddbd6..1ae41ee 100644 --- a/src/lib/mount.sh +++ b/src/lib/mount.sh @@ -8,7 +8,9 @@ # shellcheck disable=2154,2153,2046,2034 -readonly SYS_MEM="$(awk '/MemTotal/ {print int($2 / 1024)"M"}' /proc/meminfo)" +readonly SYS_MEM="$(awk '/MemTotal/ { + print int($2 / 1024)"M" +}' /proc/meminfo)" readonly LOCALES="$(awk '/\.UTF-8/ { gsub(/# .*|#/, "") @@ -121,19 +123,44 @@ select_mount_opts() select_filesystem() { local part="$1" - local fs cur_fs str title + local fs + + local cur_fs cur_fs="$(lsblk -lno FSTYPE $part)" - str="$([[ $cur_fs && $part != "$ROOT_PART" ]] && printf "\nExisting Filesystem: %s" "$cur_fs")" + + local title="\nSelect which filesystem you want to use for $part\n\nPartition Name: " + tput civis - title="\nSelect which filesystem you want to use for $part\n\nPartition Name: " - fs="$(menubox "$_FSTitle: $part" "${title}${part}${str}$_FSBody" 0 0 0 \ - $([[ $cur_fs && $part != "$ROOT_PART" ]] && printf "%s" "$_Skip -") \ - "ext4" "${FS_CMDS[ext4]}" "ext3" "${FS_CMDS[ext3]}" \ - "ext2" "${FS_CMDS[ext2]}" "vfat" "${FS_CMDS[vfat]}" \ - "ntfs" "${FS_CMDS[ntfs]}" "f2fs" "${FS_CMDS[f2fs]}" \ - "jfs" "${FS_CMDS[jfs]}" "nilfs2" "${FS_CMDS[nilfs2]}" \ - "reiserfs" "${FS_CMDS[reiserfs]}" "xfs" "${FS_CMDS[xfs]}")" + if [[ $cur_fs && $part != "$ROOT_PART" ]]; then + fs="$(menubox "$_FSTitle: $part" \ + "${title}${part}\nExisting Filesystem: ${cur_fs}$_FSBody" 0 0 0 \ + "$_Skip" "-" \ + "ext4" "${FS_CMDS[ext4]}" \ + "ext3" "${FS_CMDS[ext3]}" \ + "ext2" "${FS_CMDS[ext2]}" \ + "vfat" "${FS_CMDS[vfat]}" \ + "ntfs" "${FS_CMDS[ntfs]}" \ + "f2fs" "${FS_CMDS[f2fs]}" \ + "jfs" "${FS_CMDS[jfs]}" \ + "nilfs2" "${FS_CMDS[nilfs2]}" \ + "reiserfs" "${FS_CMDS[reiserfs]}" \ + "xfs" "${FS_CMDS[xfs]}")" + else + fs="$(menubox "$_FSTitle: $part" \ + "${title}${part}$_FSBody" 0 0 0 \ + "ext4" "${FS_CMDS[ext4]}" \ + "ext3" "${FS_CMDS[ext3]}" \ + "ext2" "${FS_CMDS[ext2]}" \ + "vfat" "${FS_CMDS[vfat]}" \ + "ntfs" "${FS_CMDS[ntfs]}" \ + "f2fs" "${FS_CMDS[f2fs]}" \ + "jfs" "${FS_CMDS[jfs]}" \ + "nilfs2" "${FS_CMDS[nilfs2]}" \ + "reiserfs" "${FS_CMDS[reiserfs]}" \ + "xfs" "${FS_CMDS[xfs]}")" + fi + [[ $fs == "$_Skip" ]] && return 0 || { [[ $fs == "" ]] && return 1; } if yesno "$_FSTitle" "\nFormat $part as $fs?\n" "Format" "Go Back"; then @@ -141,6 +168,7 @@ select_filesystem() else select_filesystem $part || return 1 fi + return 0 } @@ -150,16 +178,15 @@ select_efi_partition() if (( COUNT == 1 )); then BOOT_PART="$(awk 'NF > 0 {print $1}' <<< "$PARTS")" infobox "$_PrepMount" "$_OnlyOne for EFI: $BOOT_PART\n" 1 - else - if ! BOOT_PART="$(menubox "$_PrepMount" "$_SelUefiBody" 0 0 0 $PARTS)"; then - return 1 - fi + elif ! BOOT_PART="$(menubox "$_PrepMount" "$_SelUefiBody" 0 0 0 $PARTS)"; then + return 1 fi 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" && + if yesno "$_PrepMount" "$msg" "Format $BOOT_PART" "Do Not Format" "no"; then format "$BOOT_PART" "vfat" + fi else format "$BOOT_PART" "vfat" fi @@ -189,8 +216,12 @@ select_root_partition() ROOT_PART="/dev/mapper/$LUKS_NAME" decr_count "$LUKS_PART" elif [[ $LVM ]]; then - [[ $LUKS ]] && decr_count "$LUKS_PART" - for part in $(printf "%s" "$GROUP_PARTS"); do decr_count "$part"; done + if [[ $LUKS ]]; then + decr_count "$LUKS_PART" + fi + for part in $(printf "%s" "$GROUP_PARTS"); do + decr_count "$part" + done ROOT_PART="" fi @@ -203,8 +234,7 @@ select_root_partition() return 1 fi else - local msg="\nUsing${LUKS} root partition:" # $LUKS might just be an empty string - infobox "$_PrepMount" "$msg $ROOT_PART\n" 1 + infobox "$_PrepMount" "\nUsing${LUKS} root partition: $ROOT_PART\n" 1 fi select_filesystem "$ROOT_PART" || { ROOT_PART=""; return 1; } @@ -219,17 +249,17 @@ select_extra_partitions() local part if ! part="$(menubox "$_PrepMount " "$_ExtPartBody" 0 0 0 "$_Done" "-" $PARTS)" || [[ $part == "$_Done" ]]; then break + elif ! select_filesystem "$part"; then + break + return 1 + elif ! select_mountpoint; then + break + return 1 + elif ! mount_partition "$part" "$EXTRA_MNT"; then + break + return 1 fi - - # choose what filesystem and get the mountpoint - select_filesystem "$part" || { break; return 1; } - select_mountpoint || { break; return 1; } - - # mount it - mount_partition "$part" "$EXTRA_MNT" || { break; return 1; } EXTRA_MNTS="$EXTRA_MNTS $part: $EXTRA_MNT" - - # if the mountpoint was /usr add 'usr' to MKINIT_HOOKS [[ $EXTRA_MNT == "/usr" && $MKINIT_HOOKS != *usr* ]] && MKINIT_HOOKS="usr $MKINIT_HOOKS" done diff --git a/src/lib/package.sh b/src/lib/package.sh index 82c2941..cdc7394 100644 --- a/src/lib/package.sh +++ b/src/lib/package.sh @@ -8,22 +8,24 @@ # shellcheck disable=2154,2153,2046,2034 -# package extras -# if you add a package to $PACKAGES in any dialog and it uses or requires some -# additional packages, you can add them here to keep it simple for the end user + +# PKG_EXT: if you add a package to $PACKAGES in any dialog +# and it uses/requires some additional packages, +# you can add them here to keep it simple: [package]="extra" +# duplicates are removed with `uniq` before install declare -gA PKG_EXT=( [vlc]="qt4" [mpd]="mpc" [mupdf]="mupdf-tools" [qt5ct]="qt5-styleplugins" -[zathura]="zathura-pdf-poppler" -[cairo-dock]="cairo-dock-plug-ins" -[noto-fonts]="noto-fonts-emoji" -[kdenlive]="kdebase-runtime dvdauthor frei0r-plugins breeze breeze-gtk" [vlc]="qt5ct qt5-styleplugins" -[kdenlive]="qt5ct qt5-styleplugins" # duplicates are stripped with `uniq` later +[zathura]="zathura-pdf-poppler" +[noto-fonts]="noto-fonts-emoji" +[cairo-dock]="cairo-dock-plug-ins" +[kdenlive]="qt5ct qt5-styleplugins" [qbittorrent]="qt5ct qt5-styleplugins" [qutebrowser]="qt5ct qt5-styleplugins" +[kdenlive]="kdebase-runtime dvdauthor frei0r-plugins breeze breeze-gtk" ) select_browsers() diff --git a/src/lib/part.sh b/src/lib/part.sh index d0b4044..161a785 100644 --- a/src/lib/part.sh +++ b/src/lib/part.sh @@ -203,23 +203,22 @@ auto_partition() { local device="$1" local size - size=$(lsblk -lno SIZE $device | - awk 'NR == 1 { - if ($1 ~ "G") { - sub(/G/, ""); print ($1 * 1000 - 512) / 1000"G" - } else { - sub(/M/, ""); print ($1 - 512)"M" - } - }') - - local msg="$_PartBody2" - local table="gpt" - local fs="fat32"; + size=$(lsblk -lno SIZE $device | awk 'NR == 1 { + if ($1 ~ "G") { + sub(/G/, ""); print ($1 * 1000 - 512) / 1000"G" + } else { + sub(/M/, ""); print ($1 - 512)"M" + } + }') if [[ $SYS == 'BIOS' ]]; then - msg="$(sed 's|vfat/fat32|ext4|' <<< "$msg")" - table="msdos" - fs="ext4" + local msg="$(sed 's|vfat/fat32|ext4|' <<< "$_PartBody2")" + local table="msdos" + local fs="ext4" + else + local msg="$_PartBody2" + local table="gpt" + local fs="fat32"; fi # confirm or bail @@ -231,10 +230,9 @@ auto_partition() dev_info="$(parted -s $device print)" # walk the partitions on the device in reverse order and delete them - # shellcheck disable=2013 - for i in $(awk '/^ [1-9][0-9]?/ {print $1}' <<< "$dev_info" | sort -r); do + while read -r i; do parted -s $device rm $i >/dev/null 2>&1 - done + done <<< "$(awk '/^ [1-9][0-9]?/ {print $1}' <<< "$dev_info" | sort -r)" if [[ $(awk '/Table:/ {print $3}' <<< "$dev_info") != "$table" ]]; then parted -s $device mklabel $table >/dev/null 2>&1 @@ -338,4 +336,5 @@ find_partitions() fi return 0 + } diff --git a/src/lib/utils.sh b/src/lib/utils.sh index 66308a6..7226ed2 100644 --- a/src/lib/utils.sh +++ b/src/lib/utils.sh @@ -129,7 +129,6 @@ system_devices() system_identify() { - declare -g IS_64BIT=false local efidir="/sys/firmware/efi" if grep -q 'GenuineIntel' /proc/cpuinfo; then @@ -146,8 +145,6 @@ system_identify() if [[ -d $efidir ]]; then SYS="UEFI" - [[ $(cat $efidir/fw_platform_size) == 64 ]] && IS_64BIT=true - if ! grep -q $efidir/efivars <<< "$(mount)"; then mount -t efivarfs efivarfs $efidir/efivars fi diff --git a/src/packages.txt b/src/packages.txt index 6f1242f..f168abc 100644 --- a/src/packages.txt +++ b/src/packages.txt @@ -1,68 +1,35 @@ # base -acpid arch-install-scripts b43-firmware b43-fwcutter -bridge-utils broadcom-wl -btrfs-progs clonezilla -crda -darkhttpd -ddrescue dhclient dhcpcd -dmidecode -dmraid -dnsmasq -dnsutils ethtool exfat-utils f2fs-tools fakeroot -fsarchiver -gnu-netcat -gpm gptfdisk grub vim hdparm ipw2100-fw ipw2200-fw -irssi laptop-detect -lftp -lsscsi -mtools -ndisc6 nfs-utils nilfs-utils -nmap ntfs-3g -openconnect -openssh -openvpn pacman-contrib -partclone parted -partimage -ppp -pptpclient refind-efi -rp-pppoe rsync sdparm -sg3_utils smartmontools sudo -tcpdump -testdisk -usb_modeswitch -vpnc wget wireless_tools wpa_actiond -wvdial xl2tpd # xorg @@ -72,10 +39,8 @@ xorg-drivers xorg-server xorg-xinit -# installer -dialog +# install os-prober -wipe # codecs alsa-firmware @@ -94,7 +59,6 @@ pulseaudio-alsa # xfce xfce4-settings xfce4-power-manager -gtk-engines gtk-engine-murrine # network @@ -108,13 +72,9 @@ gvfs-afc gvfs-mtp gvfs-nfs tumbler -xdg-user-dirs-gtk # utilities gnome-keyring -imagemagick -jsoncpp -libmpdclient lm_sensors lsb-release numlockx @@ -129,31 +89,19 @@ volumeicon wmctrl xclip xdotool -zenity # applications arandr compton dunst feh -file-roller -gparted gsimplecal htop -mpv nitrogen pavucontrol ranger w3m -xterm - -# default WM -openbox # fonts terminus-font -ttf-roboto -ttf-ubuntu-font-family - -# archlabs -archlabs_unstable/archlabs +ttf-dejavu