tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
owmods-cli: update update script
Locochoco
2 years ago
6b2ee4c5
bc9ae680
+36
1 changed file
expand all
collapse all
unified
split
pkgs
applications
misc
owmods-cli
update.sh
+36
pkgs/applications/misc/owmods-cli/update.sh
···
1
1
+
#!/usr/bin/env nix-shell
2
2
+
#!nix-shell -i bash -p curl gnused nix-prefetch nix-prefetch-github jq wget
3
3
+
4
4
+
#modified version of https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/servers/readarr/update.sh
5
5
+
set -e
6
6
+
7
7
+
dirname="$(dirname "$0")"
8
8
+
9
9
+
updateCliHash()
10
10
+
{
11
11
+
version=$1
12
12
+
13
13
+
url="https://github.com/ow-mods/ow-mod-man/releases/cli_v$version"
14
14
+
prefetchJson=$(nix-prefetch-github ow-mods ow-mod-man --rev cli_v$version)
15
15
+
sha256="$(echo $prefetchJson | jq -r ".sha256")"
16
16
+
17
17
+
sed -i "s|hash = \"[a-zA-Z0-9\/+-=]*\";|hash = \"sha256-$sha256\";|g" "$dirname/default.nix"
18
18
+
#download and replace lock file
19
19
+
wget https://raw.githubusercontent.com/ow-mods/ow-mod-man/cli_v$version/Cargo.lock -q -O $dirname/Cargo.lock
20
20
+
21
21
+
}
22
22
+
23
23
+
updateVersion()
24
24
+
{
25
25
+
sed -i "s/version = \"[0-9.]*\";/version = \"$1\";/g" "$dirname/default.nix"
26
26
+
}
27
27
+
28
28
+
latestTag=$(curl https://api.github.com/repos/ow-mods/ow-mod-man/releases | jq -r ".[0].tag_name")
29
29
+
latestVersion=${latestTag#*v}
30
30
+
echo "latest version: ${latestVersion}"
31
31
+
32
32
+
echo "updating..."
33
33
+
updateVersion $latestVersion
34
34
+
#
35
35
+
updateCliHash $latestVersion
36
36
+
echo "updated cli"