From 5d2c2b27a6323e2666378b986129b2a7c2c39e5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 6 Feb 2022 16:04:24 +0100 Subject: New upstream version 5.2.2GA --- app/lib/xtrkcad-setup | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100755 app/lib/xtrkcad-setup (limited to 'app/lib/xtrkcad-setup') diff --git a/app/lib/xtrkcad-setup b/app/lib/xtrkcad-setup new file mode 100755 index 0000000..6e12dc5 --- /dev/null +++ b/app/lib/xtrkcad-setup @@ -0,0 +1,81 @@ +#!/bin/sh + +usage() { + echo "$0 (install|remove|desktop) " + echo "install: Sets up file associations and menus for XTrkCad" + echo "remove: Removes file associations and menus for XTrkCad" + echo "desktop: Installs short cut on the user's desktop" + echo + echo " is the location of XTrkCad's data files" + echo + echo "to be run as normal user" + exit 0 +} + +echo "`date`: $0 $* as ${USER}" + +if [ $# -ne 2 ] ; then + usage +fi + +COMMAND=$1 +export INSTALLDIR=$2 + +if [ ! -d ${INSTALLDIR} ] ; then + echo "$0: $INSTALLDIR: not found" + exit 1 +fi +if [ ! -f ${INSTALLDIR}/applications/xtrkcad.xml ] ; then + echo "$0: $INSTALLDIR/applications/xtrkcad.xml: not found" + exit 1 +fi +if [ ! -f ${INSTALLDIR}/applications/xtrkcad.desktop ] ; then + echo "$0: $INSTALLDIR/applications/xtrkcad.desktop: not found" + exit 1 +fi +if [ ! -f ${INSTALLDIR}/pixmaps/xtrkcad.png ] ; then + echo "$0: $INSTALLDIR/pixmaps/xtrkcad.png: not found" + exit 1 +fi + +ID=`id -u` +if [ $ID -eq 0 ] ; then + echo $0: Must not be root + exit 1 +fi + +if [ "$COMMAND" = "install" ] ; then + echo SETUP ICONS + # Set icon for file browser + xdg-icon-resource install --context mimetypes --novendor --size 64 ${INSTALLDIR}/pixmaps/xtrkcad.png xtrkcad + # set icon for file browser + xdg-icon-resource install --novendor --size 64 ${INSTALLDIR}/pixmaps/xtrkcad.png application-x-xtrkcad + echo SETUP MIME + # mimetype for .xtc files is application/x-xtrkcad + xdg-mime install --novendor ${INSTALLDIR}/applications/xtrkcad.xml + # default handler for application/x-xtrkcad is xtrkcad + xdg-mime default xtrkcad.desktop application/x-xtrkcad + echo SETUP DESKTOP + # add app to system menu + xdg-desktop-menu install --novendor ${INSTALLDIR}/applications/xtrkcad.desktop + # add desktop shortcut + xdg-desktop-icon install --novendor ${INSTALLDIR}/applications/xtrkcad.desktop + chmod 755 ${HOME}/Desktop/xtrkcad.desktop + +elif [ "$COMMAND" = "remove" ] ; then + xdg-desktop-icon uninstall --novendor ${INSTALLDIR}/applications/xtrkcad.desktop + xdg-desktop-menu uninstall ${INSTALLDIR}/applications/xtrkcad.desktop + xdg-mime uninstall --novendor ${INSTALLDIR}/applications/xtrkcad.xml + xdg-icon-resource uninstall --novendor --size 64 xtrkcad + xdg-icon-resource uninstall --novendor --context mimetypes --size 64 xtrkcad + +elif [ "$COMMAND" = "desktop" ] ; then + echo SETUP DESKTOP + # set desktop command + xdg-desktop-menu install --novendor ${INSTALLDIR}/applications/xtrkcad.desktop + xdg-desktop-icon install --novendor ${INSTALLDIR}/applications/xtrkcad.desktop + chmod 755 ${HOME}/Desktop/xtrkcad.desktop + +else + usage +fi -- cgit v1.2.3 From a14a7a0ccc9de76aeab0b2e4bbf58f1a79deedc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 3 Jul 2024 10:19:30 +0200 Subject: New upstream version 5.3.0GA --- app/lib/xtrkcad-setup | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'app/lib/xtrkcad-setup') diff --git a/app/lib/xtrkcad-setup b/app/lib/xtrkcad-setup index 6e12dc5..d4b8e78 100755 --- a/app/lib/xtrkcad-setup +++ b/app/lib/xtrkcad-setup @@ -2,6 +2,7 @@ usage() { echo "$0 (install|remove|desktop) " + echo echo "install: Sets up file associations and menus for XTrkCad" echo "remove: Removes file associations and menus for XTrkCad" echo "desktop: Installs short cut on the user's desktop" @@ -18,8 +19,8 @@ if [ $# -ne 2 ] ; then usage fi -COMMAND=$1 -export INSTALLDIR=$2 +COMMAND="$1" +export INSTALLDIR="$2" if [ ! -d ${INSTALLDIR} ] ; then echo "$0: $INSTALLDIR: not found" @@ -49,7 +50,8 @@ if [ "$COMMAND" = "install" ] ; then # Set icon for file browser xdg-icon-resource install --context mimetypes --novendor --size 64 ${INSTALLDIR}/pixmaps/xtrkcad.png xtrkcad # set icon for file browser - xdg-icon-resource install --novendor --size 64 ${INSTALLDIR}/pixmaps/xtrkcad.png application-x-xtrkcad + xdg-icon-resource install --context apps --novendor --size 64 ${INSTALLDIR}/pixmaps/xtrkcad.png xtrkcad + xdg-icon-resource install --context apps --novendor --size 64 ${INSTALLDIR}/pixmaps/xtrkcad.png application-x-xtrkcad echo SETUP MIME # mimetype for .xtc files is application/x-xtrkcad xdg-mime install --novendor ${INSTALLDIR}/applications/xtrkcad.xml @@ -63,11 +65,15 @@ if [ "$COMMAND" = "install" ] ; then chmod 755 ${HOME}/Desktop/xtrkcad.desktop elif [ "$COMMAND" = "remove" ] ; then + echo REMOVE DESKTOP xdg-desktop-icon uninstall --novendor ${INSTALLDIR}/applications/xtrkcad.desktop xdg-desktop-menu uninstall ${INSTALLDIR}/applications/xtrkcad.desktop + echo REMOVE MIME xdg-mime uninstall --novendor ${INSTALLDIR}/applications/xtrkcad.xml - xdg-icon-resource uninstall --novendor --size 64 xtrkcad - xdg-icon-resource uninstall --novendor --context mimetypes --size 64 xtrkcad + echo REMOVE ICONS + xdg-icon-resource uninstall --context apps --novendor --size 64 application-x-xtrkcad + xdg-icon-resource uninstall --context apps --novendor --size 64 xtrkcad + xdg-icon-resource uninstall --context mimetypes --novendor --size 64 xtrkcad elif [ "$COMMAND" = "desktop" ] ; then echo SETUP DESKTOP -- cgit v1.2.3