diff options
Diffstat (limited to 'pkgs/by-name/od/odoo/update.sh')
-rwxr-xr-x | pkgs/by-name/od/odoo/update.sh | 26 |
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 |