Installation script for Linux - by a Linux user

Ideas for improvements and requests for new features in XnView MP

Moderators: XnTriq, xnview

Post Reply
Posts: 1
Joined: Tue Aug 06, 2013 11:58 am

Installation script for Linux - by a Linux user

Post by jadaml » Tue Aug 06, 2013 12:40 pm

I've quickly put together a very simple installation script for XnView MP tgz version, just to improve the user experience on installation of your software on non-debian based (like Redhat, openSUSE, Arch linux, etc.) systems. The following code expect that the XnView files is already in their desired place, and only makes the *.desktop file and the script files accessible by sym-links these files in to their "place". If no root password is provided or the current user isn't root, then it will only become accessible by the current user. (Providing the proper rights, the application can still be accessed by others, but they will have to navigate to the location of XnView.)

Code: Select all

dirname="`dirname "$(readlink -e "$0")"`"
sed -i~ "s/\/home\/pierre\/Desktop\/XnView/${dirname}/g" "$dirname/XnView.desktop"
sudo ln -s "$dirname/XnView.desktop" /usr/local/share/applications/XnView.desktop &&
sudo ln -s "$dirname/" /usr/local/bin/xnview
} || {
mkdir -p ~/.local/share/applications &&
mkdir -p ~/bin &&
ln -s "$dirname/XnView.desktop" ~/.local/share/applications/XnView.desktop &&
ln -s "$dirname/" ~/bin/xnview
This code in this form only works properly if it is started from a terminal, and has small fault-tolerance, but critical failure has a small chance, and provides a fallback operation. The code could be made more flexible by providing the option to change the "/usr/local" prefix. It does not creates system-wide folders, but only creates folders for the user.

For the best experience, I would recommend to create an installer with a tool, like with Autopackage for system that has neither Debian or Redhat like package management. (I forgot the name of the other one that I wanted to recommend, but usually Humble Bundle apps for Linux are distributed with it.) Or possibly provide an RPM package as well? :)

Post Reply