about summary refs log tree commit diff
path: root/pkgs/desktops/mate
diff options
context:
space:
mode:
authorJosé Romildo Malaquias <malaquias@gmail.com>2018-02-13 22:41:08 -0200
committerJosé Romildo Malaquias <malaquias@gmail.com>2018-02-13 22:41:08 -0200
commit6c687120da0d53739f1a944fc52f89bae15d7226 (patch)
treec18e5dfa2336d62b48cfd17a7c84373aeea384fe /pkgs/desktops/mate
parentaa001cc937f0ca7cb2ef25eefa0d76fb98c69e5f (diff)
downloadnixlib-6c687120da0d53739f1a944fc52f89bae15d7226.tar
nixlib-6c687120da0d53739f1a944fc52f89bae15d7226.tar.gz
nixlib-6c687120da0d53739f1a944fc52f89bae15d7226.tar.bz2
nixlib-6c687120da0d53739f1a944fc52f89bae15d7226.tar.lz
nixlib-6c687120da0d53739f1a944fc52f89bae15d7226.tar.xz
nixlib-6c687120da0d53739f1a944fc52f89bae15d7226.tar.zst
nixlib-6c687120da0d53739f1a944fc52f89bae15d7226.zip
mate: add update script
Diffstat (limited to 'pkgs/desktops/mate')
-rwxr-xr-xpkgs/desktops/mate/update.sh54
1 files changed, 54 insertions, 0 deletions
diff --git a/pkgs/desktops/mate/update.sh b/pkgs/desktops/mate/update.sh
new file mode 100755
index 000000000000..736bcbd34fc6
--- /dev/null
+++ b/pkgs/desktops/mate/update.sh
@@ -0,0 +1,54 @@
+#!/usr/bin/env nix-shell
+#!nix-shell -i bash -p libarchive curl common-updater-scripts
+
+set -eu -o pipefail
+
+cd "$(dirname "${BASH_SOURCE[0]}")"
+root=../../..
+export NIXPKGS_ALLOW_UNFREE=1
+
+mate_version=1.20
+theme_version=3.22
+materepo=https://pub.mate-desktop.org/releases/${mate_version}
+themerepo=https://pub.mate-desktop.org/releases/themes/${theme_version}
+
+version() {
+    (cd "$root" && nix-instantiate --eval --strict -A "$1.version" | tr -d '"')
+}
+
+update_package() {
+    local p=$1
+    echo $p
+
+    local repo
+    if [ "$p" = "mate-themes" ]; then
+        repo=$themerepo
+    else
+        repo=$materepo
+    fi
+  
+    local p_version_old=$(version mate.$p)
+    local p_versions=$(curl -sS ${repo}/ | sed -rne "s/.*\"$p-([0-9]+\\.[0-9]+\\.[0-9]+)\\.tar\\.xz.*/\\1/p")
+    local p_version=$(echo $p_versions | sed -e 's/ /\n/g' | sort -t. -k 1,1n -k 2,2n -k 3,3n | tail -n1)
+  
+    if [[ "$p_version" = "$p_version_old" ]]; then
+        echo "nothing to do, $p $p_version is current"
+        echo
+        return
+    fi
+
+    # Download package and save hash and file path.
+    local url="$repo/$p-${p_version}.tar.xz"
+    mapfile -t prefetch < <(nix-prefetch-url --print-path "$url")
+    local hash=${prefetch[0]}
+    local path=${prefetch[1]}
+    echo "$p: $p_version_old -> $p_version"
+    (cd "$root" && update-source-version mate.$p "$p_version" "$hash")
+    echo
+}
+
+for d in $(ls -A --indicator-style=none); do
+    if [ -d $d ]; then
+        update_package $d
+    fi
+done