There was actually a point to showing how one can pipe-line several small applications into a larger whole. That’s really the power of the command line. But of course, you are right that it is simpler, albeit less pædagogical ![]()
Will you add these small files to the distribution? Perhaps with a script like (named e.g., desktop-integration.sh or something like that)
#!/bin/sh
dest=/usr/local
mode=install
usage() {
echo "Usage: $0 [install|uninstall] [--user|--system|--destination PREFIX]"
}
while test $# -gt 0 ; do
case $1 in
-h|--help) usage ; exit 0 ;;
install) mode=install ;;
uninstall) mode=uninstall ;;
-u|--user) dest=$HOME/.local ;;
-s|--system) dest=/usr/local ;;
-d|--destination) dest=$2 ; shift ;;
*) echo "$0: Unknown argument: $1" ; exit 1 ;;
esac
shift
done
if test "x$mode" == "xinstall" ; then
EXEC_PATH=$(realpath "$0")
INSTALL_DIR=$(dirname "${EXEC_PATH}")
sed "s|$$INSTALL_DIR|$INSTALL_DIR|" < vassal.desktop > tmp.desktop
sed "s|$$INSTALL_DIR|$INSTALL_DIR|" < applications-x-vassal.xml > tmp.xml
mkdir -p $dest/applications
mkdir -p $dest/mime/packages
mkdir -p $dest/bin
mv tmp.desktop $dest/applications/vassal.desktop
mv tmp.xml $dest/mime/packages/application-x-vassal.xml
update-mime-database $dest/mime
update-desktop-database $dest/
(cd $dest/bin && ln -s $EXEC_PATH vassal)
else
rm -f $dest/mime/packages/application-x-vassal.xml
rm -f $dest/applications/vassal.desktop
rm -f $dest/bin/vassal
rmdir -p --ignore-fail-on-non-empty $dest/applications
rmdir -p --ignore-fail-on-non-empty $dest/mime/packages
rmdir -p --ignore-fail-on-non-empty $dest/bin
fi
A user can then easily install the integration - either system-wide or for the user only.
Yours,
Christian