0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-19 08:31:01 +03:00

nixos/netbox: switch to symlink to check for upgrades

This makes it so that the upgrade script also runs when the
configuration changed, or when plugins were added.

This is also a hack to force everyone to run the upgrade script again,
since static files might have been copied incorrectly (see parent commit)

(cherry picked from commit fe58368de6)
This commit is contained in:
Minijackson 2024-11-06 16:14:56 +01:00 committed by github-actions[bot]
parent 2d04bf7ee4
commit 1e54c20bd2

View file

@ -298,7 +298,7 @@ in {
# This mostly correspond to upstream NetBox's 'upgrade.sh' script.
versionFile="${cfg.dataDir}/version"
if [[ -e "$versionFile" && "$(cat "$versionFile")" == "${cfg.package.version}" ]]; then
if [[ -h "$versionFile" && "$(readlink -- "$versionFile")" == "${cfg.package}" ]]; then
exit 0
fi
@ -314,7 +314,7 @@ in {
(lib.versionOlder cfg.package.version "3.7.0")
"${pkg}/bin/netbox clearcache"}
echo "${cfg.package.version}" > "$versionFile"
ln -sfn "${cfg.package}" "$versionFile"
'';
serviceConfig = defaultServiceConfig // {