Optimize System Type Handling

This commit is contained in:
seiichiro 2021-08-15 19:19:55 +02:00
parent fdd5603245
commit b0e767f9be

View file

@ -5,12 +5,13 @@ set -e # Stop on Errors
function show_help() {
echo "$0 -d <device> [options]"
echo " A Semi-Automatic Archlinux Install Script"
echo " -d <device> Device to Install to"
echo " -k Kernel Name to Install (default: linux-zen)"
echo " -n Network Management: n NetworkMangager, m NetworkManager + ModemManager, (default: none)"
echo " -l Locale to use (default: de_DE)"
echo " -m Console Keymap to use (default: de)"
echo " -b Set System Type to BIOS (default: UEFI)"
echo " -d <device> Device to Install to"
echo " -k <kernel> Kernel Name to Install (default: linux-zen)"
echo " -n <nm> Network Management: n NetworkMangager, m NetworkManager + ModemManager, (default: none)"
echo " -l <locale> Locale to use (default: de_DE)"
echo " -m <keymap> Console Keymap to use (default: de)"
echo " -t <timezone> Timezone to use (default: Europe/Berlin)"
echo " -b Set System Type to BIOS (default: UEFI)"
}
function exit_error() {
@ -38,7 +39,8 @@ function install_network() {
kernel="linux-zen"
locale="de_DE"
keymap="de"
systype="UEFI"
timezone="Europe/Berlin"
systype="x86_64-efi"
network=0
## Get CLI Options
@ -54,7 +56,8 @@ while getopts 'k:d:n:m:l:h:b?' flag; do
d) device="${OPTARG}" ;;
l) locale="${OPTARG}" ;;
m) keymap="${OPTARG}" ;;
b) systype="BIOS" ;;
t) timezone="${OPTARG}" ;;
b) systype="i386-pc" ;;
h) hostname="${OPTARG}" ;;
?) show_help ;;
*) show_help ;;
@ -90,7 +93,7 @@ if [[ "$(systemd-detect-virt)" == "none" ]]; then
fi
echo "Paritioning Disk ${device}"
if [[ "${systype}" == "UEFI" ]]; then
if [[ "${systype}" == "x86_64-efi" ]]; then
parted -s "$device" \
mkpart ESP fat32 1MiB 513MiB \
set esp 1 on mkpart \
@ -98,6 +101,7 @@ if [[ "${systype}" == "UEFI" ]]; then
part_esp="/dev/disk/by-partlabel/ESP"
part_root="/dev/disk/by-partlabel/cryptroot"
extrapkgs="efibootmgr"
partprobe "${device}"
mkfs.fat -F32 -n EFI "${part_esp}"
@ -136,12 +140,12 @@ mount -o ssd,noatime,space_cache.compress=zstd,autodefrag,discard=async,subvol=@
mount -o ssd,noatime,space_cache.compress=zstd,autodefrag,discard=async,subvol=@machines "${crypt_root}" /mnt/var/lib/machines
mount -o ssd,noatime,space_cache.compress=zstd,autodefrag,discard=async,subvol=@portables "${crypt_root}" /mnt/var/lib/portables
chattr +C /mnt/var/log /mnt/var/cache/pacman/pkg
if [[ "${systype}" == "UEFI" ]]; then
if [[ "${systype}" == "x86_64-efi" ]]; then
mount "${part_esp}" /mnt/boot/efi
fi
echo "Installing Base System Packages"
pacstrap /mnt base $kernel $microcode $firmware btrfs-progs grub grub-btrfs snapper vim git tmux htop lsof strace openssh
pacstrap /mnt base $kernel $microcode $firmware $extrapkgs btrfs-progs grub grub-btrfs snapper vim git tmux htop lsof strace openssh
echo "Creating Basic Config Files"
genfstab -U /mnt | sed -e 's#suvolid=.*,##g;s#subvol=/.*##g' >> /mnt/etc/fstab