3
0
Fork 0
forked from mirrors/nixpkgs

iojs: Fix update-iojs script

The nix-instantiate invocations only work correctly if this script is
run from the root directory of nixpkgs, or in a directory without a
default.nix file and NIX_PATH set appropriately.
This commit is contained in:
Benjamin Staffin 2015-03-17 15:00:16 -07:00
parent f7f0fd0dfe
commit 1b1f26636e

View file

@ -1,10 +1,12 @@
#!/bin/sh -e
#!/bin/sh
#
# Fetch the latest io.js release (stable/nightly) and update
# `default.nix` in this directory.
#
cd "$(dirname "$0")"
set -e
HERE="$(dirname "$0")"
latest() {
curl -s "$1" | grep 'href="v' \
@ -39,11 +41,11 @@ nightly=$(latest_log nightly 'https://iojs.org/download/nightly/')
sed -i \
"/version = if nightly/s/then.*/then \"$nightly\" else \"$stable\";/" \
default.nix
"$HERE/default.nix"
stableHash=$(hash_log "$(url iojs.src)")
nightlyHash=$(hash_log "$(url iojs-nightly.src)")
sed -i \
"/sha256 = if nightly/{N;s/\"[^\"]*\"/\"$nightlyHash\"/;N;s/\"[^\"]*\";/\"$stableHash\";/}" \
default.nix
"$HERE/default.nix"