annotate packaging/linux-installer.inc.in @ 1136:e82c440c2727

Add small comment about update option.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 17 Sep 2014 16:23:33 +0200
parents f1384bf9d4a4
children
rev   line source
680
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
1 #!/bin/bash
1048
7bd1d723414d (issue84) Ubuntu Installer: Add installation howto.
Bernhard Reiter <bernhard@intevation.de>
parents: 1040
diff changeset
2 # Um TrustBridge zu installieren:
7bd1d723414d (issue84) Ubuntu Installer: Add installation howto.
Bernhard Reiter <bernhard@intevation.de>
parents: 1040
diff changeset
3 # 1. Prüfen Sie ob Sie dieser Datei genügend vertrauen, um ihr die Kontrolle
1133
54a6fa9e44cf Deleted trailing white space.
Sascha Wilde <wilde@intevation.de>
parents: 1132
diff changeset
4 # über diesen Rechner zu übergeben. Beispielsweise durch Vergleich mit
1048
7bd1d723414d (issue84) Ubuntu Installer: Add installation howto.
Bernhard Reiter <bernhard@intevation.de>
parents: 1040
diff changeset
5 # einer starken Prüfsumme aus einer zweiten, unabhängigen Quelle.
7bd1d723414d (issue84) Ubuntu Installer: Add installation howto.
Bernhard Reiter <bernhard@intevation.de>
parents: 1040
diff changeset
6 # 2. Öffnen Sie eine Kommandozeile, z.B. klicken Sie auf das "Terminal"-Symbol.
7bd1d723414d (issue84) Ubuntu Installer: Add installation howto.
Bernhard Reiter <bernhard@intevation.de>
parents: 1040
diff changeset
7 # 3. Wechseln Sie in das Verzeichnis, in welchem diese Datei gespeichert ist.
7bd1d723414d (issue84) Ubuntu Installer: Add installation howto.
Bernhard Reiter <bernhard@intevation.de>
parents: 1040
diff changeset
8 # Geben Sie Z.B. in die Kommandozeile ein: cd ~/Schreibtisch
1049
52c68a773194 Ubuntu Installer, short instruction with explicit mention that this example is for one user only.
Bernhard Reiter <bernhard@intevation.de>
parents: 1048
diff changeset
9 # 4. Starten Sie die Anwendung auf der Kommandozeile, beispielsweise
52c68a773194 Ubuntu Installer, short instruction with explicit mention that this example is for one user only.
Bernhard Reiter <bernhard@intevation.de>
parents: 1048
diff changeset
10 # als Installation nur für den aktuellen Nutzer, indem Sie eingeben:
52c68a773194 Ubuntu Installer, short instruction with explicit mention that this example is for one user only.
Bernhard Reiter <bernhard@intevation.de>
parents: 1048
diff changeset
11 # bash TrustBridge-1.0.0-i386.sh
1048
7bd1d723414d (issue84) Ubuntu Installer: Add installation howto.
Bernhard Reiter <bernhard@intevation.de>
parents: 1040
diff changeset
12 # Tipp: Die Tab-Taste nach dem "Tr" ergänzt oft den ganzen Namen.
7bd1d723414d (issue84) Ubuntu Installer: Add installation howto.
Bernhard Reiter <bernhard@intevation.de>
parents: 1040
diff changeset
13 #
7bd1d723414d (issue84) Ubuntu Installer: Add installation howto.
Bernhard Reiter <bernhard@intevation.de>
parents: 1040
diff changeset
14 # NB: Wir konnten kein übliches .deb Paket verwenden, da wir Ihnen
7bd1d723414d (issue84) Ubuntu Installer: Add installation howto.
Bernhard Reiter <bernhard@intevation.de>
parents: 1040
diff changeset
15 # auch die Installation als reiner Nutzer ohne Admin-Rechte ermöglichen.
7bd1d723414d (issue84) Ubuntu Installer: Add installation howto.
Bernhard Reiter <bernhard@intevation.de>
parents: 1040
diff changeset
16 #
7bd1d723414d (issue84) Ubuntu Installer: Add installation howto.
Bernhard Reiter <bernhard@intevation.de>
parents: 1040
diff changeset
17 # To install TrustBridge:
7bd1d723414d (issue84) Ubuntu Installer: Add installation howto.
Bernhard Reiter <bernhard@intevation.de>
parents: 1040
diff changeset
18 # 1. Verify that you trust this specific file far enough, that you are willing
7bd1d723414d (issue84) Ubuntu Installer: Add installation howto.
Bernhard Reiter <bernhard@intevation.de>
parents: 1040
diff changeset
19 # to hand over the control of your computer to it. For example compare
7bd1d723414d (issue84) Ubuntu Installer: Add installation howto.
Bernhard Reiter <bernhard@intevation.de>
parents: 1040
diff changeset
20 # a strong checksum of the file to one from a second, independent source.
7bd1d723414d (issue84) Ubuntu Installer: Add installation howto.
Bernhard Reiter <bernhard@intevation.de>
parents: 1040
diff changeset
21 # 2. Open a command line, e.g. click on the "Terminal"-Symbol.
7bd1d723414d (issue84) Ubuntu Installer: Add installation howto.
Bernhard Reiter <bernhard@intevation.de>
parents: 1040
diff changeset
22 # 3. Change your working directory to where this file is stored.
7bd1d723414d (issue84) Ubuntu Installer: Add installation howto.
Bernhard Reiter <bernhard@intevation.de>
parents: 1040
diff changeset
23 # For example type "cd ~/Desktop" on your command line.
1049
52c68a773194 Ubuntu Installer, short instruction with explicit mention that this example is for one user only.
Bernhard Reiter <bernhard@intevation.de>
parents: 1048
diff changeset
24 # 4. Start the installation on the command line, e.g. for the current user
1133
54a6fa9e44cf Deleted trailing white space.
Sascha Wilde <wilde@intevation.de>
parents: 1132
diff changeset
25 # only by typing something like "bash TrustBridge-1.0.0-i386.sh".
1049
52c68a773194 Ubuntu Installer, short instruction with explicit mention that this example is for one user only.
Bernhard Reiter <bernhard@intevation.de>
parents: 1048
diff changeset
26 # Hint: If you press the tab-key after "Tr" it may complete the filename.
1048
7bd1d723414d (issue84) Ubuntu Installer: Add installation howto.
Bernhard Reiter <bernhard@intevation.de>
parents: 1040
diff changeset
27 #
1133
54a6fa9e44cf Deleted trailing white space.
Sascha Wilde <wilde@intevation.de>
parents: 1132
diff changeset
28 # N.B. We could not have used a .deb package, because the installation must
1048
7bd1d723414d (issue84) Ubuntu Installer: Add installation howto.
Bernhard Reiter <bernhard@intevation.de>
parents: 1040
diff changeset
29 # also work without without adminstrator priviledges.
7bd1d723414d (issue84) Ubuntu Installer: Add installation howto.
Bernhard Reiter <bernhard@intevation.de>
parents: 1040
diff changeset
30 #
7bd1d723414d (issue84) Ubuntu Installer: Add installation howto.
Bernhard Reiter <bernhard@intevation.de>
parents: 1040
diff changeset
31 #
7bd1d723414d (issue84) Ubuntu Installer: Add installation howto.
Bernhard Reiter <bernhard@intevation.de>
parents: 1040
diff changeset
32 # Search the file for 'version()' to find the license information.
707
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
33 set -u
680
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
34
698
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
35 ME=`basename "$0"`
704
480bc550d2ad Better default prefix for local installation.
Sascha Wilde <wilde@intevation.de>
parents: 700
diff changeset
36 DEFAULT_PREFIX="$HOME/TrustBridge"
707
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
37 SYSDEFAULT_PREFIX="/usr/local"
724
d280e2d39d5a Introduced data-directory and fixed config-directory.
Sascha Wilde <wilde@intevation.de>
parents: 723
diff changeset
38 CFGPATH="${XDG_CONFIG_HOME:-$HOME/.config}/BSI"
d280e2d39d5a Introduced data-directory and fixed config-directory.
Sascha Wilde <wilde@intevation.de>
parents: 723
diff changeset
39 DATAPATH="${XDG_DATA_HOME:-$HOME/.local/share}/BSI/TrustBridge"
700
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
40 SYSCFGPATH="/etc/TrustBridge"
727
feaabee15e72 Preliminary implemented SYSDATAPATH.
Sascha Wilde <wilde@intevation.de>
parents: 725
diff changeset
41 # FIXME:
feaabee15e72 Preliminary implemented SYSDATAPATH.
Sascha Wilde <wilde@intevation.de>
parents: 725
diff changeset
42 # Set the real data path for system wide installation once its known.
feaabee15e72 Preliminary implemented SYSDATAPATH.
Sascha Wilde <wilde@intevation.de>
parents: 725
diff changeset
43 SYSDATAPATH="$DATAPATH"
724
d280e2d39d5a Introduced data-directory and fixed config-directory.
Sascha Wilde <wilde@intevation.de>
parents: 723
diff changeset
44 INSTCFGNAME="TrustBridge-inst.cfg"
705
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
45 FORCE=0
707
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
46 SYSINST=0
711
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
47 DEINSTALL=0
1066
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
48 UPDATE=0
711
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
49 BINNAMES="###BINNAMES###"
872
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
50 ICONNAME="###ICONNAME###"
938
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
51 HELPNAMES="###HELPNAMES###"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
52 HELPNAMES_SOURCES="###HELPNAMES_SOURCES###"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
53 HELPNAMES_STATIC="###HELPNAMES_STATIC###"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
54 HELPNAMES_IMG="###HELPNAMES_IMG###"
972
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
55 ARCH="###ARCH###"
698
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
56
705
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
57 declare -A instcfg oldinstcfg
724
d280e2d39d5a Introduced data-directory and fixed config-directory.
Sascha Wilde <wilde@intevation.de>
parents: 723
diff changeset
58 declare inst_default_prefix instdata_path instcfg_path instcfg_file
700
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
59 instcfg=(
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
60 [TIMESTMP]=`date -u +%Y%m%d%H%M%S`
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
61 [VERSION]='@PROJECT_VERSION@'
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
62 [PREFIX]=''
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
63 )
705
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
64 oldinstcfg=(
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
65 [TIMESTMP]=''
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
66 [VERSION]=''
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
67 [PREFIX]=''
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
68 )
698
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
69
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
70 declare -A L10N_DE
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
71 ###L10N_DE###
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
72
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
73 getxt()
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
74 {
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
75 # Poor mans gettext for l10n completely self contained in one shell
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
76 # script.
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
77 MSGID="$1"
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
78 shift
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
79 case ${LANGUAGE:-${LC_ALL:-${LC_MESSAGES:-$LANG}}} in
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
80 de*)
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
81 if [ "${L10N_DE[$MSGID]}" ] ; then
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
82 MSG="${L10N_DE[$MSGID]}"
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
83 else
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
84 MSG="$MSGID"
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
85 fi
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
86 ;;
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
87 *)
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
88 MSG="$MSGID"
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
89 ;;
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
90 esac
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
91
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
92 printf "$MSG" "$@"
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
93 }
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
94
698
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
95 version()
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
96 {
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
97 cat <<EOF
700
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
98 TrustBridge ${instcfg[VERSION]} Installer
698
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
99
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
100 Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
101 Software engineering by Intevation GmbH
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
102
1038
f5306f8c02f3 packaging/linux-installer: Copyright header changed to standard text.
Bernhard Reiter <bernhard@intevation.de>
parents: 972
diff changeset
103 This file is Free Software under the GNU GPL (v>=2)
f5306f8c02f3 packaging/linux-installer: Copyright header changed to standard text.
Bernhard Reiter <bernhard@intevation.de>
parents: 972
diff changeset
104 and comes with ABSOLUTELY NO WARRANTY!
f5306f8c02f3 packaging/linux-installer: Copyright header changed to standard text.
Bernhard Reiter <bernhard@intevation.de>
parents: 972
diff changeset
105 See LICENSE.txt for details.
698
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
106 EOF
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
107 exit 0
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
108 }
680
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
109
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
110 fatal()
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
111 {
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
112 getxt "$1" >&2
711
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
113 if [ $DEINSTALL -eq 1 ] ; then
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
114 getxt "Deinstallation failed.\n" >&2
711
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
115 else
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
116 getxt "Installation failed.\n" >&2
711
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
117 fi
680
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
118 exit 1
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
119 }
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
120
698
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
121 usage()
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
122 {
799
933860224d1e l10n for usage text.
Sascha Wilde <wilde@intevation.de>
parents: 795
diff changeset
123 getxt "Usage: %s [OPTION]...\n" "$ME"
933860224d1e l10n for usage text.
Sascha Wilde <wilde@intevation.de>
parents: 795
diff changeset
124 getxt "Install TrustBridge.\n\n"
933860224d1e l10n for usage text.
Sascha Wilde <wilde@intevation.de>
parents: 795
diff changeset
125 getxt "Options:\n"
933860224d1e l10n for usage text.
Sascha Wilde <wilde@intevation.de>
parents: 795
diff changeset
126 getxt " -p, --prefix=PATH install files in PATH\n"
933860224d1e l10n for usage text.
Sascha Wilde <wilde@intevation.de>
parents: 795
diff changeset
127 getxt " -f, --force install to given prefix, even when a current\n"
933860224d1e l10n for usage text.
Sascha Wilde <wilde@intevation.de>
parents: 795
diff changeset
128 getxt " installation with different prefix exists.\n"
933860224d1e l10n for usage text.
Sascha Wilde <wilde@intevation.de>
parents: 795
diff changeset
129 getxt " -d, --deinstall deinstall files from current installation\n"
933860224d1e l10n for usage text.
Sascha Wilde <wilde@intevation.de>
parents: 795
diff changeset
130 getxt " -s, --system create a system wide (de)installation\n"
933860224d1e l10n for usage text.
Sascha Wilde <wilde@intevation.de>
parents: 795
diff changeset
131 getxt " --help display this help and exit\n"
933860224d1e l10n for usage text.
Sascha Wilde <wilde@intevation.de>
parents: 795
diff changeset
132 getxt " --version output version information and exit\n"
698
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
133 exit $1
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
134 }
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
135
711
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
136 yorn()
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
137 {
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
138 local c
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
139 while true ; do
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
140 read -n 1 c
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
141 echo
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
142 case "$c" in
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
143 y|Y|j|J)
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
144 return 0
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
145 ;;
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
146 n|N)
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
147 return 1
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
148 ;;
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
149 *)
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
150 getxt >&2 "Answer [Y]es or [N]o:\n"
711
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
151 esac
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
152 done
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
153 }
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
154
698
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
155 parse_args()
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
156 {
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
157 OPTS=`getopt \
1066
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
158 -l deinstall,update,show-after-update,force,help,prefix:,system,version \
711
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
159 -o d,f,p:,s -n "$ME" -- "$@"`
698
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
160 [ $? -eq 0 ] || usage 23
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
161
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
162 eval set -- "$OPTS"
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
163
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
164 while true ; do
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
165 case "$1" in
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
166 --prefix|-p)
700
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
167 instcfg[PREFIX]="$2"
698
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
168 shift 2
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
169 ;;
707
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
170 --system|-s)
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
171 SYSINST=1
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
172 shift 1
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
173 ;;
705
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
174 --force|-f)
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
175 FORCE=1
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
176 shift 1
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
177 ;;
711
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
178 --deinstall|-d)
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
179 DEINSTALL=1
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
180 shift 1
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
181 ;;
1066
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
182 --update)
1136
e82c440c2727 Add small comment about update option.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1134
diff changeset
183 # Update is an internal option that is used when the application calls
e82c440c2727 Add small comment about update option.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1134
diff changeset
184 # the installer to install an update.
1066
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
185 UPDATE=1
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
186 shift 1
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
187 ;;
698
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
188 --help)
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
189 usage 0
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
190 ;;
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
191 --version)
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
192 version
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
193 ;;
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
194 --)
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
195 shift
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
196 break
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
197 ;;
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
198 esac
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
199 done
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
200 }
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
201
707
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
202 init_vars()
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
203 {
1066
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
204 if [ -n "${SUDO_USER-}" ] ; then
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
205 # Default to system wide installation when running with sudo
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
206 SYSINST=1
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
207 fi
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
208
707
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
209 if [ $SYSINST -eq 1 ] ; then
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
210 inst_default_prefix="$SYSDEFAULT_PREFIX"
723
e71c59b16eee Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 711
diff changeset
211 instcfg_path="${SYSCFGPATH}"
727
feaabee15e72 Preliminary implemented SYSDATAPATH.
Sascha Wilde <wilde@intevation.de>
parents: 725
diff changeset
212 instdata_path="${SYSDATAPATH}"
785
2fb539d4b1ff Simply autostart creation by initializing the path in init_vars
Andre Heinecke <andre.heinecke@intevation.de>
parents: 777
diff changeset
213 autostart_path="$(getent passwd "${SUDO_USER}" | cut -d ':' -f 6)/.config/autostart"
872
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
214 startmenu_path="/usr/share/applications"
707
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
215 else
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
216 inst_default_prefix="$DEFAULT_PREFIX"
723
e71c59b16eee Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 711
diff changeset
217 instcfg_path="${CFGPATH}"
724
d280e2d39d5a Introduced data-directory and fixed config-directory.
Sascha Wilde <wilde@intevation.de>
parents: 723
diff changeset
218 instdata_path="${DATAPATH}"
785
2fb539d4b1ff Simply autostart creation by initializing the path in init_vars
Andre Heinecke <andre.heinecke@intevation.de>
parents: 777
diff changeset
219 autostart_path=${XDG_CONFIG_HOME:-~/.config/autostart}
872
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
220 startmenu_path=${XDG_DATA_HOME:-~/.local/share/applications}
1040
43734932e2ea (issue100) Fall back to system wide deinstallation when no local installation is found
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1038
diff changeset
221 if [ $DEINSTALL -eq 1 ] ; then
43734932e2ea (issue100) Fall back to system wide deinstallation when no local installation is found
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1038
diff changeset
222 if [ ! -r ${instcfg_path}/${INSTCFGNAME} ]; then
43734932e2ea (issue100) Fall back to system wide deinstallation when no local installation is found
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1038
diff changeset
223 if [ -r ${SYSCFGPATH}/${INSTCFGNAME} ]; then
43734932e2ea (issue100) Fall back to system wide deinstallation when no local installation is found
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1038
diff changeset
224 # Fall back to system uninstallation if no user config found
43734932e2ea (issue100) Fall back to system wide deinstallation when no local installation is found
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1038
diff changeset
225 SYSINST=1
43734932e2ea (issue100) Fall back to system wide deinstallation when no local installation is found
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1038
diff changeset
226 init_vars
43734932e2ea (issue100) Fall back to system wide deinstallation when no local installation is found
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1038
diff changeset
227 check_priv
43734932e2ea (issue100) Fall back to system wide deinstallation when no local installation is found
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1038
diff changeset
228 fi
43734932e2ea (issue100) Fall back to system wide deinstallation when no local installation is found
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1038
diff changeset
229 fi
43734932e2ea (issue100) Fall back to system wide deinstallation when no local installation is found
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1038
diff changeset
230 fi
707
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
231 fi
873
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
232 instcfg_file="${instcfg_path}/${INSTCFGNAME}"
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
233 extra_bin_path=`mktemp --tmpdir -d tmpbin.XXXXXXXXXX`
972
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
234 HOST_ARCH=$(uname -m)
873
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
235 }
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
236
1066
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
237 finished()
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
238 {
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
239 echo
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
240 echo "#################################################################################"
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
241 if [ $SYSINST -eq 1 ]; then
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
242 getxt "System wide installation successful.\n"
1075
7e1fd6d96714 (issue109) Feedback improved. Shell translation updated.
Bernhard Reiter <bernhard@intevation.de>
parents: 1069
diff changeset
243 RUNCMD="su -l $SUDO_USER -c "
1066
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
244 else
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
245 getxt "Single user installation successful.\n"
1075
7e1fd6d96714 (issue109) Feedback improved. Shell translation updated.
Bernhard Reiter <bernhard@intevation.de>
parents: 1069
diff changeset
246 RUNCMD=""
1066
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
247 fi
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
248 getxt "TrustBridge has been installed to: '%s'\n\n" "${instcfg[PREFIX]}"
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
249
1112
d619507d9e9f linux-installer: (issue109) Text slightly improved.
Bernhard Reiter <bernhard@intevation.de>
parents: 1075
diff changeset
250 getxt "To remove the application and the root certificates it has inserted,\n"
d619507d9e9f linux-installer: (issue109) Text slightly improved.
Bernhard Reiter <bernhard@intevation.de>
parents: 1075
diff changeset
251 getxt "call the deinstall command:\n"
1075
7e1fd6d96714 (issue109) Feedback improved. Shell translation updated.
Bernhard Reiter <bernhard@intevation.de>
parents: 1069
diff changeset
252 echo " $RUNCMD ${instcfg[PREFIX]}/bin/trustbridge-deinstall-TODO.sh"
7e1fd6d96714 (issue109) Feedback improved. Shell translation updated.
Bernhard Reiter <bernhard@intevation.de>
parents: 1069
diff changeset
253
1066
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
254 echo "#################################################################################"
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
255 getxt "Press enter to launch '%s'\n" "${instcfg[PREFIX]}/bin/trustbridge"
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
256 if [ $UPDATE -eq 0 ]; then
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
257 read
1068
4e93a87d89eb (issue54) use su to launch application as user after system wide installation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1066
diff changeset
258 $RUNCMD "${instcfg[PREFIX]}/bin/trustbridge" &
1066
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
259 else
1123
425a9a861d17 (issue54) Remove showafterupdate option from linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1112
diff changeset
260 $RUNCMD "${instcfg[PREFIX]}/bin/trustbridge" --tray &
1066
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
261 fi
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
262 }
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
263
873
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
264 cleanup()
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
265 {
935
e977f7a0e8fd Cleanup temporary stuff (like shar lockdir) always (even when interrupted) on exit.
Sascha Wilde <wilde@intevation.de>
parents: 916
diff changeset
266 getxt "Cleaning up temporary stuff ...\n"
1132
db43c9a62935 Fixed cleanup of temporary directories.
Sascha Wilde <wilde@intevation.de>
parents: 1112
diff changeset
267
db43c9a62935 Fixed cleanup of temporary directories.
Sascha Wilde <wilde@intevation.de>
parents: 1112
diff changeset
268 # remove temporary directories:
db43c9a62935 Fixed cleanup of temporary directories.
Sascha Wilde <wilde@intevation.de>
parents: 1112
diff changeset
269 local -a temp_dirs
db43c9a62935 Fixed cleanup of temporary directories.
Sascha Wilde <wilde@intevation.de>
parents: 1112
diff changeset
270 if [ "${lock_dir}" ]; then
db43c9a62935 Fixed cleanup of temporary directories.
Sascha Wilde <wilde@intevation.de>
parents: 1112
diff changeset
271 # $lock_dir is generate by the shar
db43c9a62935 Fixed cleanup of temporary directories.
Sascha Wilde <wilde@intevation.de>
parents: 1112
diff changeset
272 temp_dirs+=("${instcfg[PREFIX]}/$lock_dir")
937
f6b52f60f643 Check if lock_dir is set before using it in an rm -rf
Andre Heinecke <andre.heinecke@intevation.de>
parents: 935
diff changeset
273 fi
1132
db43c9a62935 Fixed cleanup of temporary directories.
Sascha Wilde <wilde@intevation.de>
parents: 1112
diff changeset
274 temp_dirs+=("$extra_bin_path")
1133
54a6fa9e44cf Deleted trailing white space.
Sascha Wilde <wilde@intevation.de>
parents: 1132
diff changeset
275
1132
db43c9a62935 Fixed cleanup of temporary directories.
Sascha Wilde <wilde@intevation.de>
parents: 1112
diff changeset
276 for dir in "${temp_dirs[@]}" ; do
935
e977f7a0e8fd Cleanup temporary stuff (like shar lockdir) always (even when interrupted) on exit.
Sascha Wilde <wilde@intevation.de>
parents: 916
diff changeset
277 [ -d "$dir" ] &&
e977f7a0e8fd Cleanup temporary stuff (like shar lockdir) always (even when interrupted) on exit.
Sascha Wilde <wilde@intevation.de>
parents: 916
diff changeset
278 rm -rf "$dir"
e977f7a0e8fd Cleanup temporary stuff (like shar lockdir) always (even when interrupted) on exit.
Sascha Wilde <wilde@intevation.de>
parents: 916
diff changeset
279 done
707
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
280 }
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
281
700
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
282 write_instcfg()
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
283 {
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
284 install -d `dirname "$instcfg_file"`
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
285 echo "# Created by TrustBridge-Installer, don't touch!" >"$instcfg_file"
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
286 for key in "${!instcfg[@]}" ; do
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
287 echo "${key}=${instcfg[$key]}" >>"$instcfg_file"
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
288 done
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
289 }
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
290
705
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
291 read_oldinstcfg()
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
292 {
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
293 if [ -r "$instcfg_file" ] ; then
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
294 getxt "Reading '%s' ...\n" "$instcfg_file"
705
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
295 for key in "${!oldinstcfg[@]}" ; do
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
296 oldinstcfg[$key]=`sed -n "/$key/s/[^=]*=\(.*\)/\1/p" "$instcfg_file"`
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
297 done
707
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
298 fi
705
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
299 }
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
300
707
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
301 check_priv()
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
302 {
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
303 if [ $SYSINST -eq 1 -a "$UID" -ne 0 ] ; then
1040
43734932e2ea (issue100) Fall back to system wide deinstallation when no local installation is found
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1038
diff changeset
304 fatal "System wide installation or deinstallation requires root privileges!\n"
707
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
305 fi
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
306 }
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
307
728
2d64ff7e22e8 Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents: 727
diff changeset
308 rm_empty_dirs()
2d64ff7e22e8 Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents: 727
diff changeset
309 {
2d64ff7e22e8 Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents: 727
diff changeset
310 # Args: $1 - DIRECTORY
2d64ff7e22e8 Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents: 727
diff changeset
311 #
2d64ff7e22e8 Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents: 727
diff changeset
312 # Recursively remove DIRECTORY and all it _parent_ directories as
2d64ff7e22e8 Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents: 727
diff changeset
313 # long as they are empty.
2d64ff7e22e8 Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents: 727
diff changeset
314 local directory="$1"
752
96cac71834ba Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 751
diff changeset
315 while [ -d "$directory" -a -z "$(ls 2>/dev/null -A "$directory")" ] ; do
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
316 getxt "Deleting empty directory '%s' ...\n" "$directory"
728
2d64ff7e22e8 Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents: 727
diff changeset
317 rmdir "$directory"
2d64ff7e22e8 Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents: 727
diff changeset
318 directory=`dirname "$directory"`
2d64ff7e22e8 Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents: 727
diff changeset
319 done
2d64ff7e22e8 Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents: 727
diff changeset
320 }
2d64ff7e22e8 Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents: 727
diff changeset
321
752
96cac71834ba Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 751
diff changeset
322 rm_files()
96cac71834ba Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 751
diff changeset
323 {
96cac71834ba Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 751
diff changeset
324 for file in "$@" ; do
96cac71834ba Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 751
diff changeset
325 if [ -e "$file" ] ; then
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
326 getxt "Deleting '%s' ...\n" "$file"
752
96cac71834ba Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 751
diff changeset
327 rm "$file"
96cac71834ba Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 751
diff changeset
328 fi
96cac71834ba Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 751
diff changeset
329 done
96cac71834ba Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 751
diff changeset
330 }
96cac71834ba Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 751
diff changeset
331
749
778382342802 Added installation of cron job.
Sascha Wilde <wilde@intevation.de>
parents: 738
diff changeset
332 setup_cronjob()
778382342802 Added installation of cron job.
Sascha Wilde <wilde@intevation.de>
parents: 738
diff changeset
333 {
778382342802 Added installation of cron job.
Sascha Wilde <wilde@intevation.de>
parents: 738
diff changeset
334 local tmpcrontab=`mktemp`
765
7c3a8a8d3e52 Code cleanup: make variable initialization more obvious.
Sascha Wilde <wilde@intevation.de>
parents: 764
diff changeset
335
764
5b505acbb2d1 Handle system wide installation for crontab.
Sascha Wilde <wilde@intevation.de>
parents: 763
diff changeset
336 if [ $SYSINST -eq 1 -a "${SUDO_USER+X}" ] ; then
765
7c3a8a8d3e52 Code cleanup: make variable initialization more obvious.
Sascha Wilde <wilde@intevation.de>
parents: 764
diff changeset
337 local crontabopt="-u $SUDO_USER"
7c3a8a8d3e52 Code cleanup: make variable initialization more obvious.
Sascha Wilde <wilde@intevation.de>
parents: 764
diff changeset
338 else
7c3a8a8d3e52 Code cleanup: make variable initialization more obvious.
Sascha Wilde <wilde@intevation.de>
parents: 764
diff changeset
339 local crontabopt=''
764
5b505acbb2d1 Handle system wide installation for crontab.
Sascha Wilde <wilde@intevation.de>
parents: 763
diff changeset
340 fi
765
7c3a8a8d3e52 Code cleanup: make variable initialization more obvious.
Sascha Wilde <wilde@intevation.de>
parents: 764
diff changeset
341
766
9f0ad4bab175 Fixed crontab setup for system wide (de)installation.
Sascha Wilde <wilde@intevation.de>
parents: 765
diff changeset
342 if [ "$1" != "deinstall" ] ; then
9f0ad4bab175 Fixed crontab setup for system wide (de)installation.
Sascha Wilde <wilde@intevation.de>
parents: 765
diff changeset
343 local trustbridge_tray_starter="${instcfg[PREFIX]}/bin/trustbridge-tray-starter.sh"
9f0ad4bab175 Fixed crontab setup for system wide (de)installation.
Sascha Wilde <wilde@intevation.de>
parents: 765
diff changeset
344 else
9f0ad4bab175 Fixed crontab setup for system wide (de)installation.
Sascha Wilde <wilde@intevation.de>
parents: 765
diff changeset
345 local trustbridge_tray_starter="${oldinstcfg[PREFIX]}/bin/trustbridge-tray-starter.sh"
9f0ad4bab175 Fixed crontab setup for system wide (de)installation.
Sascha Wilde <wilde@intevation.de>
parents: 765
diff changeset
346 fi
9f0ad4bab175 Fixed crontab setup for system wide (de)installation.
Sascha Wilde <wilde@intevation.de>
parents: 765
diff changeset
347
764
5b505acbb2d1 Handle system wide installation for crontab.
Sascha Wilde <wilde@intevation.de>
parents: 763
diff changeset
348 crontab $crontabopt -l | \
766
9f0ad4bab175 Fixed crontab setup for system wide (de)installation.
Sascha Wilde <wilde@intevation.de>
parents: 765
diff changeset
349 grep -vF "$trustbridge_tray_starter" \
764
5b505acbb2d1 Handle system wide installation for crontab.
Sascha Wilde <wilde@intevation.de>
parents: 763
diff changeset
350 >"$tmpcrontab"
750
27dd0012288a Remove cron job on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 749
diff changeset
351 if [ "$1" != "deinstall" ] ; then
766
9f0ad4bab175 Fixed crontab setup for system wide (de)installation.
Sascha Wilde <wilde@intevation.de>
parents: 765
diff changeset
352 echo "$(( $RANDOM / 555 )) 12 * * * \"$trustbridge_tray_starter\"" \
750
27dd0012288a Remove cron job on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 749
diff changeset
353 >>"$tmpcrontab"
27dd0012288a Remove cron job on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 749
diff changeset
354 fi
764
5b505acbb2d1 Handle system wide installation for crontab.
Sascha Wilde <wilde@intevation.de>
parents: 763
diff changeset
355 crontab $crontabopt "$tmpcrontab"
749
778382342802 Added installation of cron job.
Sascha Wilde <wilde@intevation.de>
parents: 738
diff changeset
356 rm "$tmpcrontab"
778382342802 Added installation of cron job.
Sascha Wilde <wilde@intevation.de>
parents: 738
diff changeset
357 }
778382342802 Added installation of cron job.
Sascha Wilde <wilde@intevation.de>
parents: 738
diff changeset
358
750
27dd0012288a Remove cron job on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 749
diff changeset
359 remove_cronjob()
27dd0012288a Remove cron job on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 749
diff changeset
360 {
27dd0012288a Remove cron job on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 749
diff changeset
361 setup_cronjob deinstall
27dd0012288a Remove cron job on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 749
diff changeset
362 }
27dd0012288a Remove cron job on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 749
diff changeset
363
723
e71c59b16eee Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 711
diff changeset
364 deinstall_certs()
e71c59b16eee Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 711
diff changeset
365 {
e71c59b16eee Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 711
diff changeset
366 local cinst="${oldinstcfg[PREFIX]}/bin/cinst"
858
4dfb6f543a05 Only uninstall a list if it has been installed
Andre Heinecke <andre.heinecke@intevation.de>
parents: 854
diff changeset
367 local certlist=`ls 2>/dev/null -1 ${instdata_path}/list-installed.txt`
723
e71c59b16eee Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 711
diff changeset
368
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
369 getxt "Uninstalling certificates ...\n"
728
2d64ff7e22e8 Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents: 727
diff changeset
370
723
e71c59b16eee Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 711
diff changeset
371 if [ "$certlist" ] ; then
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
372 getxt "Using certificate list '%s'.\n" "$certlist"
725
ce3e33e66a17 Fixed cert deinstallation for prefix-paths containing space.
Sascha Wilde <wilde@intevation.de>
parents: 724
diff changeset
373 if [ -x "$cinst" ] ; then
723
e71c59b16eee Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 711
diff changeset
374 "$cinst" "list=$certlist" "choices=uninstall"
e71c59b16eee Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 711
diff changeset
375 else
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
376 getxt >&2 "WARNING: can't execute %s for certificate deinstallation.\n" "$cinst"
723
e71c59b16eee Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 711
diff changeset
377 fi
e71c59b16eee Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 711
diff changeset
378 else
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
379 getxt "No certificate list found. Nothing to do.\n"
723
e71c59b16eee Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 711
diff changeset
380 fi
e71c59b16eee Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 711
diff changeset
381 }
e71c59b16eee Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 711
diff changeset
382
729
efc2d16ab514 Remove (more) data files and directories.
Sascha Wilde <wilde@intevation.de>
parents: 728
diff changeset
383 deinstall_etc()
efc2d16ab514 Remove (more) data files and directories.
Sascha Wilde <wilde@intevation.de>
parents: 728
diff changeset
384 {
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
385 getxt "Removing cron job ...\n"
750
27dd0012288a Remove cron job on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 749
diff changeset
386 remove_cronjob
27dd0012288a Remove cron job on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 749
diff changeset
387
729
efc2d16ab514 Remove (more) data files and directories.
Sascha Wilde <wilde@intevation.de>
parents: 728
diff changeset
388 # FIXME: delete all files created by the application.
751
d8c8e14b9953 Remove trustbridge-tray-starter configuration on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 750
diff changeset
389 local tbcfg_files=( "${instcfg_path}/TrustBridge.ini"
d8c8e14b9953 Remove trustbridge-tray-starter configuration on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 750
diff changeset
390 "${instcfg_path}/trustbridge-tray-starter.cfg"
d8c8e14b9953 Remove trustbridge-tray-starter configuration on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 750
diff changeset
391 "$instcfg_file" )
752
96cac71834ba Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 751
diff changeset
392
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
393 getxt "Removing certificate lists from: %s:\n" "$instdata_path"
752
96cac71834ba Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 751
diff changeset
394 rm_files "$instdata_path"/list-*.txt
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
395
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
396 getxt "Removing PID file from: %s:\n" "$instdata_path"
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
397 rm_files "$instdata_path"/*.pid
729
efc2d16ab514 Remove (more) data files and directories.
Sascha Wilde <wilde@intevation.de>
parents: 728
diff changeset
398 rm_empty_dirs "$instdata_path"
751
d8c8e14b9953 Remove trustbridge-tray-starter configuration on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 750
diff changeset
399
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
400 getxt "Removing configuration files:\n"
752
96cac71834ba Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 751
diff changeset
401 rm_files "${tbcfg_files[@]}"
729
efc2d16ab514 Remove (more) data files and directories.
Sascha Wilde <wilde@intevation.de>
parents: 728
diff changeset
402 rm_empty_dirs "$instcfg_path"
777
ca149bad8195 (issue51) Set up autostart on installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 776
diff changeset
403
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
404 getxt "Removing TrustBridge from autostart\n"
854
adf7481291a4 Fixed typo in ubuntu desktop file.
Emanuel Schuetze <emanuel@intevation.de>
parents: 799
diff changeset
405 rm_files "${autostart_path}/trustbridge.desktop"
916
1cc9faa572fd (issue53) Update desktop database after desktop file removal
Andre Heinecke <andre.heinecke@intevation.de>
parents: 873
diff changeset
406 update-desktop-database 2>&1 || true
872
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
407
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
408 getxt "Removing TrustBridge from start menu\n"
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
409 rm_files "${startmenu_path}/trustbridge.desktop"
729
efc2d16ab514 Remove (more) data files and directories.
Sascha Wilde <wilde@intevation.de>
parents: 728
diff changeset
410 }
efc2d16ab514 Remove (more) data files and directories.
Sascha Wilde <wilde@intevation.de>
parents: 728
diff changeset
411
711
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
412 deinstall()
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
413 {
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
414 if [ "${oldinstcfg[PREFIX]}" ] ; then
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
415 getxt "Really deinstall TrustBridge from '%s'? [y/n]\n" "${oldinstcfg[PREFIX]}"
711
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
416 yorn || exit 0
723
e71c59b16eee Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents: 711
diff changeset
417 deinstall_certs
711
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
418 local deinstdir="${oldinstcfg[PREFIX]}/bin"
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
419 getxt "Deinstalling from '%s'.\n" "${oldinstcfg[PREFIX]}"
711
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
420 for file in $BINNAMES ; do
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
421 local path="${deinstdir}/$file"
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
422 getxt "Deleting '%s' ...\n" "$path"
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
423 rm "$path" || getxt >&2 "WARNING: Could not delete: '%s'!\n" "$path"
711
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
424 done
728
2d64ff7e22e8 Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents: 727
diff changeset
425 rm_empty_dirs "$deinstdir"
938
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
426
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
427 # images
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
428 deinstdir="${oldinstcfg[PREFIX]}/share/doc/trustbridge/_images"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
429 for file in $HELPNAMES_IMG; do
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
430 local path="${deinstdir}/$file"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
431 if [ -f "$path" ]; then
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
432 getxt "Deleting '%s' ...\n" "$path"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
433 rm "$path" || getxt >&2 "WARNING: Could not delete: '%s'!\n" "$path"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
434 fi
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
435 done
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
436 rm_empty_dirs "$deinstdir"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
437
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
438 # Javascript sources
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
439 deinstdir="${oldinstcfg[PREFIX]}/share/doc/trustbridge/_sources"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
440 for file in $HELPNAMES_SOURCES; do
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
441 local path="${deinstdir}/$file"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
442 if [ -f "$path" ]; then
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
443 getxt "Deleting '%s' ...\n" "$path"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
444 rm "$path" || getxt >&2 "WARNING: Could not delete: '%s'!\n" "$path"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
445 fi
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
446 done
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
447 rm_empty_dirs "$deinstdir"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
448
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
449 # Static files
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
450 deinstdir="${oldinstcfg[PREFIX]}/share/doc/trustbridge/_static"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
451 for file in $HELPNAMES_STATIC; do
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
452 local path="${deinstdir}/$file"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
453 if [ -f "$path" ]; then
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
454 getxt "Deleting '%s' ...\n" "$path"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
455 rm "$path" || getxt >&2 "WARNING: Could not delete: '%s'!\n" "$path"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
456 fi
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
457 done
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
458 rm_empty_dirs "$deinstdir"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
459
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
460 # The actual html
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
461 deinstdir="${oldinstcfg[PREFIX]}/share/doc/trustbridge"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
462 for file in $HELPNAMES; do
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
463 local path="${deinstdir}/$file"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
464 if [ -f "$path" ]; then
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
465 getxt "Deleting '%s' ...\n" "$path"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
466 rm "$path" || getxt >&2 "WARNING: Could not delete: '%s'!\n" "$path"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
467 fi
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
468 done
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 937
diff changeset
469 rm_empty_dirs "$deinstdir"
872
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
470 deinstdir="${oldinstcfg[PREFIX]}/share/pixmaps/trustbridge"
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
471 getxt "Deinstalling from '%s'.\n" "${oldinstcfg[PREFIX]}"
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
472 for file in $ICONNAME; do
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
473 local path="${deinstdir}/$file"
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
474 getxt "Deleting '%s' ...\n" "$path"
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
475 rm "$path" || getxt >&2 "WARNING: Could not delete: '%s'!\n" "$path"
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
476 done
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
477 deinstdir="${oldinstcfg[PREFIX]}/share/pixmaps/trustbridge"
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
478 rm_empty_dirs "$deinstdir"
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
479 deinstdir="${oldinstcfg[PREFIX]}/share/pixmaps"
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
480 rm_empty_dirs "$deinstdir"
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
481 deinstdir="${oldinstcfg[PREFIX]}/share"
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
482 rm_empty_dirs "$deinstdir"
729
efc2d16ab514 Remove (more) data files and directories.
Sascha Wilde <wilde@intevation.de>
parents: 728
diff changeset
483 deinstall_etc
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
484 getxt "Deinstallation finished.\n"
711
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
485 else
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
486 getxt "No current installation found! No harm done.\n"
711
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
487 fi
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
488 }
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
489
777
ca149bad8195 (issue51) Set up autostart on installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 776
diff changeset
490 write_autostart()
ca149bad8195 (issue51) Set up autostart on installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 776
diff changeset
491 {
ca149bad8195 (issue51) Set up autostart on installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 776
diff changeset
492 cat > "$1" << EOF
ca149bad8195 (issue51) Set up autostart on installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 776
diff changeset
493 [Desktop Entry]
ca149bad8195 (issue51) Set up autostart on installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 776
diff changeset
494 Type=Application
ca149bad8195 (issue51) Set up autostart on installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 776
diff changeset
495 Name=TrustBridge
ca149bad8195 (issue51) Set up autostart on installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 776
diff changeset
496 Exec="${instcfg[PREFIX]}/bin/trustbridge" --tray
ca149bad8195 (issue51) Set up autostart on installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 776
diff changeset
497 EOF
ca149bad8195 (issue51) Set up autostart on installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 776
diff changeset
498 chown "${SUDO_USER:-${USER}}" "$1"
ca149bad8195 (issue51) Set up autostart on installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 776
diff changeset
499 chmod 700 "$1"
ca149bad8195 (issue51) Set up autostart on installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 776
diff changeset
500 }
ca149bad8195 (issue51) Set up autostart on installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 776
diff changeset
501
872
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
502 write_startmenu()
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
503 {
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
504 cat > "$1" << EOF
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
505 [Desktop Entry]
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
506 Type=Application
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
507 Name=TrustBridge
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
508 Comment=Install and update trusted root certificates
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
509 Comment[de]=Vertrauenswürdige Wurzelzertifikate installieren und aktualisieren
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
510 Exec=${instcfg[PREFIX]}/bin/trustbridge
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
511 Icon=${instcfg[PREFIX]}/share/pixmaps/trustbridge/trustbridge.png
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
512 Terminal=false
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
513 Categories=Network;Qt;
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
514 StartupNotify=false
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
515 EOF
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
516 }
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
517
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
518 setup_startmenu()
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
519 {
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
520 # Supported desktop environments: Unity, GNOME, XFCE, LXDE, KDE
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
521 # System wide installation with a nonstandard XDG_DATA_HOME is not
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
522 # respected with regards to autostart.
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
523 if [ ! -d "${startmenu_path}" ]; then
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
524 install -d "${startmenu_path}" || \
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
525 fatal "Failed to create startmenu directory: '%s'\n" "$startmenu_path"
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
526 fi
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
527
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
528 write_startmenu "${startmenu_path}/trustbridge.desktop"
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
529 update-desktop-database 2>&1 || true
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
530 }
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
531
777
ca149bad8195 (issue51) Set up autostart on installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 776
diff changeset
532 setup_autostart()
ca149bad8195 (issue51) Set up autostart on installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 776
diff changeset
533 {
ca149bad8195 (issue51) Set up autostart on installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 776
diff changeset
534 # Supported desktop environments: Unity, GNOME, XFCE, LXDE, KDE
785
2fb539d4b1ff Simply autostart creation by initializing the path in init_vars
Andre Heinecke <andre.heinecke@intevation.de>
parents: 777
diff changeset
535 # System wide installation with a nonstandard XDG_CONFIG_HOME or KDEHOME is not
2fb539d4b1ff Simply autostart creation by initializing the path in init_vars
Andre Heinecke <andre.heinecke@intevation.de>
parents: 777
diff changeset
536 # respected with regards to autostart.
2fb539d4b1ff Simply autostart creation by initializing the path in init_vars
Andre Heinecke <andre.heinecke@intevation.de>
parents: 777
diff changeset
537 if [ ! -d "${autostart_path}" ]; then
2fb539d4b1ff Simply autostart creation by initializing the path in init_vars
Andre Heinecke <andre.heinecke@intevation.de>
parents: 777
diff changeset
538 install -d "${autostart_path}" || \
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
539 fatal "Failed to create autostart directory: '%s'\n" "$autostart_path"
785
2fb539d4b1ff Simply autostart creation by initializing the path in init_vars
Andre Heinecke <andre.heinecke@intevation.de>
parents: 777
diff changeset
540 fi
777
ca149bad8195 (issue51) Set up autostart on installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 776
diff changeset
541
854
adf7481291a4 Fixed typo in ubuntu desktop file.
Emanuel Schuetze <emanuel@intevation.de>
parents: 799
diff changeset
542 write_autostart "${autostart_path}/trustbridge.desktop"
777
ca149bad8195 (issue51) Set up autostart on installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 776
diff changeset
543 }
707
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
544
873
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
545 provide_uudecode_maybe()
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
546 {
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
547 # The shar needs uudecode, which might not be installed. If its not
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
548 # available we will provide our own python based implementation.
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
549 if which uudecode >/dev/null 2>&1 ; then
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
550 getxt "Found system uudecode.\n"
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
551 else
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
552 local myuudecode="$extra_bin_path/uudecode"
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
553 cat >"$myuudecode" <<EOF
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
554 #!/usr/bin/python2
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
555 import os
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
556 import sys
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
557 import uu
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
558 os.path.chmod = os.chmod
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
559 def rm_if_exists(file):
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
560 try:
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
561 os.remove(file)
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
562 except OSError:
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
563 pass
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
564 os.path.exists = rm_if_exists
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
565 if len(sys.argv) > 1:
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
566 f = open(sys.argv[1], 'r')
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
567 else:
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
568 f = sys.stdin
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
569 uu.decode(f, None, None, 1)
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
570 EOF
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
571 chmod 755 "$myuudecode"
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
572 PATH="${extra_bin_path}:$PATH"
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
573 getxt "Using python uudecode provided by installer.\n"
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
574 fi
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
575 }
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
576
698
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
577 #======================================================================
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
578 # main()
935
e977f7a0e8fd Cleanup temporary stuff (like shar lockdir) always (even when interrupted) on exit.
Sascha Wilde <wilde@intevation.de>
parents: 916
diff changeset
579 trap cleanup EXIT
698
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
580
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
581 parse_args "$@"
1040
43734932e2ea (issue100) Fall back to system wide deinstallation when no local installation is found
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1038
diff changeset
582 check_priv
707
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
583 init_vars
705
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
584 read_oldinstcfg
698
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
585
680
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
586 cat <<EOF
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
587 ------------------------------------------------------------------------
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
588
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
589 TrustBridge - Installer
972
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
590 Version ${instcfg[VERSION]} - ${ARCH} (Testversion)
680
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
591
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
592 ------------------------------------------------------------------------
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
593 EOF
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
594
972
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
595 if [ "$ARCH" == "x86_64" -a "$ARCH" != "$HOST_ARCH" ]; then
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
596 getxt "It appears your system architecture is %s.\n" "$HOST_ARCH"
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
597 getxt "This installer is for 64 bit systems.\n"
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
598 getxt "Really install TrustBridge for '%s' systems? [y/n]\n" "${ARCH}"
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
599 yorn || exit 0
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
600 fi
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
601
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
602 if [ "$ARCH" == "i386" ]; then
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
603 if [[ "$HOST_ARCH" != *86 ]]; then
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
604 getxt "It appears your system architecture is %s.\n" "$HOST_ARCH"
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
605 getxt "This installer is for 32 bit systems.\n"
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
606 getxt "Really install TrustBridge for '%s' systems? [y/n]\n" "${ARCH}"
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
607 yorn || exit 0
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
608 fi
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
609 fi
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
610
711
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
611 if [ $DEINSTALL -eq 1 ] ; then
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
612 deinstall
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
613 # Stop after deinstallation:
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
614 exit 0
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
615 fi
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
616
700
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
617 if [ -z "${instcfg[PREFIX]}" ] ; then
705
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
618
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
619 if [ "${oldinstcfg[PREFIX]}" ] ; then
707
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
620 inst_default_prefix="${oldinstcfg[PREFIX]}"
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
621 getxt "An existing installation (v%s) was detected!\n" "${oldinstcfg[VERSION]}"
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
622 getxt "It is HIGHLY RECOMMENDED to accept the default prefix\n"
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
623 getxt "to update the current installation.\n"
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
624 getxt "For a new prefix you should deinstall first!\n"
705
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
625 fi
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
626 getxt "Select installation prefix for TrustBridge [%s]: " "${inst_default_prefix}"
700
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
627 read -e instcfg[PREFIX]
680
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
628
707
37899f717fa5 Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents: 705
diff changeset
629 [ -z "${instcfg[PREFIX]}" ] && instcfg[PREFIX]="${inst_default_prefix}"
705
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
630 else
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
631 # Prefix was given on invocation:
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
632 if [ "${oldinstcfg[PREFIX]}" -a \
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
633 "${instcfg[PREFIX]}" != "${oldinstcfg[PREFIX]}" -a \
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
634 $FORCE -ne 1 ] ; then
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
635 fatal "Prefix differs from current installation (%s). Aborting!\n" "${oldinstcfg[PREFIX]}"
705
ff2efc1cb8fa Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents: 704
diff changeset
636 fi
698
b55d49150e36 Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents: 682
diff changeset
637 fi
682
578860edde53 Use default path.
Sascha Wilde <wilde@intevation.de>
parents: 680
diff changeset
638
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
639 getxt "Installing to '%s':\n" "${instcfg[PREFIX]}"
680
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
640
700
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
641 if [ ! -d "${instcfg[PREFIX]}" ] ; then
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
642 getxt "creating installation directory ...\n"
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
643 install -d "${instcfg[PREFIX]}" || fatal "Could not create '%s'!\n" "${instcfg[PREFIX]}"
680
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
644 fi
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
645
873
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
646 getxt "checking for uudecode ...\n"
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
647 provide_uudecode_maybe
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
648
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
649 getxt "unpacking files ...\n"
700
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
650 cd "${instcfg[PREFIX]}"
680
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
651
711
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 707
diff changeset
652 set +u
753
7c1f34115ede Force the shar to overwrite existing files.
Sascha Wilde <wilde@intevation.de>
parents: 752
diff changeset
653 set -- '-c'
680
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
654 # ----------------------------------------------------------------------
700
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
655 # regular shar archive inserted here:
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
656 ###SHAR###
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
657 # ----------------------------------------------------------------------
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
658
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
659 getxt "Preparing trustbridge-tray-starter ...\n"
738
ea8d13590cbd Added trustbridge-tray-starter script for use with cron job.
Sascha Wilde <wilde@intevation.de>
parents: 730
diff changeset
660 sed -i "/^PREFIX=/c\PREFIX='${instcfg[PREFIX]}'" \
ea8d13590cbd Added trustbridge-tray-starter script for use with cron job.
Sascha Wilde <wilde@intevation.de>
parents: 730
diff changeset
661 "${instcfg[PREFIX]}/bin/trustbridge-tray-starter.sh"
ea8d13590cbd Added trustbridge-tray-starter script for use with cron job.
Sascha Wilde <wilde@intevation.de>
parents: 730
diff changeset
662
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
663 getxt "Setting up cronjob ...\n"
749
778382342802 Added installation of cron job.
Sascha Wilde <wilde@intevation.de>
parents: 738
diff changeset
664 setup_cronjob
778382342802 Added installation of cron job.
Sascha Wilde <wilde@intevation.de>
parents: 738
diff changeset
665
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
666 getxt "Setting up autostart ...\n"
777
ca149bad8195 (issue51) Set up autostart on installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 776
diff changeset
667 setup_autostart
ca149bad8195 (issue51) Set up autostart on installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 776
diff changeset
668
872
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
669 getxt "Setting up start menu entries ...\n"
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
670 setup_startmenu
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 863
diff changeset
671
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 785
diff changeset
672 getxt "Writing installation configuration to: %s ...\n" "$instcfg_file"
700
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
673 write_instcfg
873
78096ad6f418 Provide own, python based uudecode if none is found in the system.
Sascha Wilde <wilde@intevation.de>
parents: 872
diff changeset
674
1066
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
675 finished
febd195c0301 (issue109) Add summary after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1049
diff changeset
676
935
e977f7a0e8fd Cleanup temporary stuff (like shar lockdir) always (even when interrupted) on exit.
Sascha Wilde <wilde@intevation.de>
parents: 916
diff changeset
677 # cleanup
e977f7a0e8fd Cleanup temporary stuff (like shar lockdir) always (even when interrupted) on exit.
Sascha Wilde <wilde@intevation.de>
parents: 916
diff changeset
678 # is called implicitly at exit via trap...
700
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 698
diff changeset
679 exit 0

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