comparison packaging/linux-installer.inc.in @ 777:ca149bad8195

(issue51) Set up autostart on installation.
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 11 Jul 2014 18:31:09 +0200
parents 87387c5786ec
children 2fb539d4b1ff
comparison
equal deleted inserted replaced
776:87387c5786ec 777:ca149bad8195
263 rm_empty_dirs "$instdata_path" 263 rm_empty_dirs "$instdata_path"
264 264
265 echo "Removing configuration files:" 265 echo "Removing configuration files:"
266 rm_files "${tbcfg_files[@]}" 266 rm_files "${tbcfg_files[@]}"
267 rm_empty_dirs "$instcfg_path" 267 rm_empty_dirs "$instcfg_path"
268
269 echo "Removing TrustBridge from autostart"
270 if [ "${SUDO_USER+X}" ] ; then
271 homedir=$(getent passwd "${SUDO_USER}" | cut -d ':' -f 6)
272 rm_files "${homedir}/.config/autostart/tustbridge.desktop"
273 else
274 config_home=${XDG_CONFIG_HOME:-~/.config}
275 rm_files "${config_home}/autostart/tustbridge.desktop"
276 fi
268 } 277 }
269 278
270 deinstall() 279 deinstall()
271 { 280 {
272 if [ "${oldinstcfg[PREFIX]}" ] ; then 281 if [ "${oldinstcfg[PREFIX]}" ] ; then
286 else 295 else
287 echo "No current installation found! No harm done." 296 echo "No current installation found! No harm done."
288 fi 297 fi
289 } 298 }
290 299
300 write_autostart()
301 {
302 cat > "$1" << EOF
303 [Desktop Entry]
304 Type=Application
305 Name=TrustBridge
306 Exec="${instcfg[PREFIX]}/bin/trustbridge" --tray
307 EOF
308 chown "${SUDO_USER:-${USER}}" "$1"
309 chmod 700 "$1"
310 }
311
312 setup_autostart()
313 {
314 # Supported desktop environments: Unity, GNOME, XFCE, LXDE, KDE
315
316 if [ $SYSINST -eq 1 -a "${SUDO_USER+X}" ] ; then
317 homedir=$(getent passwd "${SUDO_USER}" | cut -d ':' -f 6)
318 install -d "${instcfg[PREFIX]}" || fatal "Could not create '${instcfg[PREFIX]}'!"
319 if [ ! -d "${homedir}/.config/autostart/" ]; then
320 install -d "${homedir}/.config/autostart/" || \
321 fatal "Failed to create autostart directory: '${homedir}/.config/autostart/'"
322 fi
323 write_autostart "${homedir}/.config/autostart/tustbridge.desktop"
324 # System wide installation with a nonstandard XDG_CONFIG_HOME or KDEHOME is not
325 # respected with regards to autostart.
326 else
327 config_home=${XDG_CONFIG_HOME:-~/.config}
328 if [ ! -d "${config_home}/autostart" ]; then
329 install -d "${config_home}/autostart" || \
330 fatal "Failed to create autostart directory: '${config_home}/autostart'"
331 fi
332 write_autostart "${config_home}/autostart/tustbridge.desktop"
333 fi
334 }
291 335
292 #====================================================================== 336 #======================================================================
293 # main() 337 # main()
294 338
295 parse_args "$@" 339 parse_args "$@"
356 "${instcfg[PREFIX]}/bin/trustbridge-tray-starter.sh" 400 "${instcfg[PREFIX]}/bin/trustbridge-tray-starter.sh"
357 401
358 echo "Setting up cronjob ..." 402 echo "Setting up cronjob ..."
359 setup_cronjob 403 setup_cronjob
360 404
405 echo "Setting up autostart ..."
406 setup_autostart
407
361 echo "Writing installation configuration to: $instcfg_file ..." 408 echo "Writing installation configuration to: $instcfg_file ..."
362 write_instcfg 409 write_instcfg
363 exit 0 410 exit 0

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