From ba88fc7a29be33e332dfdea5db5f43cdba33b9f2 Mon Sep 17 00:00:00 2001 From: TudbuT Date: Thu, 24 Oct 2024 21:15:21 +0200 Subject: [PATCH] install.sh: fixes --- install.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 213232f..ac5c7bf 100644 --- a/install.sh +++ b/install.sh @@ -17,7 +17,7 @@ fi lsblk echo -n "> what drive to install on? /dev/" read drive -sudo fdisk "/dev/$drive" << "EOF" +sudo fdisk "/dev/$drive" << EOF o n p @@ -26,17 +26,18 @@ p a w -EOF > /dev/null || exit 1 -echo "> created DOS partition table on $disk with one bootable partition." -sudo mkfs.ext4 $disk*1 || exit 1 # /dev/sda 1 or /dev/nvme0n1 p1 => *1 instead of just 1 +EOF +if [ $? != 0 ] ; then exit 1 ; fi +echo "> created DOS partition table on $drive with one bootable partition." +sudo mkfs.ext4 $drive*1 || exit 1 # /dev/sda 1 or /dev/nvme0n1 p1 => *1 instead of just 1 echo "> formatted." -sudo mount $disk*1 /mnt || exit 1 +sudo mount $drive*1 /mnt || exit 1 echo "> mounted." echo "> generating config" sudo nixos-generate-config --root /mnt cd /mnt/etc/nixos echo -n "hostname: " -sudo sed -i -E "s/^}\$/ boot.loader.grub.device = \"\/dev\/$disk\";\n networking.hostName = \"$(head -n1)\";\n}/" hardware-configuration.nix +sudo sed -i -E "s/^}\$/ boot.loader.grub.device = \"\/dev\/$drive\";\n networking.hostName = \"$(head -n1)\";\n}/" hardware-configuration.nix echo "> installing git" nix-env -i git > /dev/null || exit 1 echo "> downloading tudbut/nix-setup"