How to download actuall deb file automaticly?

Hello,

i lately switched my obsidian installation from flatpak to deb package.
I always writing a shell script of my installations, so that I can easily set up on a new PC.

For installing obsidian from deb file I write this little script:

wget https://github.com/obsidianmd/obsidian-releases/releases/download/v1.1.9/obsidian_1.1.9_amd64.deb -O obsidian.deb
sudo gdebi -n obsidian.deb
rm obsidian.deb

With this implementation I am not really satisfied, because the version number is part of the link, so there is always used exactly this version. I would prefer to always getting the newest version, but I can’t find a link, that always directs to the newest deb file.

Is there an easy way the get the link to the newest deb file?
(Parsing the website wouldn’t be to unstable in my opinion and the GitHub API needs credentials, which seems too cumbersome to me.)

You can reuse the version checking pattern used by the Obsidian flatpak:

You can do this for example:

#!/bin/sh

set -oeu pipefail

PACKAGE="obsidian-latest.deb"
RELEASES_URL="https://api.github.com/repos/obsidianmd/obsidian-releases/releases/latest"
DOWNLOAD_URL="$(wget -q "${RELEASES_URL}" -O - | jq -r '.assets[] | select(.name | endswith("_amd64.deb")) | .browser_download_url')"

wget "${DOWNLOAD_URL}" -O "${PACKAGE}"

sudo gdebi -n "${PACKAGE}"
rm "${PACKAGE}"
1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.