summaryrefslogtreecommitdiffstats
path: root/pkgs/common-updater/scripts
diff options
context:
space:
mode:
authorJosé Romildo <malaquias@gmail.com>2022-02-21 12:10:33 -0300
committerJosé Romildo <malaquias@gmail.com>2022-02-21 13:01:49 -0300
commit005ac63a1910945086e40d197164a5aae4c38090 (patch)
tree78e00cb9bb05fcb853b300cb7e8e0604f3de87fd /pkgs/common-updater/scripts
parentba59355e8105035382b2f4056a97b1ffcd1bb70a (diff)
httpTwoLevelsUpdater: init
Diffstat (limited to 'pkgs/common-updater/scripts')
-rwxr-xr-xpkgs/common-updater/scripts/list-archive-two-levels-versions (renamed from pkgs/common-updater/scripts/list-archive-two-level-versions)22
1 files changed, 14 insertions, 8 deletions
diff --git a/pkgs/common-updater/scripts/list-archive-two-level-versions b/pkgs/common-updater/scripts/list-archive-two-levels-versions
index ae29d533fc3b..4263a9de3ca3 100755
--- a/pkgs/common-updater/scripts/list-archive-two-level-versions
+++ b/pkgs/common-updater/scripts/list-archive-two-levels-versions
@@ -2,9 +2,9 @@
# lists all available versions listed for a package in a site (http)
-archive="$1" # archive url
-pname="$2" # package name
-file="$3" # file for writing debugging information
+archive="" # archive url
+pname="" # package name
+file="" # file for writing debugging information
while (( $# > 0 )); do
flag="$1"
@@ -17,7 +17,7 @@ while (( $# > 0 )); do
pname="${flag#*=}"
;;
--file=*)
- version="${flag#*=}"
+ file="${flag#*=}"
;;
*)
echo "$0: unknown option ‘${flag}’"
@@ -26,13 +26,19 @@ while (( $# > 0 )); do
esac
done
-if [ -z "$archive" ]; then
- echo "$scriptName: Missing archive url"
- exit 1
+# by default set url to the base dir of the first url in src.urls
+if [[ -z "$archive" ]]; then
+ archive="$(nix-instantiate $systemArg --eval -E \
+ "with import ./. {}; dirOf (dirOf (lib.head $UPDATE_NIX_ATTR_PATH.src.urls))" \
+ | tr -d '"')"
+fi
+
+if [[ -z "$pname" ]]; then
+ pname="$UPDATE_NIX_ATTR_PATH"
fi
# print a debugging message
-if [ -n "$file" ]; then
+if [[ -n "$file" ]]; then
echo "# Listing versions for '$pname' at $archive" >> $file
fi