From 61fc46fed5390d8876833831f4cee9ed7d20c035 Mon Sep 17 00:00:00 2001 From: Infinidoge Date: Thu, 9 Dec 2021 13:45:21 -0500 Subject: [PATCH] hosts/Infini-STICK: separate install scripts --- hosts/Infini-STICK/readme.org | 60 ++++++++++++++++++++++++++----- hosts/Infini-STICK/reinstall.bash | 41 +++++++++++++++++++++ hosts/Infini-STICK/setup.bash | 34 ++++++++++++++---- 3 files changed, 121 insertions(+), 14 deletions(-) create mode 100755 hosts/Infini-STICK/reinstall.bash diff --git a/hosts/Infini-STICK/readme.org b/hosts/Infini-STICK/readme.org index b3f7d4f..83afbe0 100644 --- a/hosts/Infini-STICK/readme.org +++ b/hosts/Infini-STICK/readme.org @@ -17,8 +17,9 @@ Setup with a wide array of hardware compatibility, specifically using the =porta * Setup Scripts -#+BEGIN_SRC bash :tangle setup.bash :tangle-mode :shebang "#!/usr/bin/env bash" :noweb yes -DISK=$1 +#+NAME: full_install +#+BEGIN_SRC bash :tangle setup.bash :shebang "#!/usr/bin/env bash" :noweb yes :comments noweb +<> <> @@ -30,7 +31,35 @@ DISK=$1 <> +<> + <> + +<> +#+END_SRC + +#+NAME: reinstall +#+BEGIN_SRC bash :tangle reinstall.bash :shebang "#!/usr/bin/env bash" :noweb yes :comments noweb +<> + +<> + +<> + +<> + +<> + +<> +#+END_SRC + +** Script Boilerplate + +#+NAME: boilerplate +#+BEGIN_SRC bash +DISK=$1 + +sudo mkdir -p /mnt #+END_SRC ** Partitioning @@ -59,8 +88,6 @@ sudo mkfs.fat -F 32 -n boot "${DISK}2" #+NAME: subvolumes #+BEGIN_SRC bash -sudo mkdir -p /mnt - echo "LOG: Making subvolumes on ${DISK}1" sudo mount "${DISK}1" /mnt sudo btrfs subvolume create /mnt/root @@ -95,17 +122,34 @@ sudo mount "${DISK}2" /mnt/boot/efi #+NAME: installing #+BEGIN_SRC bash -echo "LOG: Cloning configuration" -sudo git clone --no-hardlinks --progress /etc/nixos /mnt/persist/etc/nixos - echo "LOG: Installing NixOS" -sudo nixos-install --flake /mnt/persist/etc/nixos#Infini-STICK --no-root-password +sudo nixos-install --flake /etc/nixos#Infini-STICK --no-root-password +#+END_SRC + +** Extra (Full Install) + +#+NAME: full_extra +#+BEGIN_SRC bash +echo "LOG: Cloning configuration" +sudo git clone --no-hardlinks --progress https://gitlab.com/infinidoge/devos.git /mnt/persist/etc/nixos +#+END_SRC + +** Extra (Reinstall) + +#+NAME: reinstall_extra +#+BEGIN_SRC bash #+END_SRC ** Finishing Setup #+NAME: finishing_setup #+BEGIN_SRC bash +#+END_SRC + +** Cleanup + +#+NAME: cleanup +#+BEGIN_SRC bash echo "LOG: Unmounting all" sudo umount -R /mnt #+END_SRC diff --git a/hosts/Infini-STICK/reinstall.bash b/hosts/Infini-STICK/reinstall.bash new file mode 100755 index 0000000..338c2d5 --- /dev/null +++ b/hosts/Infini-STICK/reinstall.bash @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +# [[file:readme.org::reinstall][reinstall]] +# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::boilerplate][boilerplate]]][boilerplate]] +DISK=$1 + +sudo mkdir -p /mnt +# 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 + +# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::installing][installing]]][installing]] +echo "LOG: Installing NixOS" +sudo nixos-install --flake /etc/nixos#Infini-STICK --no-root-password +# installing ends here + +# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::reinstall_extra][reinstall_extra]]][reinstall_extra]] + +# reinstall_extra ends here + +# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::finishing_setup][finishing_setup]]][finishing_setup]] + +# finishing_setup ends here + +# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::cleanup][cleanup]]][cleanup]] +echo "LOG: Unmounting all" +sudo umount -R /mnt +# cleanup ends here +# reinstall ends here diff --git a/hosts/Infini-STICK/setup.bash b/hosts/Infini-STICK/setup.bash index 172ca46..654286a 100755 --- a/hosts/Infini-STICK/setup.bash +++ b/hosts/Infini-STICK/setup.bash @@ -1,20 +1,28 @@ #!/usr/bin/env bash +# [[file:readme.org::full_install][full_install]] +# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::boilerplate][boilerplate]]][boilerplate]] DISK=$1 +sudo mkdir -p /mnt +# boilerplate ends here + +# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::partitioning][partitioning]]][partitioning]] echo "LOG: Partitioning $DISK" sudo parted $DISK -- mktable gpt sudo parted $DISK -s -- mkpart primary btrfs 512MiB 100% sudo parted $DISK -s -- mkpart ESP fat32 1MiB 512MiB sudo parted $DISK -s -- set 2 esp on +# partitioning ends here +# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::filesystems][filesystems]]][filesystems]] echo "LOG: Making filesystems" echo "- Making btrfs filesystem on ${DISK}1" sudo mkfs.btrfs "${DISK}1" -L "Infini-STICK" -f echo "- Making fat32 filesystem on ${DISK}2" sudo mkfs.fat -F 32 -n boot "${DISK}2" +# filesystems ends here -sudo mkdir -p /mnt - +# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::subvolumes][subvolumes]]][subvolumes]] echo "LOG: Making subvolumes on ${DISK}1" sudo mount "${DISK}1" /mnt sudo btrfs subvolume create /mnt/root @@ -25,7 +33,9 @@ sudo btrfs subvolume create /mnt/boot sudo btrfs subvolume create /mnt/nix sudo btrfs subvolume create /mnt/nix/store sudo umount /mnt +# subvolumes ends here +# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::mounting][mounting]]][mounting]] echo "LOG: Mounting tmpfs" sudo mount -t tmpfs root /mnt @@ -38,12 +48,24 @@ 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 -echo "LOG: Cloning configuration" -sudo git clone --no-hardlinks --progress /etc/nixos /mnt/persist/etc/nixos - +# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::installing][installing]]][installing]] echo "LOG: Installing NixOS" -sudo nixos-install --flake /mnt/persist/etc/nixos#Infini-STICK --no-root-password +sudo nixos-install --flake /etc/nixos#Infini-STICK --no-root-password +# installing ends here +# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::full_extra][full_extra]]][full_extra]] +echo "LOG: Cloning configuration" +sudo git clone --no-hardlinks --progress https://gitlab.com/infinidoge/devos.git /mnt/persist/etc/nixos +# full_extra ends here + +# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::finishing_setup][finishing_setup]]][finishing_setup]] + +# finishing_setup ends here + +# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::cleanup][cleanup]]][cleanup]] echo "LOG: Unmounting all" sudo umount -R /mnt +# cleanup ends here +# full_install ends here