personal_scripts

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit c5ee3b867364cd7a2fc0178209f0ca865cef5bb8
parent acb7d0283ab38084798d3b05a638224de5d2965b
Author: mrgrouse <bdmfegys@duck.com>
Date:   Mon, 13 May 2024 00:17:56 -0400

create artix-install.sh

Diffstat:
Aartix-install.sh | 85+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 85 insertions(+), 0 deletions(-)

diff --git a/artix-install.sh b/artix-install.sh @@ -0,0 +1,85 @@ +#!/bin/sh +# FOR UEFI SYSTEMS ONLY # +#TODO: implement other mountpoints/partitions +### FUNCTIONS ### +test_drive () { + [ -z $(test -e $1) ] && echo "Incorrect drive input" && exit 1 +} + +get_var () { + echo $1 + read $2 +} + +# set time zone +set_time () { + ln -sf /usr/share/zoneinfo/$country/$timezone /etc/localtime +} + +# $1 options: +# urandom: secure but long +# null: quick and less secure +# $2 should be the drive to be wiped +wipe_drive () { + dd bs=4096 if=/dev/$1 iflag=nocache of=$2 oflag=direct status=progress && sync +} + +### SETTING VARIABLES ### +get_var "Which Drive should be the root:" root_drive + +# testing if root drive exists +# TODO: write if statement or while loop to ask for correct drive if it doesnt exist +test_drive root_drive + +get_var "Which filesystem type should the root partition be:" root_format + +get_var "(Optional) mkfs args (leave blank to skip):" root_mkfs_args + +get_var "Which Drive should be the /boot partition:" boot_drive + +get_var "Which init system (options: dinit, s6, runit, openrc):" init + +### FORMATTING DRIVES ### +# clear drive +wipe_drive urandom $root_drive + +# encrypt drive +cryptsetup luksFormat $root_drive && sync + +# formatting boot drive +wipe_drive urandom $boot_drive # clear drive +mkfs.fat -F 32 $boot_drive && sync # format drive +fatlabel $boot_drive ESP && sync # label drive + +### MOUNTING DRIVES ### +# TODO: crypto=decrypted drive +cryptname=cryptlvm # for further customizabity(?) +cryptsetup open $root_drive $cryptname +rtmnt=/mnt # mountpoint of root drive +mount $crypto $rtmnt +mount $boot_drive $rtmnt/boot + +### INSTALLING MAIN SYSTEM ### +get_var "Which kernel would you like to install:" kernel + +# strap main system w packages +basestrap /mnt base base-devel $kernel $kernel-headers networkmanager-$init + +# generate fstab +fstabgen -U $rtmnt >> $rtmnt/etc/fstab +artix-chroot $rtmnt # 🤨🤨🤨 + +# set timezome +ln -sf /usr/share/zoneinfo/$country/$timezone /etc/localtime + +### GRUB ### +grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=Artix +# TODO: set up configuration of /etc/default/grub +sed -i '1s/^/GRUB_/' file_name + +# build config +grub-mkconfig -o /boot/grub/grub.cfg + +# build & compress initramfs +# TODO: add compatibility with other initramfs generators +mkinitcpio -P