lib.packagesFromDirectoryRecursive: Improved documentation (#359898)
[NixPkgs.git] / pkgs / by-name / od / odoo16 / update.sh
blob2265f9048c0e38bde66a131bea7ad62d72d68cfb
1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p curl gnused nix coreutils nix-prefetch
3 # shellcheck shell=bash
5 set -euo pipefail
7 SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")"
8 PKG=$(basename "$SCRIPT_DIR")
10 LATEST="18" # increment manually
11 VERSION="${PKG/#odoo}"
12 VERSION="${VERSION:-$LATEST}.0"
14 RELEASE="$(
15 curl "https://nightly.odoo.com/$VERSION/nightly/src/" |
16 sed -nE 's/.*odoo_'"$VERSION"'.(20[0-9]{6}).tar.gz.*/\1/p' |
17 tail -n 1
20 latestVersion="$VERSION.$RELEASE"
21 currentVersion=$(nix-instantiate --eval -E "with import ./. {}; $PKG.version or (lib.getVersion $PKG)" | tr -d '"')
23 if [[ "$currentVersion" == "$latestVersion" ]]; then
24 echo "$PKG is up-to-date: $currentVersion"
25 exit 0
28 cd "$SCRIPT_DIR"
30 sed -ri "s| hash.+ # odoo| hash = \"$(nix-prefetch -q fetchzip --option extra-experimental-features flakes --url "https://nightly.odoo.com/${VERSION}/nightly/src/odoo_${latestVersion}.zip")\"; # odoo|g" package.nix
31 sed -ri "s|odoo_version = .+|odoo_version = \"$VERSION\";|" package.nix
32 sed -ri "s|odoo_release = .+|odoo_release = \"$RELEASE\";|" package.nix