Mercurial > trustbridge
annotate packaging/linux-installer.inc.in @ 758:f56c4869aa18
Switch to 3072 bit RSA keys for codesigning as specified.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 07 Jul 2014 18:34:55 +0200 |
parents | 7c1f34115ede |
children | 654a8ca9d5b4 |
rev | line source |
---|---|
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
1 #!/bin/bash |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
2 set -u |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
3 |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
4 ME=`basename "$0"` |
704
480bc550d2ad
Better default prefix for local installation.
Sascha Wilde <wilde@intevation.de>
parents:
700
diff
changeset
|
5 DEFAULT_PREFIX="$HOME/TrustBridge" |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
6 SYSDEFAULT_PREFIX="/usr/local" |
724
d280e2d39d5a
Introduced data-directory and fixed config-directory.
Sascha Wilde <wilde@intevation.de>
parents:
723
diff
changeset
|
7 CFGPATH="${XDG_CONFIG_HOME:-$HOME/.config}/BSI" |
d280e2d39d5a
Introduced data-directory and fixed config-directory.
Sascha Wilde <wilde@intevation.de>
parents:
723
diff
changeset
|
8 DATAPATH="${XDG_DATA_HOME:-$HOME/.local/share}/BSI/TrustBridge" |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
9 SYSCFGPATH="/etc/TrustBridge" |
727
feaabee15e72
Preliminary implemented SYSDATAPATH.
Sascha Wilde <wilde@intevation.de>
parents:
725
diff
changeset
|
10 # FIXME: |
feaabee15e72
Preliminary implemented SYSDATAPATH.
Sascha Wilde <wilde@intevation.de>
parents:
725
diff
changeset
|
11 # 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
|
12 SYSDATAPATH="$DATAPATH" |
724
d280e2d39d5a
Introduced data-directory and fixed config-directory.
Sascha Wilde <wilde@intevation.de>
parents:
723
diff
changeset
|
13 INSTCFGNAME="TrustBridge-inst.cfg" |
705
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
14 FORCE=0 |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
15 SYSINST=0 |
711
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
16 DEINSTALL=0 |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
17 BINNAMES="###BINNAMES###" |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
18 |
705
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
19 declare -A instcfg oldinstcfg |
724
d280e2d39d5a
Introduced data-directory and fixed config-directory.
Sascha Wilde <wilde@intevation.de>
parents:
723
diff
changeset
|
20 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
|
21 instcfg=( |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
22 [TIMESTMP]=`date -u +%Y%m%d%H%M%S` |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
23 [VERSION]='@PROJECT_VERSION@' |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
24 [PREFIX]='' |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
25 ) |
705
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
26 oldinstcfg=( |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
27 [TIMESTMP]='' |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
28 [VERSION]='' |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
29 [PREFIX]='' |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
30 ) |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
31 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
32 version() |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
33 { |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
34 cat <<EOF |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
35 TrustBridge ${instcfg[VERSION]} Installer |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
36 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
37 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
|
38 Software engineering by Intevation GmbH |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
39 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
40 This is free software. You may redistribute copies of it under the terms of |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
41 the GNU GPL (v>=2). See LICENSE.txt for details. |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
42 There is NO WARRANTY, to the extent permitted by law. |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
43 EOF |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
44 exit 0 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
45 } |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
46 |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
47 fatal() |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
48 { |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
49 echo "$1" >&2 |
711
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
50 if [ $DEINSTALL -eq 1 ] ; then |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
51 echo "Deinstallation failed." >&2 |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
52 else |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
53 echo "Installation failed." >&2 |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
54 fi |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
55 exit 1 |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
56 } |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
57 |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
58 usage() |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
59 { |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
60 cat <<EOF |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
61 Usage: $ME [OPTION]... |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
62 Install TrustBridge. |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
63 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
64 Options: |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
65 -p, --prefix=PATH install files in PATH |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
66 -f, --force install to given prefix, even when a current |
705
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
67 installation with different prefix exists. |
711
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
68 -d, --deinstall deinstall files from current installation |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
69 -s, --system=PATH make an system wide (de)installation |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
70 --help display this help and exit |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
71 --version output version information and exit |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
72 EOF |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
73 exit $1 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
74 } |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
75 |
711
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
76 yorn() |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
77 { |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
78 local c |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
79 while true ; do |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
80 read -n 1 c |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
81 echo |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
82 case "$c" in |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
83 y|Y|j|J) |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
84 return 0 |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
85 ;; |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
86 n|N) |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
87 return 1 |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
88 ;; |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
89 *) |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
90 echo >&2 "Answer [Y]es or [N]o: " |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
91 esac |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
92 done |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
93 } |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
94 |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
95 parse_args() |
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 OPTS=`getopt \ |
711
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
98 -l deinstall,force,help,prefix:,system,version \ |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
99 -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
|
100 [ $? -eq 0 ] || usage 23 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
101 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
102 eval set -- "$OPTS" |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
103 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
104 while true ; do |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
105 case "$1" in |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
106 --prefix|-p) |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
107 instcfg[PREFIX]="$2" |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
108 shift 2 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
109 ;; |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
110 --system|-s) |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
111 SYSINST=1 |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
112 shift 1 |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
113 ;; |
705
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
114 --force|-f) |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
115 FORCE=1 |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
116 shift 1 |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
117 ;; |
711
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
118 --deinstall|-d) |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
119 DEINSTALL=1 |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
120 shift 1 |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
121 ;; |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
122 --help) |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
123 usage 0 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
124 ;; |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
125 --version) |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
126 version |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
127 ;; |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
128 --) |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
129 shift |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
130 break |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
131 ;; |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
132 esac |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
133 done |
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 |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
136 init_vars() |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
137 { |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
138 if [ $SYSINST -eq 1 ] ; then |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
139 inst_default_prefix="$SYSDEFAULT_PREFIX" |
723
e71c59b16eee
Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
711
diff
changeset
|
140 instcfg_path="${SYSCFGPATH}" |
727
feaabee15e72
Preliminary implemented SYSDATAPATH.
Sascha Wilde <wilde@intevation.de>
parents:
725
diff
changeset
|
141 instdata_path="${SYSDATAPATH}" |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
142 else |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
143 inst_default_prefix="$DEFAULT_PREFIX" |
723
e71c59b16eee
Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
711
diff
changeset
|
144 instcfg_path="${CFGPATH}" |
724
d280e2d39d5a
Introduced data-directory and fixed config-directory.
Sascha Wilde <wilde@intevation.de>
parents:
723
diff
changeset
|
145 instdata_path="${DATAPATH}" |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
146 fi |
723
e71c59b16eee
Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
711
diff
changeset
|
147 instcfg_file="${instcfg_path}/${INSTCFGNAME}" |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
148 } |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
149 |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
150 write_instcfg() |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
151 { |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
152 install -d `dirname "$instcfg_file"` |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
153 echo "# Created by TrustBridge-Installer, don't touch!" >"$instcfg_file" |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
154 for key in "${!instcfg[@]}" ; do |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
155 echo "${key}=${instcfg[$key]}" >>"$instcfg_file" |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
156 done |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
157 } |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
158 |
705
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
159 read_oldinstcfg() |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
160 { |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
161 if [ -r "$instcfg_file" ] ; then |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
162 echo "Reading '$instcfg_file' ..." |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
163 for key in "${!oldinstcfg[@]}" ; do |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
164 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
|
165 done |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
166 fi |
705
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
167 } |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
168 |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
169 check_priv() |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
170 { |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
171 if [ $SYSINST -eq 1 -a "$UID" -ne 0 ] ; then |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
172 fatal "System wide installation requires root privileges!" |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
173 fi |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
174 } |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
175 |
728
2d64ff7e22e8
Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents:
727
diff
changeset
|
176 rm_empty_dirs() |
2d64ff7e22e8
Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents:
727
diff
changeset
|
177 { |
2d64ff7e22e8
Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents:
727
diff
changeset
|
178 # Args: $1 - DIRECTORY |
2d64ff7e22e8
Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents:
727
diff
changeset
|
179 # |
2d64ff7e22e8
Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents:
727
diff
changeset
|
180 # 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
|
181 # long as they are empty. |
2d64ff7e22e8
Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents:
727
diff
changeset
|
182 local directory="$1" |
752
96cac71834ba
Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
751
diff
changeset
|
183 while [ -d "$directory" -a -z "$(ls 2>/dev/null -A "$directory")" ] ; do |
728
2d64ff7e22e8
Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents:
727
diff
changeset
|
184 echo "Deleting empty directory '$directory' ..." |
2d64ff7e22e8
Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents:
727
diff
changeset
|
185 rmdir "$directory" |
2d64ff7e22e8
Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents:
727
diff
changeset
|
186 directory=`dirname "$directory"` |
2d64ff7e22e8
Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents:
727
diff
changeset
|
187 done |
2d64ff7e22e8
Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents:
727
diff
changeset
|
188 } |
2d64ff7e22e8
Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents:
727
diff
changeset
|
189 |
752
96cac71834ba
Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
751
diff
changeset
|
190 rm_files() |
96cac71834ba
Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
751
diff
changeset
|
191 { |
96cac71834ba
Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
751
diff
changeset
|
192 for file in "$@" ; do |
96cac71834ba
Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
751
diff
changeset
|
193 if [ -e "$file" ] ; then |
96cac71834ba
Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
751
diff
changeset
|
194 echo "Deleting $file ..." |
96cac71834ba
Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
751
diff
changeset
|
195 rm "$file" |
96cac71834ba
Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
751
diff
changeset
|
196 fi |
96cac71834ba
Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
751
diff
changeset
|
197 done |
96cac71834ba
Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
751
diff
changeset
|
198 } |
96cac71834ba
Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
751
diff
changeset
|
199 |
749
778382342802
Added installation of cron job.
Sascha Wilde <wilde@intevation.de>
parents:
738
diff
changeset
|
200 setup_cronjob() |
778382342802
Added installation of cron job.
Sascha Wilde <wilde@intevation.de>
parents:
738
diff
changeset
|
201 { |
778382342802
Added installation of cron job.
Sascha Wilde <wilde@intevation.de>
parents:
738
diff
changeset
|
202 # FIXME: handle case of system wide installation. |
778382342802
Added installation of cron job.
Sascha Wilde <wilde@intevation.de>
parents:
738
diff
changeset
|
203 local tmpcrontab=`mktemp` |
778382342802
Added installation of cron job.
Sascha Wilde <wilde@intevation.de>
parents:
738
diff
changeset
|
204 crontab -l | grep -vF "${instcfg[PREFIX]}/bin/trustbridge-tray-starter.sh" \ |
778382342802
Added installation of cron job.
Sascha Wilde <wilde@intevation.de>
parents:
738
diff
changeset
|
205 >"$tmpcrontab" |
750
27dd0012288a
Remove cron job on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
749
diff
changeset
|
206 if [ "$1" != "deinstall" ] ; then |
27dd0012288a
Remove cron job on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
749
diff
changeset
|
207 echo "$(( $RANDOM / 555 )) 12 * * * \"${instcfg[PREFIX]}/bin/trustbridge-tray-starter.sh\"" \ |
27dd0012288a
Remove cron job on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
749
diff
changeset
|
208 >>"$tmpcrontab" |
27dd0012288a
Remove cron job on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
749
diff
changeset
|
209 fi |
749
778382342802
Added installation of cron job.
Sascha Wilde <wilde@intevation.de>
parents:
738
diff
changeset
|
210 crontab "$tmpcrontab" |
778382342802
Added installation of cron job.
Sascha Wilde <wilde@intevation.de>
parents:
738
diff
changeset
|
211 rm "$tmpcrontab" |
778382342802
Added installation of cron job.
Sascha Wilde <wilde@intevation.de>
parents:
738
diff
changeset
|
212 } |
778382342802
Added installation of cron job.
Sascha Wilde <wilde@intevation.de>
parents:
738
diff
changeset
|
213 |
750
27dd0012288a
Remove cron job on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
749
diff
changeset
|
214 remove_cronjob() |
27dd0012288a
Remove cron job on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
749
diff
changeset
|
215 { |
27dd0012288a
Remove cron job on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
749
diff
changeset
|
216 setup_cronjob deinstall |
27dd0012288a
Remove cron job on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
749
diff
changeset
|
217 } |
27dd0012288a
Remove cron job on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
749
diff
changeset
|
218 |
723
e71c59b16eee
Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
711
diff
changeset
|
219 deinstall_certs() |
e71c59b16eee
Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
711
diff
changeset
|
220 { |
e71c59b16eee
Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
711
diff
changeset
|
221 local cinst="${oldinstcfg[PREFIX]}/bin/cinst" |
752
96cac71834ba
Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
751
diff
changeset
|
222 local certlist=`ls 2>/dev/null -1 ${instdata_path}/list-*.txt | sort -nr | head -n 1` |
723
e71c59b16eee
Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
711
diff
changeset
|
223 |
e71c59b16eee
Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
711
diff
changeset
|
224 echo "Uninstalling certificates ..." |
728
2d64ff7e22e8
Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents:
727
diff
changeset
|
225 |
723
e71c59b16eee
Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
711
diff
changeset
|
226 if [ "$certlist" ] ; then |
e71c59b16eee
Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
711
diff
changeset
|
227 echo "Using certificate list '$certlist'." |
725
ce3e33e66a17
Fixed cert deinstallation for prefix-paths containing space.
Sascha Wilde <wilde@intevation.de>
parents:
724
diff
changeset
|
228 if [ -x "$cinst" ] ; then |
723
e71c59b16eee
Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
711
diff
changeset
|
229 "$cinst" "list=$certlist" "choices=uninstall" |
e71c59b16eee
Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
711
diff
changeset
|
230 else |
e71c59b16eee
Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
711
diff
changeset
|
231 echo >&2 "WARNING: can't execute $cinst for certificate deinstallation." |
e71c59b16eee
Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
711
diff
changeset
|
232 fi |
e71c59b16eee
Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
711
diff
changeset
|
233 else |
e71c59b16eee
Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
711
diff
changeset
|
234 echo "No certificate list found. Nothing to do." |
e71c59b16eee
Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
711
diff
changeset
|
235 fi |
e71c59b16eee
Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
711
diff
changeset
|
236 } |
e71c59b16eee
Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
711
diff
changeset
|
237 |
729
efc2d16ab514
Remove (more) data files and directories.
Sascha Wilde <wilde@intevation.de>
parents:
728
diff
changeset
|
238 deinstall_etc() |
efc2d16ab514
Remove (more) data files and directories.
Sascha Wilde <wilde@intevation.de>
parents:
728
diff
changeset
|
239 { |
750
27dd0012288a
Remove cron job on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
749
diff
changeset
|
240 echo "Removing cron job ..." |
27dd0012288a
Remove cron job on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
749
diff
changeset
|
241 remove_cronjob |
27dd0012288a
Remove cron job on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
749
diff
changeset
|
242 |
729
efc2d16ab514
Remove (more) data files and directories.
Sascha Wilde <wilde@intevation.de>
parents:
728
diff
changeset
|
243 # 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
|
244 local tbcfg_files=( "${instcfg_path}/TrustBridge.ini" |
d8c8e14b9953
Remove trustbridge-tray-starter configuration on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
750
diff
changeset
|
245 "${instcfg_path}/trustbridge-tray-starter.cfg" |
d8c8e14b9953
Remove trustbridge-tray-starter configuration on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
750
diff
changeset
|
246 "$instcfg_file" ) |
752
96cac71834ba
Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
751
diff
changeset
|
247 |
729
efc2d16ab514
Remove (more) data files and directories.
Sascha Wilde <wilde@intevation.de>
parents:
728
diff
changeset
|
248 echo "Removing certificate lists from: ${instdata_path}:" |
752
96cac71834ba
Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
751
diff
changeset
|
249 rm_files "$instdata_path"/list-*.txt |
729
efc2d16ab514
Remove (more) data files and directories.
Sascha Wilde <wilde@intevation.de>
parents:
728
diff
changeset
|
250 rm_empty_dirs "$instdata_path" |
751
d8c8e14b9953
Remove trustbridge-tray-starter configuration on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
750
diff
changeset
|
251 |
d8c8e14b9953
Remove trustbridge-tray-starter configuration on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
750
diff
changeset
|
252 echo "Removing configuration files:" |
752
96cac71834ba
Fixed errors when not all expected files exist on deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
751
diff
changeset
|
253 rm_files "${tbcfg_files[@]}" |
729
efc2d16ab514
Remove (more) data files and directories.
Sascha Wilde <wilde@intevation.de>
parents:
728
diff
changeset
|
254 rm_empty_dirs "$instcfg_path" |
efc2d16ab514
Remove (more) data files and directories.
Sascha Wilde <wilde@intevation.de>
parents:
728
diff
changeset
|
255 } |
efc2d16ab514
Remove (more) data files and directories.
Sascha Wilde <wilde@intevation.de>
parents:
728
diff
changeset
|
256 |
711
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
257 deinstall() |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
258 { |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
259 if [ "${oldinstcfg[PREFIX]}" ] ; then |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
260 echo "Really deinstall TrustBridge from '${oldinstcfg[PREFIX]}'?" |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
261 yorn || exit 0 |
723
e71c59b16eee
Added certificate deinstallation.
Sascha Wilde <wilde@intevation.de>
parents:
711
diff
changeset
|
262 deinstall_certs |
711
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
263 local deinstdir="${oldinstcfg[PREFIX]}/bin" |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
264 echo "Deinstalling from '${oldinstcfg[PREFIX]}'." |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
265 for file in $BINNAMES ; do |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
266 local path="${deinstdir}/$file" |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
267 echo "Deleting '$path' ..." |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
268 rm "$path" || echo >&2 "WARNING: Could not delete: '$path'!" |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
269 done |
728
2d64ff7e22e8
Factored out recursive deletion of empty dirs.
Sascha Wilde <wilde@intevation.de>
parents:
727
diff
changeset
|
270 rm_empty_dirs "$deinstdir" |
729
efc2d16ab514
Remove (more) data files and directories.
Sascha Wilde <wilde@intevation.de>
parents:
728
diff
changeset
|
271 deinstall_etc |
711
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
272 echo "Deinstallation finished." |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
273 else |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
274 echo "No current installation found! No harm done." |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
275 fi |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
276 } |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
277 |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
278 |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
279 #====================================================================== |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
280 # main() |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
281 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
282 parse_args "$@" |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
283 init_vars |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
284 check_priv |
705
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
285 read_oldinstcfg |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
286 |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
287 cat <<EOF |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
288 ------------------------------------------------------------------------ |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
289 |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
290 TrustBridge - Installer |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
291 Version ${instcfg[VERSION]} |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
292 |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
293 ------------------------------------------------------------------------ |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
294 EOF |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
295 |
711
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
296 if [ $DEINSTALL -eq 1 ] ; then |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
297 deinstall |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
298 # Stop after deinstallation: |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
299 exit 0 |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
300 fi |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
301 |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
302 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
|
303 |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
304 if [ "${oldinstcfg[PREFIX]}" ] ; then |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
305 inst_default_prefix="${oldinstcfg[PREFIX]}" |
705
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
306 echo "An existing installation (v${oldinstcfg[VERSION]}) was detected!" |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
307 echo "It is HIGHLY RECOMMENDED to accept the default prefix" |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
308 echo "to update the current installation." |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
309 echo "For a new prefix you should deinstall first!" |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
310 fi |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
311 echo -n "Select installation prefix for TrustBridge [${inst_default_prefix}]: " |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
312 read -e instcfg[PREFIX] |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
313 |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
314 [ -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
|
315 else |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
316 # Prefix was given on invocation: |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
317 if [ "${oldinstcfg[PREFIX]}" -a \ |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
318 "${instcfg[PREFIX]}" != "${oldinstcfg[PREFIX]}" -a \ |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
319 $FORCE -ne 1 ] ; then |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
320 fatal "Prefix differs from current installation (${oldinstcfg[PREFIX]}). Aborting!" |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
321 fi |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
322 fi |
682 | 323 |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
324 echo "Installing to '${instcfg[PREFIX]}':" |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
325 |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
326 if [ ! -d "${instcfg[PREFIX]}" ] ; then |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
327 echo "creating installation directory ..." |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
328 install -d "${instcfg[PREFIX]}" || fatal "Could not create '${instcfg[PREFIX]}'!" |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
329 fi |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
330 |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
331 echo "unpacking files ..." |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
332 cd "${instcfg[PREFIX]}" |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
333 |
711
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
707
diff
changeset
|
334 set +u |
753
7c1f34115ede
Force the shar to overwrite existing files.
Sascha Wilde <wilde@intevation.de>
parents:
752
diff
changeset
|
335 set -- '-c' |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
336 # ---------------------------------------------------------------------- |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
337 # regular shar archive inserted here: |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
338 ###SHAR### |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
339 # ---------------------------------------------------------------------- |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
340 |
738
ea8d13590cbd
Added trustbridge-tray-starter script for use with cron job.
Sascha Wilde <wilde@intevation.de>
parents:
730
diff
changeset
|
341 echo "Preparing trustbridge-tray-starter ..." |
ea8d13590cbd
Added trustbridge-tray-starter script for use with cron job.
Sascha Wilde <wilde@intevation.de>
parents:
730
diff
changeset
|
342 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
|
343 "${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
|
344 sed -i "/^CFGDIR=/c\CFGDIR='${instcfg_path}'" \ |
ea8d13590cbd
Added trustbridge-tray-starter script for use with cron job.
Sascha Wilde <wilde@intevation.de>
parents:
730
diff
changeset
|
345 "${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
|
346 |
749
778382342802
Added installation of cron job.
Sascha Wilde <wilde@intevation.de>
parents:
738
diff
changeset
|
347 echo "Setting up cronjob ..." |
778382342802
Added installation of cron job.
Sascha Wilde <wilde@intevation.de>
parents:
738
diff
changeset
|
348 setup_cronjob |
778382342802
Added installation of cron job.
Sascha Wilde <wilde@intevation.de>
parents:
738
diff
changeset
|
349 |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
350 echo "Writing installation configuration to: $instcfg_file ..." |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
351 write_instcfg |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
352 exit 0 |