about summary refs log tree commit diff
path: root/pkgs/by-name/od/odoo/update.sh
diff options
context:
space:
mode:
authorMaciej Krüger <mkg20001@gmail.com>2024-06-19 18:31:53 +0200
committerGitHub <noreply@github.com>2024-06-19 18:31:53 +0200
commit27e0947a1d098053ef8d1d66dbeedde173908527 (patch)
tree72df433db428905bd4f17c2e5cb789380f38af34 /pkgs/by-name/od/odoo/update.sh
parent2bfe2058a3e96f2141f0e82318688649d2b7847a (diff)
parent6c10cfba34a151fceed537b4b8642ad033301d7d (diff)
Merge pull request #312060 from siriobalmelli/fix/odoo
odoo: fix odoo16; add odoo17
Diffstat (limited to 'pkgs/by-name/od/odoo/update.sh')
-rwxr-xr-xpkgs/by-name/od/odoo/update.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/pkgs/by-name/od/odoo/update.sh b/pkgs/by-name/od/odoo/update.sh
new file mode 100755
index 0000000000000..e9c50ccb50815
--- /dev/null
+++ b/pkgs/by-name/od/odoo/update.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env nix-shell
+#!nix-shell -i bash -p curl gnused nix coreutils nix-prefetch
+
+set -euo pipefail
+
+VERSION="17.0" # must be incremented manually
+
+RELEASE="$(
+    curl "https://nightly.odoo.com/$VERSION/nightly/src/" |
+        sed -nE 's/.*odoo_'"$VERSION"'.(20[0-9]{6}).tar.gz.*/\1/p' |
+        tail -n 1
+)"
+
+latestVersion="$VERSION.$RELEASE"
+currentVersion=$(nix-instantiate --eval -E "with import ./. {}; odoo.version or (lib.getVersion odoo)" | tr -d '"')
+
+if [[ "$currentVersion" == "$latestVersion" ]]; then
+    echo "odoo is up-to-date: $currentVersion"
+    exit 0
+fi
+
+cd "$(dirname "${BASH_SOURCE[0]}")"
+
+sed -ri "s| hash.+ # odoo| hash = \"$(nix-prefetch -q fetchzip --url "https://nightly.odoo.com/${VERSION}/nightly/src/odoo_${latestVersion}.zip")\"; # odoo|g" package.nix
+sed -ri "s|, odoo_version \? .+|, odoo_version ? \"$VERSION\"|" package.nix
+sed -ri "s|, odoo_release \? .+|, odoo_release ? \"$RELEASE\"|" package.nix