diff options
author | Tim Steinbach <tim@nequissimus.com> | 2019-04-06 19:45:00 -0400 |
---|---|---|
committer | Tim Steinbach <tim@nequissimus.com> | 2019-04-06 19:47:08 -0400 |
commit | 3e6b38ebc882f4015e1bf275153f47014a4bb91b (patch) | |
tree | ae806bf730496cf519ee3792fa655e79a64e95b2 /pkgs/shells/zsh | |
parent | cce486838b6c52dedfec1c93f60ebadb72c48431 (diff) | |
download | nixlib-3e6b38ebc882f4015e1bf275153f47014a4bb91b.tar nixlib-3e6b38ebc882f4015e1bf275153f47014a4bb91b.tar.gz nixlib-3e6b38ebc882f4015e1bf275153f47014a4bb91b.tar.bz2 nixlib-3e6b38ebc882f4015e1bf275153f47014a4bb91b.tar.lz nixlib-3e6b38ebc882f4015e1bf275153f47014a4bb91b.tar.xz nixlib-3e6b38ebc882f4015e1bf275153f47014a4bb91b.tar.zst nixlib-3e6b38ebc882f4015e1bf275153f47014a4bb91b.zip |
oh-my-zsh: Add update script
Diffstat (limited to 'pkgs/shells/zsh')
-rwxr-xr-x | pkgs/shells/zsh/oh-my-zsh/update.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pkgs/shells/zsh/oh-my-zsh/update.sh b/pkgs/shells/zsh/oh-my-zsh/update.sh new file mode 100755 index 000000000000..08b0daa4387c --- /dev/null +++ b/pkgs/shells/zsh/oh-my-zsh/update.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p curl common-updater-scripts jq + +set -eu -o pipefail + +oldVersion="$(nix-instantiate --eval -E "with import ./. {}; oh-my-zsh.version or (builtins.parseDrvName oh-my-zsh.name).version" | tr -d '"')" +latestSha="$(curl -L -s https://api.github.com/repos/robbyrussell/oh-my-zsh/commits\?sha\=master\&since\=${oldVersion} | jq -r '.[0].sha')" +url="$(nix-instantiate --eval -E "with import ./. {}; oh-my-zsh.src.url" | tr -d '"')" + +if [ ! "null" = "${latestSha}" ]; then + latestDate="$(curl -L -s https://api.github.com/repos/robbyrussell/oh-my-zsh/commits/${latestSha} | jq '.commit.author.date' | sed 's|"\(.*\)T.*|\1|g')" + update-source-version oh-my-zsh "${latestSha}" --version-key=rev + update-source-version oh-my-zsh "${latestDate}" --ignore-same-hash + nixpkgs="$(git rev-parse --show-toplevel)" + default_nix="$nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix" + git add "${default_nix}" + git commit -m "oh-my-zsh: ${oldVersion} -> ${latestDate}" +else + echo "oh-my-zsh is already up-to-date" +fi |