1
Fork 0

Assume root permissions in emergency script

This commit is contained in:
Matei Adriel 2024-01-18 02:32:21 +01:00
parent f206bf92a4
commit 8b3067817b
No known key found for this signature in database

View file

@ -1,6 +1,5 @@
#!/usr/bin/env nix-shell #!/usr/bin/env nix-shell
#!nix-shell ../devshells/bootstrap/shell.nix #!nix-shell ../devshells/bootstrap/shell.nix
#!nix shell disko
#!nix-shell -i bash #!nix-shell -i bash
# Check if at least one argument is provided # Check if at least one argument is provided
@ -22,25 +21,25 @@ if [ "$#" != "1" ] && [ "$2" != "install" ] && [ "$2" != "enter" ]; then
fi fi
echo "Mounting keys" echo "Mounting keys"
sudo mkdir /hermes mkdir /hermes
sudo mount /dev/disk/by-uuid/7FE7-CA68 /hermes mount /dev/disk/by-uuid/7FE7-CA68 /hermes
echo "Running disko" echo "Running disko"
if [ "$1" -eq "mount" ]; then if [ "$1" = "mount" ]; then
sudo zpool import -lfR /mnt zroot zpool import -lfR /mnt zroot
fi fi
sudo disko --mode $1 ./hosts/nixos/lapetus/filesystems/partitions.nix nix run disko --mode $1 ./hosts/nixos/lapetus/filesystems/partitions.nix
if [ "$2" = "install" ]; then if [ "$2" = "install" ]; then
echo "Installing nixos" echo "Installing nixos"
sudo nixos-install --flake ".#lapetus" nixos-install --flake ".#lapetus"
fi fi
if [ "$2" = "enter" ]; then if [ "$2" = "enter" ]; then
echo "Entering nixos" echo "Entering nixos"
sudo nixos-enter --root /mnt nixos-enter --root /mnt
fi fi
echo "All done!" echo "All done!"