main.fish finished probably

This commit is contained in:
SArpnt 2023-09-17 15:19:30 -04:00
parent 4c3e58d03f
commit 6a33443c85
Signed by: SArpnt
SSH Key Fingerprint: SHA256:wyRI40FXp6te9QA9r2OFJf+DtCZQmqZFNTj7EV6aMDA
2 changed files with 71 additions and 34 deletions

View File

@ -5,10 +5,10 @@ cat /etc/locale.gen | sed "s/^#en_US.UTF-8/en_US.UTF-8/" > /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
echo "choose a hostname (name for the computer, other computers may see it"
ask cool-arch-(cat /dev/urandom | base32 -w 8 | head -n 1) > /etc/hostname # TODO default hostname
#TODO mkinitcpio
ask cool-arch-(cat /dev/urandom | base32 -w 8 | head -n 1) > /etc/hostname
#TODO edit the mkinitcpio file because the default probably isn't correct
# a command doesn't need to be ran for it because of pacstrap
begin
set -l packages
@ -73,10 +73,9 @@ switch (cat /sys/firmware/efi/fw_platform_size)
grub-install --target=i386-pc /dev/sdX # TODO
end
#TODO edit grub config
#check the nvidia thing
#TODO nvidia kernel parameter
cat /etc/default/grub | sed "
s/resume=\$RESUME\$/$(
s/\$RESUME\$/$(
if test (count $swapdevice) -gt 0
echo resume=$swapdevice
end
@ -93,10 +92,6 @@ echo "select a username"
set -l username (ask "user")
useradd -m -G games,realtime,wheel $username
#TODO chrony
#TODO fluidsynth
runuser $user -c 'git clone "https://aur.archlinux.org/paru-bin.git" /tmp/paru-bin'
pushd /tmp/paru-bin
runuser $user -c 'makepkg -sir --noconfirm'
@ -104,3 +99,8 @@ popd
rm -rf /tmp/paru-bin
runuser $user -c 'paru -Syu --noconfirm dashbinsh doasedit-alternative fish-z-git librewolf-bin ttf-twemoji'
# TODO enable a bunch of services with systemctl (firewalld, chrony, fluidsynth)
# TODO configure fluidsynth

View File

@ -14,21 +14,43 @@ function ask
end
end
function askyesno
while true
switch (ask $1)
case y yes
# 2.. is valid responses
function asklist
while true
set -l answer (ask $1)
switch $answer
case $argv[2..]
echo $answer
return 0
case n no
return 1
case "*"
echo "what?"
# loops
echo "invalid response"
# this loops in the `while true`
end
end
end
function askyesno
while true
switch (ask $1)
case y yes
return 0
case n no
return 1
case "*"
echo "should be yes or no!"
# this loops in the `while true`
end
end
end
if not pacman -Syi base
echo "pacman not working, are you connected to the internet?"
exit 1
end
echo "---"
echo "MOUNT"
echo "---"
@ -44,15 +66,21 @@ echo "the installer also assumes you use a swap PARTITION, and only one"
switch (cat /sys/firmware/efi/fw_platform_size)
case 64
echo "grub target will be 64 bit UEFI, check to make sure this is correct"
echo "grub target will be 64 bit UEFI, check to make sure this is correct"
case 32
echo "grub target will be 32 bit UEFI, check to make sure this is correct"
echo "grub target will be 32 bit UEFI, check to make sure this is correct"
case ""
echo "grub target will be BIOS (not uefi), check to make sure this is correct"
echo "grub target will be BIOS (not uefi), check to make sure this is correct"
case "*"
echo "fw_platform_size is some weird unknown value!"
exit 1
echo "fw_platform_size is some weird unknown value!"
echo "normally it would be 64, 32, or nothing to indicate uefi/bios"
exit 1
end
echo "# say yes to continue ONLY if you have checked all of these things and they are correct"
if not askyesno no
exit 1
end
# extract overlay into system
tar xvf overlay.tar --directory=/mnt
@ -76,26 +104,36 @@ begin
set -l check (
switch $path
case "/"
echo 1
echo 1
case "/*"
echo 2
echo 2
case "*"
echo 0
end
)
echo "$device $mountpoint $filesystem defaults 0 $check" >> /mnt/etc/fstab
end
set -l swaplines (swapon --raw --noheadings --show=NAME)
set -l swaplines (swapon --raw --noheadings --show=NAME,PRIO)
if test (count $swaplines) -gt 1
echo "pick a swap device to use for hibernate"
echo "pick a swap device to use for hibernate (number on the left)"
echo "0 for no hibernate"
swapon --show=NAME,TYPE,SIZE,PRIO,UUID # TODO add line numbers, figure out what swap label is, figure out swap priority
ask 1 # TODO
set swapdevice
set -l fullswaplist swapon --show=NAME,LABEL,TYPE,SIZE,PRIO,UUID
set -l swaplist $fullswaplist[2..]
echo " $fullswaplist[1]"
for i in (seq (count $swaplist))
echo "$i $swaplist[i]"
end
set swapdevice (asklist 1 (seq (count $swaplist)))
end
for swapline in $swaplines
set -l device (getdevice $swapline)
echo "$device none swap defaults 0 0" >> /mnt/etc/fstab
set -l words (string split " " $swapline)
set -l device (getdevice $words[1])
set -l prio $words[2]
if test $prio -ge 0
echo "$device none swap defaults,pri=$prio 0 0" >> /mnt/etc/fstab
else
echo "$device none swap defaults 0 0" >> /mnt/etc/fstab
end
end
end
@ -111,5 +149,4 @@ pacstrap -K /mnt base linux-zen linux-zen-headers linux-firmware fish
arch-chroot /mnt /bin/fish in-chroot.fish
echo "finished! you can reboot and start using your system now"