Fixing a typo and making steps more explicit

This commit is contained in:
Michael Raskin 2012-12-04 09:56:38 +04:00
parent abd06b220d
commit 363b1f9dc2

View File

@ -82,20 +82,26 @@ version () {
}
ensure_version () {
echo "Ensuring version. CURRENT_VERSION: $CURRENT_VERSION" >&2
[ -z "$CURRENT_VERSION" ] && version '.*-([0-9.]+)[-._].*' '\1'
}
ensure_target () {
echo "Ensuring target. CURRENT_TARGET: $CURRENT_TARGET" >&2
[ -z "$CURRENT_TARGET" ] && target default.nix
}
ensure_name () {
echo "Ensuring name. CURRENT_NAME: $CURRENT_NAME" >&2
[ -z "$CURRENT_NAME" ] && name "$(basename "$CONFIG_DIR")"
echo "Resulting name: $CURRENT_NAME"
}
ensure_choice () {
[ -n "NEED_TO_CHOOSE_URL" ] && {
echo "Ensuring that choice is made." >&2
echo "NEED_TO_CHOOSE_URL: [$NEED_TO_CHOOSE_URL]." >&2
echo "CURRENT_URL: $CURRENT_URL" >&2
[ -n "$NEED_TO_CHOOSE_URL" ] && {
version_link '[.]tar[.]([^./])+$'
unset NEED_TO_CHOOSE_URL
}
@ -106,12 +112,19 @@ ensure_choice () {
}
}
ensure_hash () {
echo "Ensuring hash. CURRENT_HASH: $CURRENT_HASH" >&2
[ -z "$CURRENT_HASH" ] && hash
}
hash () {
CURRENT_HASH="$(nix-prefetch-url "$CURRENT_URL")"
echo "CURRENT_HASH: $CURRENT_HASH" >&2
}
name () {
CURRENT_NAME="$1"
echo "CURRENT_NAME: $CURRENT_NAME" >&2
}
retrieve_version () {
@ -196,7 +209,7 @@ do_regenerate () {
}
do_overwrite () {
hash
ensure_hash
do_regenerate "$1" > "$1.new.tmp"
mv "$1.new.tmp" "$1"
}