mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-04 04:46:43 +00:00
9fa3a8b629
Upstream seems to publish and retain `.zip` more consistently than `.tar.gz`, which caused the previous expression to break. This modifies the odoo package and updater script to use the `zip` sources.
28 lines
966 B
Bash
Executable File
28 lines
966 B
Bash
Executable File
#!/usr/bin/env nix-shell
|
|
#!nix-shell -i bash -p curl gnused nix coreutils nix-prefetch
|
|
|
|
set -euo pipefail
|
|
|
|
DOCKER=$(curl -s https://raw.githubusercontent.com/odoo/docker/master/16.0/Dockerfile)
|
|
|
|
get_var() {
|
|
echo "$DOCKER" | grep -E "^[A-Z][A-Z][A-Z] ODOO_$1" | sed -r "s|^[A-Z]{3} ODOO_$1.||g"
|
|
}
|
|
|
|
VERSION=$(get_var VERSION)
|
|
RELEASE=$(get_var RELEASE)
|
|
|
|
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" default.nix
|
|
sed -ri "s| odoo_version.+| odoo_version = \"$VERSION\";|" default.nix
|
|
sed -ri "s| odoo_release.+| odoo_release = \"$RELEASE\";|" default.nix
|