script(hosts/Infini-STICK): add mount script

This commit is contained in:
Infinidoge 2021-12-09 14:08:02 -05:00
parent 33362f1c1f
commit e2e9cd4458
2 changed files with 35 additions and 0 deletions

28
hosts/Infini-STICK/mount.bash Executable file
View file

@ -0,0 +1,28 @@
#!/usr/bin/env bash
# [[file:readme.org::mount][mount]]
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::boilerplate][boilerplate]]][boilerplate]]
DISK=$1
sudo mkdir -p /mnt
if mountpoint -q -- "/mnt"; then
echo "ERROR: /mnt is a mounted filesystem, aborting"
exit 1
fi
# boilerplate ends here
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::mounting][mounting]]][mounting]]
echo "LOG: Mounting tmpfs"
sudo mount -t tmpfs root /mnt
echo "LOG: - Mounting persistent directories"
sudo mkdir -p /mnt/persist /mnt/nix /mnt/boot
sudo mount -o subvol=root,autodefrag,noatime "${DISK}1" /mnt/persist
sudo mount -o subvol=nix,autodefrag,noatime "${DISK}1" /mnt/nix
sudo mount -o subvol=boot,autodefrag,noatime "${DISK}1" /mnt/boot
echo "LOG: - Mounting EFI System Partition"
sudo mkdir -p /mnt/boot/efi
sudo mount "${DISK}2" /mnt/boot/efi
# mounting ends here
# mount ends here