[PATCH] (issue81) Add desktop file

Wald Commits scm-commit at wald.intevation.org
Wed Aug 6 18:56:27 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1407344183 -7200
# Node ID 02e35782641757a46dd516f518d4218bb70953e1
# Parent  4efd6378c0014dfaa0fa295a8e2a99861e00c1d1
(issue81) Add desktop file

diff -r 4efd6378c001 -r 02e357826417 packaging/linux-createpackage.sh.in
--- a/packaging/linux-createpackage.sh.in	Wed Aug 06 18:03:23 2014 +0200
+++ b/packaging/linux-createpackage.sh.in	Wed Aug 06 18:56:23 2014 +0200
@@ -15,6 +15,7 @@
           "@CMAKE_BINARY_DIR@/cinst/mozilla"
           "@CMAKE_BINARY_DIR@/ui/trustbridge"
           "@CMAKE_BINARY_DIR@/ui/trustbridge-tray-starter.sh")
+ICON="@CMAKE_SOURCE_DIR@/ui/img/logo.png"
 
 L10N_DE_FILE="@CMAKE_BINARY_DIR@/packaging/linux-installer.l10n-de"
 
@@ -22,11 +23,13 @@
 # shar-archive.
 echo "Using $TMPDIR for temporary installation to build installer..."
 install -d "$TMPDIR/bin"
+install -d "$TMPDIR/share/pixmaps/trustbridge"
 install "${EXEFILES[@]}" "$TMPDIR/bin"
+install "$ICON" "$TMPDIR/share/pixmaps/trustbridge/trustbridge.png"
 
 echo "Creating shar archive ..."
 cd "$TMPDIR"
-shar -z -B bin/* | sed 's/^exit 0//' >>"$TMPSHAR"
+shar -z -B bin/* share/pixmaps/trustbridge/trustbridge.png | sed 's/^exit 0//' >>"$TMPSHAR"
 
 echo "Building $INSTALLER..."
 cp "@CMAKE_BINARY_DIR@/packaging/linux-installer.inc" "$INSTALLER"
@@ -35,6 +38,7 @@
   binnames="`basename $file` $binnames"
 done
 sed -i "s/###BINNAMES###/${binnames}/" "$INSTALLER"
+sed -i "s/###ICONNAME###/trustbridge.png/" "$INSTALLER"
 sed -i "/###SHAR###/r $TMPSHAR" "$INSTALLER"
 sed -i "/###L10N_DE###/r $L10N_DE_FILE" "$INSTALLER"
 chmod +x "$INSTALLER"
diff -r 4efd6378c001 -r 02e357826417 packaging/linux-installer.inc.in
--- a/packaging/linux-installer.inc.in	Wed Aug 06 18:03:23 2014 +0200
+++ b/packaging/linux-installer.inc.in	Wed Aug 06 18:56:23 2014 +0200
@@ -15,6 +15,7 @@
 SYSINST=0
 DEINSTALL=0
 BINNAMES="###BINNAMES###"
+ICONNAME="###ICONNAME###"
 
 declare -A instcfg oldinstcfg
 declare inst_default_prefix instdata_path instcfg_path instcfg_file
@@ -162,11 +163,13 @@
       instcfg_path="${SYSCFGPATH}"
       instdata_path="${SYSDATAPATH}"
       autostart_path="$(getent passwd "${SUDO_USER}" | cut -d ':' -f 6)/.config/autostart"
+      startmenu_path="/usr/share/applications"
   else
     inst_default_prefix="$DEFAULT_PREFIX"
     instcfg_path="${CFGPATH}"
     instdata_path="${DATAPATH}"
     autostart_path=${XDG_CONFIG_HOME:-~/.config/autostart}
+    startmenu_path=${XDG_DATA_HOME:-~/.local/share/applications}
   fi
     instcfg_file="${instcfg_path}/${INSTCFGNAME}"
 }
@@ -295,6 +298,9 @@
 
   getxt "Removing TrustBridge from autostart\n"
   rm_files "${autostart_path}/trustbridge.desktop"
+
+  getxt "Removing TrustBridge from start menu\n"
+  rm_files "${startmenu_path}/trustbridge.desktop"
 }
 
 deinstall()
@@ -311,6 +317,19 @@
         rm "$path" || getxt >&2 "WARNING: Could not delete: '%s'!\n" "$path"
       done
       rm_empty_dirs "$deinstdir"
+      deinstdir="${oldinstcfg[PREFIX]}/share/pixmaps/trustbridge"
+      getxt "Deinstalling from '%s'.\n" "${oldinstcfg[PREFIX]}"
+      for file in $ICONNAME; do
+        local path="${deinstdir}/$file"
+        getxt "Deleting '%s' ...\n" "$path"
+        rm "$path" || getxt >&2 "WARNING: Could not delete: '%s'!\n" "$path"
+      done
+      deinstdir="${oldinstcfg[PREFIX]}/share/pixmaps/trustbridge"
+      rm_empty_dirs "$deinstdir"
+      deinstdir="${oldinstcfg[PREFIX]}/share/pixmaps"
+      rm_empty_dirs "$deinstdir"
+      deinstdir="${oldinstcfg[PREFIX]}/share"
+      rm_empty_dirs "$deinstdir"
       deinstall_etc
       getxt "Deinstallation finished.\n"
   else
@@ -330,6 +349,36 @@
   chmod 700 "$1"
 }
 
+write_startmenu()
+{
+  cat > "$1" << EOF
+[Desktop Entry]
+Type=Application
+Name=TrustBridge
+Comment=Install and update trusted root certificates
+Comment[de]=Vertrauenswürdige Wurzelzertifikate installieren und aktualisieren
+Exec=${instcfg[PREFIX]}/bin/trustbridge
+Icon=${instcfg[PREFIX]}/share/pixmaps/trustbridge/trustbridge.png
+Terminal=false
+Categories=Network;Qt;
+StartupNotify=false
+EOF
+}
+
+setup_startmenu()
+{
+  # Supported desktop environments: Unity, GNOME, XFCE, LXDE, KDE
+  # System wide installation with a nonstandard XDG_DATA_HOME is not
+  # respected with regards to autostart.
+  if [ ! -d "${startmenu_path}" ]; then
+    install -d "${startmenu_path}" || \
+      fatal "Failed to create startmenu directory: '%s'\n" "$startmenu_path"
+  fi
+
+  write_startmenu "${startmenu_path}/trustbridge.desktop"
+  update-desktop-database 2>&1 || true
+}
+
 setup_autostart()
 {
   # Supported desktop environments: Unity, GNOME, XFCE, LXDE, KDE
@@ -415,6 +464,9 @@
 getxt "Setting up autostart ...\n"
 setup_autostart
 
+getxt "Setting up start menu entries ...\n"
+setup_startmenu
+
 getxt "Writing installation configuration to: %s ...\n" "$instcfg_file"
 write_instcfg
 exit 0
diff -r 4efd6378c001 -r 02e357826417 packaging/linux-installer.l10n-de
--- a/packaging/linux-installer.l10n-de	Wed Aug 06 18:03:23 2014 +0200
+++ b/packaging/linux-installer.l10n-de	Wed Aug 06 18:56:23 2014 +0200
@@ -15,6 +15,7 @@
   ["Deleting '%s' ...\n"]="Lösche '%s' ...\n"
   ["Deleting empty directory '%s' ...\n"]="Lösche das leere Verzeichnis '%s' ...\n"
   ["Failed to create autostart directory: '%s'\n"]="Konnte das autostart-Verzeichnis '%s' nicht erstellen\n"
+  ["Failed to create startmenu directory: '%s'\n"]="Konnte das Startmenü-Verzeichnis '%s' nicht erstellen\n"
   ["For a new prefix you should deinstall first!\n"]="Um einen neuen Installations-Pfad zu verwenden bitte erst deinstallieren!\n"
   ["Install TrustBridge.\n\n"]="Installiere TrustBridge.\n\n"
   ["Installation failed.\n"]="Installation fehlgeschlagen.\n"
@@ -29,11 +30,13 @@
   ["Really deinstall TrustBridge from '%s'? [y/n]\n"]="Soll TrustBridge wirklich aus '%s' deinstalliert werden? [j/n]\n"
   ["Removing PID file from: %s:\n"]="Entferne PID-File aus: %s\n"
   ["Removing TrustBridge from autostart\n"]="Entferne TrustBridge aus autostart\n"
+  ["Removing TrustBridge from startmenu\n"]="Entferne TrustBridge aus dem Startmenü\n"
   ["Removing certificate lists from: %s:\n"]="Entferne Zertifikatsliste aus: %s\n"
   ["Removing configuration files:\n"]="Entferne Konfigurationsdateien:\n"
   ["Removing cron job ...\n"]="Entferne den Cron-Job ...\n"
   ["Select installation prefix for TrustBridge [%s]: "]="Installations-Pfad für TrustBridge [%s]: "
   ["Setting up autostart ...\n"]="Konfiguriere autostart ...\n"
+  ["Setting up startmenu...\n"]="Konfiguriere Startmenü ...\n"
   ["Setting up cronjob ...\n"]="Konfiguriere den Cron-Job ...\n"
   ["System wide installation requires root privileges!\n"]="Für die systemweite Installation werden root-Rechte benötigt!\n"
   ["Uninstalling certificates ...\n"]="Deinstalliere Zertifikate ...\n"


More information about the Trustbridge-commits mailing list