hosts/Infini-STICK: separate mount_check in scripts

This commit is contained in:
Infinidoge 2021-12-10 09:57:53 -05:00
parent 8df4f8c2c7
commit e188c373da
5 changed files with 15 additions and 37 deletions

View file

@ -1,33 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# [[file:readme.org::install][install]] # [[file:readme.org::install][install]]
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::mount][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
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::installing][installing]]][installing]] # [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::installing][installing]]][installing]]
echo "LOG: Installing NixOS" echo "LOG: Installing NixOS"
sudo nixos-install --flake /etc/nixos#Infini-STICK --no-root-password sudo nixos-install --flake /etc/nixos#Infini-STICK --no-root-password

View file

@ -4,12 +4,14 @@
DISK=$1 DISK=$1
sudo mkdir -p /mnt sudo mkdir -p /mnt
# boilerplate ends here
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::mount_check][mount_check]]][mount_check]]
if mountpoint -q -- "/mnt"; then if mountpoint -q -- "/mnt"; then
echo "ERROR: /mnt is a mounted filesystem, aborting" echo "ERROR: /mnt is a mounted filesystem, aborting"
exit 1 exit 1
fi fi
# boilerplate ends here # mount_check ends here
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::mounting][mounting]]][mounting]] # [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::mounting][mounting]]][mounting]]
echo "LOG: Mounting tmpfs" echo "LOG: Mounting tmpfs"

View file

@ -21,6 +21,8 @@ Setup with a wide array of hardware compatibility, specifically using the =porta
#+BEGIN_SRC bash :tangle setup.bash :shebang "#!/usr/bin/env bash" :noweb yes :comments noweb #+BEGIN_SRC bash :tangle setup.bash :shebang "#!/usr/bin/env bash" :noweb yes :comments noweb
<<boilerplate>> <<boilerplate>>
<<mmount_check>>
<<partitioning>> <<partitioning>>
<<filesystems>> <<filesystems>>
@ -55,13 +57,13 @@ Setup with a wide array of hardware compatibility, specifically using the =porta
#+BEGIN_SRC bash :tangle mount.bash :shebang "#!/usr/bin/env bash" :noweb yes :comments noweb #+BEGIN_SRC bash :tangle mount.bash :shebang "#!/usr/bin/env bash" :noweb yes :comments noweb
<<boilerplate>> <<boilerplate>>
<<mount_check>>
<<mounting>> <<mounting>>
#+END_SRC #+END_SRC
#+NAME: install #+NAME: install
#+BEGIN_SRC bash :tangle install.bash :shebang "#!/usr/bin/env bash" :noweb yes :comments noweb #+BEGIN_SRC bash :tangle install.bash :shebang "#!/usr/bin/env bash" :noweb yes :comments noweb
<<mount>>
<<installing>> <<installing>>
#+END_SRC #+END_SRC
@ -72,7 +74,10 @@ Setup with a wide array of hardware compatibility, specifically using the =porta
DISK=$1 DISK=$1
sudo mkdir -p /mnt sudo mkdir -p /mnt
#+END_SRC
#+NAME: mount_check
#+BEGIN_SRC bash
if mountpoint -q -- "/mnt"; then if mountpoint -q -- "/mnt"; then
echo "ERROR: /mnt is a mounted filesystem, aborting" echo "ERROR: /mnt is a mounted filesystem, aborting"
exit 1 exit 1

View file

@ -5,12 +5,14 @@
DISK=$1 DISK=$1
sudo mkdir -p /mnt sudo mkdir -p /mnt
# boilerplate ends here
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::mount_check][mount_check]]][mount_check]]
if mountpoint -q -- "/mnt"; then if mountpoint -q -- "/mnt"; then
echo "ERROR: /mnt is a mounted filesystem, aborting" echo "ERROR: /mnt is a mounted filesystem, aborting"
exit 1 exit 1
fi fi
# boilerplate ends here # mount_check ends here
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::mounting][mounting]]][mounting]] # [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::mounting][mounting]]][mounting]]
echo "LOG: Mounting tmpfs" echo "LOG: Mounting tmpfs"

View file

@ -4,13 +4,10 @@
DISK=$1 DISK=$1
sudo mkdir -p /mnt sudo mkdir -p /mnt
if mountpoint -q -- "/mnt"; then
echo "ERROR: /mnt is a mounted filesystem, aborting"
exit 1
fi
# boilerplate ends here # boilerplate ends here
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::partitioning][partitioning]]][partitioning]] # [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::partitioning][partitioning]]][partitioning]]
echo "LOG: Partitioning $DISK" echo "LOG: Partitioning $DISK"
sudo parted $DISK -- mktable gpt sudo parted $DISK -- mktable gpt