Update install

This commit is contained in:
iFargle 2024-02-05 22:21:09 +09:00
parent e44a8fd148
commit a577db1cc2

View file

@ -11,6 +11,7 @@ if [ "$(id -u)" -eq 0 ]; then
fi
read -p "Include wallpapers? [y/N]" -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]; then
if [ ! -d "/tmp/nixos/git/.git" ]; then
@ -48,7 +49,8 @@ if [ ! -e "nixos/hosts/$TARGET_HOST/disks.nix" ]; then
fi
# Create a key for encrypted swap, if needed
echo "$(head -c32 /dev/random | base64)" > /tmp/swap.key
sudo mkdir -p /mnt-root/etc/
echo "$(head -c32 /dev/random | base64)" > /mnt-root/etc/swap.key
echo "WARNING! The disks in $TARGET_HOST are about to get wiped"
echo " NixOS will be re-installed"
@ -77,9 +79,7 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
# If there is a keyfile for a data disk, put copy it to the root partition and
# ensure the permissions are set appropriately.
if [[ -f "/tmp/swap.key" ]]; then
sudo cp /tmp/swap.key /mnt/etc/swap.key
sudo cp /tmp/swap.key /mnt/tmp/swap.key
sudo cp /mnt-root/etc/swap.key /mnt/etc/swap.key
sudo chmod 0400 /mnt/etc/swap.key
sudo chmod 0400 /mnt/tmp/swap.key
fi
fi