about summary refs log tree commit diff
path: root/pkgs/applications/office/morgen/update.sh
blob: e12f86a04bbca85e69da536f0cb3ff5f42f20bb5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq common-updater-scripts

set -euo pipefail

# URL to check for the latest version
latestUrl="https://dl.todesktop.com/210203cqcj00tw1/linux/deb/x64"

# Fetch the latest version information
latestInfo=$(curl -sI -X GET $latestUrl | grep -oP 'morgen-\K\d+(\.\d+)*(?=[^\d])')

if [[ -z "$latestInfo" ]]; then
    echo "Could not find the latest version number."
    exit 1
fi

# Extract the version number
latestVersion=$(echo "$latestInfo" | head -n 1)

echo "Latest version of Morgen is $latestVersion"

# Update the package definition
update-source-version morgen "$latestVersion"

# Fetch and update the hash
nix-prefetch-url --unpack "https://dl.todesktop.com/210203cqcj00tw1/versions/${latestVersion}/linux/deb"