diff --git a/bin/auto-update-nixos b/bin/auto-update-nixos index f61e6a9..e18ab89 100755 --- a/bin/auto-update-nixos +++ b/bin/auto-update-nixos @@ -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."