modify nixos update script to add remote build
This commit is contained in:
parent
d131fe3cc2
commit
cc351fda28
|
@ -87,15 +87,15 @@ fi
|
||||||
cd $flakeDir
|
cd $flakeDir
|
||||||
|
|
||||||
current_branch=$(git branch --show-current)
|
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..."
|
echo "Pulling the latest version of the repository..."
|
||||||
# /run/wrappers/bin/sudo -u $user git stash
|
/run/wrappers/bin/sudo -u $user git stash
|
||||||
# /run/wrappers/bin/sudo -u $user git pull
|
/run/wrappers/bin/sudo -u $user git pull
|
||||||
|
|
||||||
if [ $update = true ]; then
|
if [ $update = true ]; then
|
||||||
echo "Updating flake.lock..."
|
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
|
else
|
||||||
echo "Skipping 'nix flake update'..."
|
echo "Skipping 'nix flake update'..."
|
||||||
fi
|
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}))
|
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
|
if [ -n "$reboot_diff" ] && [ $reboot == true ]; then
|
||||||
echo "System requires a reboot. Rebooting now..."
|
echo "System requires a reboot. Rebooting now..."
|
||||||
# reboot
|
reboot
|
||||||
else
|
else
|
||||||
echo "No reboot necessary."
|
echo "No reboot necessary."
|
||||||
echo "Update complete."
|
echo "Update complete."
|
||||||
|
|
Loading…
Reference in New Issue