about summary refs log tree commit diff
path: root/pkgs/applications/science/math/sage/fetch-mirrors.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/science/math/sage/fetch-mirrors.sh')
-rwxr-xr-xpkgs/applications/science/math/sage/fetch-mirrors.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkgs/applications/science/math/sage/fetch-mirrors.sh b/pkgs/applications/science/math/sage/fetch-mirrors.sh
new file mode 100755
index 000000000000..a1103e86beb9
--- /dev/null
+++ b/pkgs/applications/science/math/sage/fetch-mirrors.sh
@@ -0,0 +1,11 @@
+#! /usr/bin/env nix-shell
+#! nix-shell -i bash -p curl go-pup
+
+# Fetches a list of all available source mirrors from the sage homepage.
+# Note that the list is sorted by country, but fetchurl doesn't offer an option
+# to customize mirror preference.
+
+curl -s http://www.sagemath.org/download-source.html \
+    | pup 'table#mirror'  \
+    | pup 'a attr{href}' \
+    | sed -e 's/index\.html/sage-${version}.tar.gz/'