Obsidian

Post links to your 64bit module repos here. Repo maintainers are responsible for resolving any issues caused by their xzm's.
rych
Warlord
Warlord
Posts: 787
Joined: 04 Jan 2014, 04:27
Distribution: Porteus 5.0 x64 OpenBox
Location: NZ
Contact:

Obsidian

Post#1 by rych » 06 May 2025, 11:15

The script below updates Obsidian xzm module (or installs if missing). Since their AppImage doesn't integrate well with the system: .desktop files with [Desktop Entry]: MimeType etc. we're using their .deb.

In principle, Obsidian can self-update by downloading the new version into your home .config folder. Instead, I suggest disabling the self-update and use the script to build a new xzm module, similar to how you stop your web browser's self-update on porteus because it's unable to update the xzm module.

Code: Select all

#!/usr/bin/bash
# When Obsidian reports a new version
# close it and run this script instead
URL=https://api.github.com/repos/obsidianmd/obsidian-releases/releases/latest
cd $MODDIR
xzm=$(find . -name obsidian*.xzm)
#assuming e.g. obsidian_1.8.9_amd64.xzm
current=$(basename $xzm | cut -d _ -f 2)
url=$(curl -s $URL | grep -oP '"browser_download_url": "\K.*?\.deb(?=")')
latest=$(basename $url | cut -d _ -f 2)
echo "$latest > $current"
#the following comparison is lexicographical so 1.8.10<1.8.9
#if [[ $latest > $current ]]; then
if [[ $(printf '%s\n' "$current" "$latest" | sort -V | tail -n1) != "$current" ]]; then
    echo "Upgrading from $current to $latest"
    deactivate $xzm -q
    mv $xzm ${xzm%?}_
    #xzm=${xzm%?}_
    wget -Nq --show-progress $url 
    deb2xzm -z $(basename $url)
    activate $(basename $url .deb).xzm -q
fi
xzmDEL=$(find . -name obsidian*.xz_)
debDEL=$(find . -name obsidian*.deb)
if [[ -n "$xzmDEL" || -n "$debDEL" ]]; then
    echo "$(tput setaf 2) These can be deleted:" #green
    ls $xzmDEL $debDEL
    echo "$(tput bold) "
    read -t 10 -n 1 -r -p "Delete them now? [y/N] " response
    if [[ $response == [yY] ]]; then
        rm $xzmDEL $debDEL
    fi
    echo "$(tput sgr0)"
fi

# test run under root:
#obsidian --no-sandbox
#/opt/Obsidian/obsidian --no-sandbox
Also, consider adding this line to your changes_exit.cfg, or else your /changes can grow by 100s MB:

Code: Select all

!/root/.config/obsidian/*Cache