comparison packaging/linux-installer.inc.in @ 872:02e357826417

(issue81) Add desktop file
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 06 Aug 2014 18:56:23 +0200
parents 3f23130b16b2
children 78096ad6f418
comparison
equal deleted inserted replaced
871:4efd6378c001 872:02e357826417
13 INSTCFGNAME="TrustBridge-inst.cfg" 13 INSTCFGNAME="TrustBridge-inst.cfg"
14 FORCE=0 14 FORCE=0
15 SYSINST=0 15 SYSINST=0
16 DEINSTALL=0 16 DEINSTALL=0
17 BINNAMES="###BINNAMES###" 17 BINNAMES="###BINNAMES###"
18 ICONNAME="###ICONNAME###"
18 19
19 declare -A instcfg oldinstcfg 20 declare -A instcfg oldinstcfg
20 declare inst_default_prefix instdata_path instcfg_path instcfg_file 21 declare inst_default_prefix instdata_path instcfg_path instcfg_file
21 instcfg=( 22 instcfg=(
22 [TIMESTMP]=`date -u +%Y%m%d%H%M%S` 23 [TIMESTMP]=`date -u +%Y%m%d%H%M%S`
160 if [ $SYSINST -eq 1 ] ; then 161 if [ $SYSINST -eq 1 ] ; then
161 inst_default_prefix="$SYSDEFAULT_PREFIX" 162 inst_default_prefix="$SYSDEFAULT_PREFIX"
162 instcfg_path="${SYSCFGPATH}" 163 instcfg_path="${SYSCFGPATH}"
163 instdata_path="${SYSDATAPATH}" 164 instdata_path="${SYSDATAPATH}"
164 autostart_path="$(getent passwd "${SUDO_USER}" | cut -d ':' -f 6)/.config/autostart" 165 autostart_path="$(getent passwd "${SUDO_USER}" | cut -d ':' -f 6)/.config/autostart"
166 startmenu_path="/usr/share/applications"
165 else 167 else
166 inst_default_prefix="$DEFAULT_PREFIX" 168 inst_default_prefix="$DEFAULT_PREFIX"
167 instcfg_path="${CFGPATH}" 169 instcfg_path="${CFGPATH}"
168 instdata_path="${DATAPATH}" 170 instdata_path="${DATAPATH}"
169 autostart_path=${XDG_CONFIG_HOME:-~/.config/autostart} 171 autostart_path=${XDG_CONFIG_HOME:-~/.config/autostart}
172 startmenu_path=${XDG_DATA_HOME:-~/.local/share/applications}
170 fi 173 fi
171 instcfg_file="${instcfg_path}/${INSTCFGNAME}" 174 instcfg_file="${instcfg_path}/${INSTCFGNAME}"
172 } 175 }
173 176
174 write_instcfg() 177 write_instcfg()
293 rm_files "${tbcfg_files[@]}" 296 rm_files "${tbcfg_files[@]}"
294 rm_empty_dirs "$instcfg_path" 297 rm_empty_dirs "$instcfg_path"
295 298
296 getxt "Removing TrustBridge from autostart\n" 299 getxt "Removing TrustBridge from autostart\n"
297 rm_files "${autostart_path}/trustbridge.desktop" 300 rm_files "${autostart_path}/trustbridge.desktop"
301
302 getxt "Removing TrustBridge from start menu\n"
303 rm_files "${startmenu_path}/trustbridge.desktop"
298 } 304 }
299 305
300 deinstall() 306 deinstall()
301 { 307 {
302 if [ "${oldinstcfg[PREFIX]}" ] ; then 308 if [ "${oldinstcfg[PREFIX]}" ] ; then
309 local path="${deinstdir}/$file" 315 local path="${deinstdir}/$file"
310 getxt "Deleting '%s' ...\n" "$path" 316 getxt "Deleting '%s' ...\n" "$path"
311 rm "$path" || getxt >&2 "WARNING: Could not delete: '%s'!\n" "$path" 317 rm "$path" || getxt >&2 "WARNING: Could not delete: '%s'!\n" "$path"
312 done 318 done
313 rm_empty_dirs "$deinstdir" 319 rm_empty_dirs "$deinstdir"
320 deinstdir="${oldinstcfg[PREFIX]}/share/pixmaps/trustbridge"
321 getxt "Deinstalling from '%s'.\n" "${oldinstcfg[PREFIX]}"
322 for file in $ICONNAME; do
323 local path="${deinstdir}/$file"
324 getxt "Deleting '%s' ...\n" "$path"
325 rm "$path" || getxt >&2 "WARNING: Could not delete: '%s'!\n" "$path"
326 done
327 deinstdir="${oldinstcfg[PREFIX]}/share/pixmaps/trustbridge"
328 rm_empty_dirs "$deinstdir"
329 deinstdir="${oldinstcfg[PREFIX]}/share/pixmaps"
330 rm_empty_dirs "$deinstdir"
331 deinstdir="${oldinstcfg[PREFIX]}/share"
332 rm_empty_dirs "$deinstdir"
314 deinstall_etc 333 deinstall_etc
315 getxt "Deinstallation finished.\n" 334 getxt "Deinstallation finished.\n"
316 else 335 else
317 getxt "No current installation found! No harm done.\n" 336 getxt "No current installation found! No harm done.\n"
318 fi 337 fi
326 Name=TrustBridge 345 Name=TrustBridge
327 Exec="${instcfg[PREFIX]}/bin/trustbridge" --tray 346 Exec="${instcfg[PREFIX]}/bin/trustbridge" --tray
328 EOF 347 EOF
329 chown "${SUDO_USER:-${USER}}" "$1" 348 chown "${SUDO_USER:-${USER}}" "$1"
330 chmod 700 "$1" 349 chmod 700 "$1"
350 }
351
352 write_startmenu()
353 {
354 cat > "$1" << EOF
355 [Desktop Entry]
356 Type=Application
357 Name=TrustBridge
358 Comment=Install and update trusted root certificates
359 Comment[de]=Vertrauenswürdige Wurzelzertifikate installieren und aktualisieren
360 Exec=${instcfg[PREFIX]}/bin/trustbridge
361 Icon=${instcfg[PREFIX]}/share/pixmaps/trustbridge/trustbridge.png
362 Terminal=false
363 Categories=Network;Qt;
364 StartupNotify=false
365 EOF
366 }
367
368 setup_startmenu()
369 {
370 # Supported desktop environments: Unity, GNOME, XFCE, LXDE, KDE
371 # System wide installation with a nonstandard XDG_DATA_HOME is not
372 # respected with regards to autostart.
373 if [ ! -d "${startmenu_path}" ]; then
374 install -d "${startmenu_path}" || \
375 fatal "Failed to create startmenu directory: '%s'\n" "$startmenu_path"
376 fi
377
378 write_startmenu "${startmenu_path}/trustbridge.desktop"
379 update-desktop-database 2>&1 || true
331 } 380 }
332 381
333 setup_autostart() 382 setup_autostart()
334 { 383 {
335 # Supported desktop environments: Unity, GNOME, XFCE, LXDE, KDE 384 # Supported desktop environments: Unity, GNOME, XFCE, LXDE, KDE
413 setup_cronjob 462 setup_cronjob
414 463
415 getxt "Setting up autostart ...\n" 464 getxt "Setting up autostart ...\n"
416 setup_autostart 465 setup_autostart
417 466
467 getxt "Setting up start menu entries ...\n"
468 setup_startmenu
469
418 getxt "Writing installation configuration to: %s ...\n" "$instcfg_file" 470 getxt "Writing installation configuration to: %s ...\n" "$instcfg_file"
419 write_instcfg 471 write_instcfg
420 exit 0 472 exit 0

http://wald.intevation.org/projects/trustbridge/