aboutsummaryrefslogtreecommitdiff
path: root/uefiinstall
diff options
context:
space:
mode:
authorHimbeerserverDE <himbeerserverde@gmail.com>2023-04-01 15:07:26 +0200
committerHimbeerserverDE <himbeerserverde@gmail.com>2023-04-01 15:07:26 +0200
commit02f2b14caa0b0d958e5e04d6577d102df21e9382 (patch)
treeee15039a860fd5ec3f5db0e9f6e53050e129f78c /uefiinstall
parent57fc32bd2a985d83b1652e45dd812e9a0ba9cafa (diff)
initial unencrypted uefi support
Diffstat (limited to 'uefiinstall')
-rwxr-xr-xuefiinstall75
1 files changed, 75 insertions, 0 deletions
diff --git a/uefiinstall b/uefiinstall
new file mode 100755
index 0000000..0f5732e
--- /dev/null
+++ b/uefiinstall
@@ -0,0 +1,75 @@
+#! /bin/bash
+
+set -e
+
+if [ "${UID}" != "0" ]; then
+ echo "uefiinstall: requires root permissions"
+ exit 1
+fi
+
+pacman -Sy
+pacman -S --needed --noconfirm parted fzf
+
+#
+# Config questions
+#
+
+DRIVE=$1
+TARGET=$2
+
+if [ -z "${DRIVE}" ]; then
+ DRIVE="/dev/$(lsblk | grep disk | fzf --disabled | awk '{print $1}')"
+fi
+
+if [[ "${DRIVE}" == "/dev/mmcblk"* ]] | [[ "${DRIVE}" == "/dev/nvme"* ]]; then
+ PART_PREFIX="${DRIVE}p"
+else
+ PART_PREFIX="${DRIVE}"
+fi
+
+if [ -z "${TARGET}" ]; then
+ TARGET=$(echo "Enter GRUB target (commonly x86_64-efi): " | fzf --disabled --print-query | sed -n '1 p')
+fi
+
+# Needed because otherwise the disk might be overwritten
+# without installing a bootable system.
+if [ -z "${TARGET}" ]; then
+ echo -e "\e[1m\e[1;31mGRUB target must not be empty.\e[0m"
+ exit 1
+fi
+
+parted -s ${DRIVE} mklabel msdos
+parted -s -a optimal ${DRIVE} mkpart primary fat32 0% 256MiB
+parted -s -a optimal ${DRIVE} mkpart primary ext4 256MiB 512MiB
+parted -s -a optimal ${DRIVE} mkpart primary btrfs 512MiB 100%
+
+mkfs.fat -F 32 ${PART_PREFIX}1 && fatlabel ${PART_PREFIX}1 ESP
+mkfs.ext4 -F -L BOOT ${PART_PREFIX}2
+mkfs.btrfs -f ${PART_PREFIX}3
+
+mkdir /btrfs
+mount -o compress=zstd ${PART_PREFIX}3 /btrfs
+btrfs subvolume create /btrfs/root
+umount /btrfs
+
+mount -o compress=zstd,subvol=/root ${PART_PREFIX}3 /mnt
+mkdir /mnt/boot
+mount ${PART_PREFIX}2 /mnt/boot
+mkdir /mnt/boot/efi
+mount ${PART_PREFIX}1 /mnt/boot/efi
+
+rc-service ntpd start
+
+basestrap /mnt base openrc elogind-openrc vim man ntp-openrc git
+basestrap /mnt linux linux-firmware
+
+artix-chroot /mnt bash -c "curl -fsSL https://raw.githubusercontent.com/HimbeerserverDE/artixinstall/main/mkuefi | sh -s -- ${DRIVE} ${PART_PREFIX} ${TARGET}"
+
+fstabgen -U /mnt >> /mnt/etc/fstab
+
+umount -R /mnt
+
+echo -e "\n\e[1m\e[1;32mArtix has been successfully installed! It is now safe to reboot."
+echo -e "\e[1m\e[1;32mDon't forget to change the root password and hostname."
+echo -e "\e[1m\e[1;32mSetting up networking is left to you, dhcpcd and wpa_supplicant are installed."
+echo -en "\e[0m"