Tweak upgrade script
This commit is contained in:
parent
4f1d045e1a
commit
3b7379a1c5
|
@ -117,11 +117,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1711915616,
|
"lastModified": 1712016346,
|
||||||
"narHash": "sha256-co6LoFA+j6BZEeJNSR8nZ4oOort5qYPskjrDHBaJgmo=",
|
"narHash": "sha256-O2nO7pD+krq+4HgkLB4VThRtAucIPfXDs/jJqCGlK1w=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "820be197ccf3adaad9a8856ef255c13b6cc561a6",
|
"rev": "4be0464472675212654dedf3e021bd5f1d58b92f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -26,10 +26,11 @@ while [[ $# -gt 0 ]]; do
|
||||||
;;
|
;;
|
||||||
-h|--help)
|
-h|--help)
|
||||||
usage
|
usage
|
||||||
shift
|
exit
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
break
|
echo "Unknown argument $1"
|
||||||
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
@ -39,19 +40,23 @@ echo "Using installation mode: $OPERATION"
|
||||||
cd ~/Development/nix-configuration
|
cd ~/Development/nix-configuration
|
||||||
nix flake update
|
nix flake update
|
||||||
nixos-rebuild build --flake .
|
nixos-rebuild build --flake .
|
||||||
echo "Updates to apply:"
|
UPDATES=$(nix store diff-closures /run/current-system ./result | awk '/[0-9] →|→ [0-9]/ && !/nixos/' || echo)
|
||||||
nix store diff-closures /run/current-system ./result | awk '/[0-9] →|→ [0-9]/ && !/nixos/' || echo
|
|
||||||
|
|
||||||
if [ $AUTOACCEPT == false ]; then
|
if [ $UPDATES ]; then
|
||||||
|
echo "NixOS updates to apply: "
|
||||||
|
echo $UPDATES
|
||||||
|
if [ $AUTOACCEPT == false ]; then
|
||||||
read -p "Continue with upgrade (y/n) ? " choice
|
read -p "Continue with upgrade (y/n) ? " choice
|
||||||
case "$choice" in
|
case "$choice" in
|
||||||
y|Y|yes ) echo "Running nixos-rebuild $OPERATION :";;
|
y|Y|yes ) echo "Running nixos-rebuild $OPERATION :";;
|
||||||
n|N|no ) echo "Upgrade cancelled." && exit;;
|
n|N|no ) echo "Upgrade cancelled." && exit;;
|
||||||
* ) echo "Invalid option. Upgrade cancelled." && exit;;
|
* ) echo "Invalid option. Upgrade cancelled." && exit;;
|
||||||
esac
|
esac
|
||||||
|
fi
|
||||||
|
sudo nixos-rebuild $OPERATION --flake .
|
||||||
|
else
|
||||||
|
echo "No NixOS updates found."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo nixos-rebuild $OPERATION --flake .
|
|
||||||
|
|
||||||
echo "Updating Flatpaks:"
|
echo "Updating Flatpaks:"
|
||||||
flatpak update
|
flatpak update
|
||||||
|
|
Loading…
Reference in a new issue