annotate packaging/linux-installer-common.inc.in @ 1368:41cf49df007d

(issue179) Add signature timestamp in linux installer packages
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 24 Nov 2014 14:04:34 +0100
parents 8c829345ecfa
children
rev   line source
1139
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
1 #-*-sh-*-
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
2 ME=`basename "$0"`
1343
0971c7214e79 (issue160) Change install prefix to include BSI directory
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1249
diff changeset
3 DEFAULT_PREFIX="$HOME/BSI/TrustBridge"
1139
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
4 SYSDEFAULT_PREFIX="/usr/local"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
5 CFGPATH="${XDG_CONFIG_HOME:-$HOME/.config}/BSI"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
6 DATAPATH="${XDG_DATA_HOME:-$HOME/.local/share}/BSI/TrustBridge"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
7 SYSCFGPATH="/etc/TrustBridge"
1166
d824e6890a43 A more informative comment on the SYSDATAPATH fixme.
Sascha Wilde <wilde@intevation.de>
parents: 1150
diff changeset
8 # FIXME: a user independent data path would be nice for system wide
d824e6890a43 A more informative comment on the SYSDATAPATH fixme.
Sascha Wilde <wilde@intevation.de>
parents: 1150
diff changeset
9 # installations, but we wont open this can of worms for now.
d824e6890a43 A more informative comment on the SYSDATAPATH fixme.
Sascha Wilde <wilde@intevation.de>
parents: 1150
diff changeset
10 # So we assume the system wide installation is always used and
d824e6890a43 A more informative comment on the SYSDATAPATH fixme.
Sascha Wilde <wilde@intevation.de>
parents: 1150
diff changeset
11 # maintained by the same user.
1139
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
12 SYSDATAPATH="$DATAPATH"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
13 INSTCFGNAME="TrustBridge-inst.cfg"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
14 FORCE=0
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
15 SYSINST=0
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
16 DEINSTALL=0
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
17 UPDATE=0
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
18 BINNAMES="###BINNAMES###"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
19 ICONNAME="###ICONNAME###"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
20 HELPNAMES="###HELPNAMES###"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
21 HELPNAMES_SOURCES="###HELPNAMES_SOURCES###"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
22 HELPNAMES_STATIC="###HELPNAMES_STATIC###"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
23 HELPNAMES_IMG="###HELPNAMES_IMG###"
1249
014586ef8a84 (issue68) Package licenses
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1197
diff changeset
24 LICENSENAMES="###LICENSES###"
1366
8c829345ecfa (issue179) Write signature date in linux installer and add to test script
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1343
diff changeset
25 SIGNATURE_DATE="###SIGNATURE_DATE###"
1139
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
26 ARCH="###ARCH###"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
27
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
28 declare -A instcfg oldinstcfg
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
29 declare inst_default_prefix instdata_path instcfg_path instcfg_file
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
30 instcfg=(
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
31 [TIMESTMP]=`date -u +%Y%m%d%H%M%S`
1366
8c829345ecfa (issue179) Write signature date in linux installer and add to test script
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1343
diff changeset
32 [SIG_DATE]=$SIGNATURE_DATE
1139
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
33 [VERSION]='@PROJECT_VERSION@'
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
34 [PREFIX]=''
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
35 )
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
36 oldinstcfg=(
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
37 [TIMESTMP]=''
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
38 [VERSION]=''
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
39 [PREFIX]=''
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
40 )
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
41
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
42 declare -A L10N_DE
1149
96ecd345c961 Split up l10n matching the new split up installer files.
Sascha Wilde <wilde@intevation.de>
parents: 1139
diff changeset
43 ###INCLUDE:linux-installer-common.l10n-de
1139
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
44
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
45 getxt()
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
46 {
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
47 # Poor mans gettext for l10n completely self contained in one shell
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
48 # script.
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
49 MSGID="$1"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
50 shift
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
51 case ${LANGUAGE:-${LC_ALL:-${LC_MESSAGES:-$LANG}}} in
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
52 de*)
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
53 if [ "${L10N_DE[$MSGID]}" ] ; then
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
54 MSG="${L10N_DE[$MSGID]}"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
55 else
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
56 MSG="$MSGID"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
57 fi
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
58 ;;
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
59 *)
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
60 MSG="$MSGID"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
61 ;;
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
62 esac
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
63
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
64 printf "$MSG" "$@"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
65 }
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
66
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
67 version()
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
68 {
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
69 cat <<EOF
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
70 TrustBridge ${instcfg[VERSION]} Installer
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
71
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
72 Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
73 Software engineering by Intevation GmbH
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
74
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
75 This file is Free Software under the GNU GPL (v>=2)
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
76 and comes with ABSOLUTELY NO WARRANTY!
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
77 See LICENSE.txt for details.
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
78 EOF
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
79 exit 0
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
80 }
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
81
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
82 fatal()
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
83 {
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
84 getxt "$1" >&2
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
85 if [ $DEINSTALL -eq 1 ] ; then
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
86 getxt "Deinstallation failed.\n" >&2
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
87 else
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
88 getxt "Installation failed.\n" >&2
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
89 fi
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
90 exit 1
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
91 }
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
92
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
93 yorn()
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
94 {
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
95 local c
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
96 while true ; do
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
97 read -n 1 c
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
98 echo
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
99 case "$c" in
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
100 y|Y|j|J)
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
101 return 0
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
102 ;;
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
103 n|N)
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
104 return 1
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
105 ;;
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
106 *)
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
107 getxt >&2 "Answer [Y]es or [N]o:\n"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
108 esac
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
109 done
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
110 }
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
111
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
112 check_priv()
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
113 {
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
114 if [ $SYSINST -eq 1 -a "$UID" -ne 0 ] ; then
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
115 fatal "System wide installation or deinstallation requires root privileges!\n"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
116 fi
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
117 }
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
118
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
119 init_vars()
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
120 {
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
121 if [ -n "${SUDO_USER-}" ] ; then
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
122 # Default to system wide installation when running with sudo
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
123 SYSINST=1
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
124 fi
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
125
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
126 if [ $SYSINST -eq 1 ] ; then
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
127 inst_default_prefix="$SYSDEFAULT_PREFIX"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
128 instcfg_path="${SYSCFGPATH}"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
129 instdata_path="${SYSDATAPATH}"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
130 autostart_path="$(getent passwd "${SUDO_USER}" | cut -d ':' -f 6)/.config/autostart"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
131 startmenu_path="/usr/share/applications"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
132 else
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
133 inst_default_prefix="$DEFAULT_PREFIX"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
134 instcfg_path="${CFGPATH}"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
135 instdata_path="${DATAPATH}"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
136 autostart_path=${XDG_CONFIG_HOME:-~/.config/autostart}
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
137 startmenu_path=${XDG_DATA_HOME:-~/.local/share/applications}
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
138 if [ $DEINSTALL -eq 1 ] ; then
1197
bfe305e09e2d (issue112) Create extra_bin_path also when system wide installing
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1166
diff changeset
139 if [ ! -r ${instcfg_path}/${INSTCFGNAME} ]; then
bfe305e09e2d (issue112) Create extra_bin_path also when system wide installing
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1166
diff changeset
140 if [ -r ${SYSCFGPATH}/${INSTCFGNAME} ]; then
bfe305e09e2d (issue112) Create extra_bin_path also when system wide installing
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1166
diff changeset
141 # Fall back to system uninstallation if no user config found
bfe305e09e2d (issue112) Create extra_bin_path also when system wide installing
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1166
diff changeset
142 SYSINST=1
bfe305e09e2d (issue112) Create extra_bin_path also when system wide installing
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1166
diff changeset
143 init_vars
bfe305e09e2d (issue112) Create extra_bin_path also when system wide installing
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1166
diff changeset
144 check_priv
1139
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
145 fi
1197
bfe305e09e2d (issue112) Create extra_bin_path also when system wide installing
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1166
diff changeset
146 fi
1139
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
147 fi
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
148 fi
1197
bfe305e09e2d (issue112) Create extra_bin_path also when system wide installing
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1166
diff changeset
149 if [ $DEINSTALL -eq 0 ]; then
bfe305e09e2d (issue112) Create extra_bin_path also when system wide installing
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1166
diff changeset
150 # extra bin path not needed on deinstall:
bfe305e09e2d (issue112) Create extra_bin_path also when system wide installing
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1166
diff changeset
151 extra_bin_path=`mktemp --tmpdir -d tmpbin.XXXXXXXXXX`
bfe305e09e2d (issue112) Create extra_bin_path also when system wide installing
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1166
diff changeset
152 fi
1139
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
153 instcfg_file="${instcfg_path}/${INSTCFGNAME}"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
154 HOST_ARCH=$(uname -m)
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
155 }
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
156
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
157 read_oldinstcfg()
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
158 {
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
159 if [ -r "$instcfg_file" ] ; then
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
160 getxt "Reading '%s' ...\n" "$instcfg_file"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
161 for key in "${!oldinstcfg[@]}" ; do
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
162 oldinstcfg[$key]=`sed -n "/$key/s/[^=]*=\(.*\)/\1/p" "$instcfg_file"`
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
163 done
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
164 fi
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
165 }
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
166
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
167
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
168 setup_cronjob()
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
169 {
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
170 local tmpcrontab=`mktemp`
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
171
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
172 if [ $SYSINST -eq 1 -a "${SUDO_USER+X}" ] ; then
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
173 local crontabopt="-u $SUDO_USER"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
174 else
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
175 local crontabopt=''
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
176 fi
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
177
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
178 if [ "$1" != "deinstall" ] ; then
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
179 local trustbridge_tray_starter="${instcfg[PREFIX]}/bin/trustbridge-tray-starter.sh"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
180 else
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
181 local trustbridge_tray_starter="${oldinstcfg[PREFIX]}/bin/trustbridge-tray-starter.sh"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
182 fi
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
183
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
184 crontab $crontabopt -l | \
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
185 grep -vF "$trustbridge_tray_starter" \
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
186 >"$tmpcrontab"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
187 if [ "$1" != "deinstall" ] ; then
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
188 echo "$(( $RANDOM / 555 )) 12 * * * \"$trustbridge_tray_starter\"" \
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
189 >>"$tmpcrontab"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
190 fi
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
191 crontab $crontabopt "$tmpcrontab"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
192 rm "$tmpcrontab"
1c9001db6ea2 Split up linux installer in to be able to create a uninstaller (TODO).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
193 }

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