Linux command to update XnView (Debian/Ubuntu)

Ask for help and post your question on how to use XnView MP.

Moderators: XnTriq, helmut, xnview

postcd
Posts: 24
Joined: Sun Aug 05, 2018 10:07 am

Linux command to update XnView (Debian/Ubuntu)

Post by postcd »

Being on Linux Debian, i have choice to select .tgz, .deb, .appimage at https://www.xnview.com/en/xnviewmp/#downloads
I have selected .deb since i wanted maximum compatible with stable Debian and small size.
Now the issue is how to keep up to date without wasting too much time manually downloading and executing on CLI.

I guess AppImage is not updateable by https://github.com/AppImageCommunity/Ap ... ate#readme
And you have no Debian/Ubuntu compatible apt repostitory to allow automatic updates, so there is some Linux bash script for Debian/Ubuntu to show local and remote app version, prompt to download .deb and install it.

Code: Select all

#!/usr/bin/bash
# Bash script for Debian/Ubuntu Linux to update XnView .deb

remotedl="https://download.xnview.com/XnViewMP-linux-x64.deb"
dstdir=/dev/shm # RAM based temorary storage
processname="XnView" # case insensitive, script will report if app is running

# Discover and print local, remote versions of the app
local=$(dpkg -s xnview | grep 'Version: '|sed -e 's/Version: //')
remote=$(wget https://www.xnview.com/en/xnviewmp/#downloads -qO -|grep '<span class="text-muted">Version'|grep -o -P '(?<=<span class="text-muted">Version ).*?(?=</span>)')
echo -e "Local: $local\nRemote: $remote"; if [[ "$local" == "$remote" ]];then echo "Local and remote are same. No update needed, exitting." && exit; fi

# Ask whether to continue
read -r -p "To coninue updating from \"$remotedl\", quit \"$processname\" and then hit any key to continue" c

# Install necessities
sudo apt install dpkg wget -y 2>/dev/null

# Download from github
if [[ ! -d "$dstdir" ]]; then echo "Destination does not exist. Exitting" && exit; else
cd "$dstdir" && wget -cO "$dstdir"/XnView.deb "$remotedl" && sudo dpkg -i "$dstdir"/XnView*.deb
fi
Its command:

Code: Select all

wget https://www.xnview.com/en/xnviewmp/#downloads -qO -|grep '<span class="text-muted">Version'|grep -o -P '(?<=<span class="text-muted">Version ).*?(?=</span>)'
is not much accurate since it shows 1.5.0 despite downloaded app is 1.5.2. Thanks to this i can not automate the update i think.
Neuro-NX
Posts: 9
Joined: Wed Aug 31, 2022 9:38 pm

Re: Linux command to update XnView (Debian/Ubuntu)

Post by Neuro-NX »

is not much accurate since it shows 1.5.0 despite downloaded app is 1.5.2. Thanks to this i can not automate the update i think
Pierre uses this page https://www.xnview.com/mantisbt/changelog_page.php to post changelogs. It will be more accurate than using the homepage.

So you could do this.

The first post is "Not Yet Released" so we can use command head to extract the first two versions, and with tail show only the latest released version. Using uniq is required to prevent showing duplicate versions.

Code: Select all

wget https://www.xnview.com/mantisbt/changelog_page.php -qO -| grep -Eo "version_id=([0-9]+)\">([0-9\.]+)" | cut -d">" -f2 | uniq | head -n+2 | tail -n-1