modify nixos update script to add remote build

This commit is contained in:
Sam 2025-01-24 00:21:13 +00:00
parent d131fe3cc2
commit cc351fda28
1 changed files with 5 additions and 5 deletions

View File

@ -87,15 +87,15 @@ fi
cd $flakeDir
current_branch=$(git branch --show-current)
# [ "$current_branch" != "master" ] && echo "Not on master branch. Aborting auto-update" && exit 0
[ "$current_branch" != "master" ] && echo "Not on master branch. Aborting auto-update" && exit 0
echo "Pulling the latest version of the repository..."
# /run/wrappers/bin/sudo -u $user git stash
# /run/wrappers/bin/sudo -u $user git pull
/run/wrappers/bin/sudo -u $user git stash
/run/wrappers/bin/sudo -u $user git pull
if [ $update = true ]; then
echo "Updating flake.lock..."
# /run/wrappers/bin/sudo -u $user nix flake update --commit-lock-file && /run/wrappers/bin/sudo -u $user git push
/run/wrappers/bin/sudo -u $user nix flake update --commit-lock-file && /run/wrappers/bin/sudo -u $user git push
else
echo "Skipping 'nix flake update'..."
fi
@ -115,7 +115,7 @@ echo "Checking if reboot is necessary"
reboot_diff=$(diff <(readlink /run/booted-system/{initrd,kernel,kernel-modules}) <(readlink /nix/var/nix/profiles/system/{initrd,kernel,kernel-modules}))
if [ -n "$reboot_diff" ] && [ $reboot == true ]; then
echo "System requires a reboot. Rebooting now..."
# reboot
reboot
else
echo "No reboot necessary."
echo "Update complete."