update
This commit is contained in:
parent
1fb3415e2f
commit
de8abfde96
1 changed files with 36 additions and 28 deletions
|
@ -22,7 +22,7 @@ prompt() {
|
|||
requiments=("$@")
|
||||
|
||||
[[ -z "${requiments[*]}" ]] && {
|
||||
printf "<prompt> requires an array of requirements"
|
||||
eprintln "<prompt> requires an array of requirements"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
@ -36,10 +36,9 @@ prompt() {
|
|||
read -rep "> " -i "$default" "${variable?}"
|
||||
[[ "${requiments[0]}" == "null" ]] && break
|
||||
[[ -n ${!variable} && ${requiments[*]} =~ ${!variable} ]] && break
|
||||
printf "Invalid option\n"
|
||||
eprintln "Invalid option\n"
|
||||
done
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
invert() {
|
||||
|
@ -49,6 +48,11 @@ invert() {
|
|||
}
|
||||
|
||||
# Get required user info
|
||||
## check boot mode
|
||||
if [[ ! -f /sys/firmware/efi/fw_platform_size ]]; then
|
||||
eprintln "This script currently only supports UEFI systems."
|
||||
exit 1
|
||||
fi
|
||||
## Check Network Status
|
||||
if [[ ! $(
|
||||
ping -c 1 archlinux.org
|
||||
|
@ -58,9 +62,6 @@ if [[ ! $(
|
|||
exit 1
|
||||
fi
|
||||
|
||||
## get boot mode
|
||||
_is_uefi=$([[ -f /sys/firmware/efi/fw_platform_size ]] && echo 1 || echo 0)
|
||||
|
||||
## Disk info
|
||||
mapfile -t devices < <(lsblk --paths --output NAME,SiZE --noheadings --nodeps)
|
||||
paste <(printf "%s\n" "${!devices[@]}") <(printf "%s\n" "${devices[@]}")
|
||||
|
@ -85,12 +86,12 @@ stty -echo
|
|||
while :; do
|
||||
prompt password "" "Enter root password" null
|
||||
[[ "${password?}" == "" ]] && {
|
||||
printf "\nPassword cannot be empty"
|
||||
eprintln "\nPassword cannot be empty"
|
||||
continue
|
||||
}
|
||||
prompt pass_conf "" "Confirm root password" null
|
||||
[[ "${pass_conf?}" == "${password?}" ]] && break
|
||||
printf "\nPassword does not match."
|
||||
eprintln "\nPassword does not match."
|
||||
done
|
||||
stty echo
|
||||
|
||||
|
@ -109,19 +110,21 @@ done
|
|||
part_boot=",+1G,C12A7328-F81F-11D2-BA4B-00A0C93EC93B"
|
||||
part_root=","
|
||||
root_dev=$(echo ${devices[$root_drive]} | cut -d' ' -f 1)
|
||||
[[ "${want_home:-0}" -eq 1 ]] &&
|
||||
home_dev=$(echo ${devices[$home_drive]} | cut -d' ' -f 1)
|
||||
[[ "${want_home:-0}" -eq 1 ]] && {
|
||||
(( $(lsblk ${devices[$home_drive]} | wc -l) > 3)) && parition=1
|
||||
home_dev=$(echo ${devices[$home_drive]} | cut -d' ' -f 1)${parition:-""}
|
||||
}
|
||||
|
||||
## Partition disk(s)
|
||||
printf "label: GPT\n$part_boot\n$part_root" | sfdisk "$root_dev"
|
||||
[[ "${home_fmt:-0}" -eq 1 ]] &&
|
||||
printf "label: GPT\n," | sfdisk "$home_dev"
|
||||
# [[ "${home_fmt:-0}" -eq 1 ]] &&
|
||||
# printf "label: GPT\n," | sfdisk "$home_dev"
|
||||
|
||||
## Format disk(s)
|
||||
mkfs.fat -F 32 "$root_dev"1
|
||||
mkfs.btrfs -f "$root_dev"2
|
||||
[[ "${home_fmt:-0}" -eq 1 ]] && {
|
||||
mkfs.btrfs -f "$home_dev"1
|
||||
mkfs.btrfs -f "$home_dev"
|
||||
}
|
||||
|
||||
## Configure root btrfs
|
||||
|
@ -171,7 +174,7 @@ mount --mkdir "$root_dev"2 /mnt/usr/local -o subvol=@/usr/local
|
|||
mount --mkdir "$root_dev"2 /mnt/var -o subvol=@/var
|
||||
mount --mkdir -o uid=0,gid=0,fmask=0077,dmask=0077 "$root_dev"1 /mnt/boot
|
||||
[[ "${want_home:-0}" -eq 1 ]] &&
|
||||
mount --mkdir "$home_dev"1 /mnt/home
|
||||
mount --mkdir "$home_dev" /mnt/home
|
||||
|
||||
### swap
|
||||
[[ "${want_swap:-0}" -eq 1 ]] && {
|
||||
|
@ -187,9 +190,13 @@ reflector --save "/etc/pacman.d/mirrorlist" --protocol https,rsync --sort rate -
|
|||
pacstrap -K /mnt base linux-zen linux-firmware amd-ucode snapper
|
||||
# Configure Installation
|
||||
## fstab
|
||||
genfstab -U /mnt | tail -32 >> /mnt/etc/fstab
|
||||
genfstab -U /mnt | tail -32 >>/mnt/etc/fstab
|
||||
## chroot
|
||||
arch-chroot /mnt bash << CHROOT
|
||||
### network configuration
|
||||
printf "zesktop" >>/mnt/etc/hostname
|
||||
cp -v /etc/systemd/network/* /mnt/etc/systemd/network/
|
||||
|
||||
arch-chroot /mnt bash <<CHROOT
|
||||
### time
|
||||
ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
|
||||
hwclock --systohc
|
||||
|
@ -199,17 +206,6 @@ sed -i 's/#en_US\\./en_US./' /etc/locale.gen
|
|||
locale-gen
|
||||
printf "LANG=en_US.UTF-8" >>/etc/locale.conf
|
||||
|
||||
### network configuratio.n
|
||||
printf "zesktop" >>/etc/hostname
|
||||
cat << 'ETHERNET' >/etc/systemd/network/20-ethernet.network
|
||||
[Match]
|
||||
Name=en*
|
||||
Name=eth*
|
||||
|
||||
[Network]
|
||||
DHCP=yes
|
||||
ETHERNET
|
||||
|
||||
### initramfs
|
||||
sed --in-place 's/#COMPRESSION=\"zstd\"/COMPRESSION=\"zstd\"/' /etc/mkinitcpio.conf
|
||||
mkinitcpio -P
|
||||
|
@ -230,7 +226,19 @@ title Arch Linux Zen
|
|||
linux /vmlinuz-linux-zen
|
||||
initrd /amd-ucode.img
|
||||
initrd /initramfs-linux-zen.img
|
||||
options root="UUID=$(blkid "$root_dev"2 | cut -d'"' -f2)" rw
|
||||
options root="UUID=$(blkid -s UUID -o value "$root_dev"2)" rw
|
||||
EOF
|
||||
mkdir -vp /etc/pacman.d/hooks/
|
||||
cat << 'EOF' >/etc/pacman.d/hooks/95-systemd-boot.hook
|
||||
[Trigger]
|
||||
Type = Package
|
||||
Operation = Upgrade
|
||||
Target = systemd
|
||||
|
||||
[Action]
|
||||
Description = Gracefully upgrading systemd-boot...
|
||||
When = PostTransaction
|
||||
Exec = /usr/bin/systemctl restart systemd-boot-update.service
|
||||
EOF
|
||||
|
||||
### Setup snapper
|
||||
|
|
Loading…
Reference in a new issue