Mercurial > trustbridge
annotate packaging/linux-installer.inc.in @ 708:bd48fae793b6
(Issue25) Log update check success, change header labels.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Wed, 02 Jul 2014 12:49:11 +0200 |
parents | 37899f717fa5 |
children | acbe75423283 |
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" |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
7 CFGPATH="${XDG_DATA_HOME:-$HOME/.local/share}/BSI/TrustBridge" |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
8 SYSCFGPATH="/etc/TrustBridge" |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
9 INSTCFGNAME="installation.cfg" |
705
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
10 FORCE=0 |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
11 SYSINST=0 |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
12 |
705
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
13 declare -A instcfg oldinstcfg |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
14 declare inst_default_prefix instcfg_file |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
15 instcfg=( |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
16 [TIMESTMP]=`date -u +%Y%m%d%H%M%S` |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
17 [VERSION]='@PROJECT_VERSION@' |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
18 [PREFIX]='' |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
19 ) |
705
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
20 oldinstcfg=( |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
21 [TIMESTMP]='' |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
22 [VERSION]='' |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
23 [PREFIX]='' |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
24 ) |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
25 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
26 version() |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
27 { |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
28 cat <<EOF |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
29 TrustBridge ${instcfg[VERSION]} Installer |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
30 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
31 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
|
32 Software engineering by Intevation GmbH |
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 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
|
35 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
|
36 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
|
37 EOF |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
38 exit 0 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
39 } |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
40 |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
41 fatal() |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
42 { |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
43 echo "$1" >&2 |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
44 echo "Installation failed." >&2 |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
45 exit 1 |
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 |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
48 usage() |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
49 { |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
50 cat <<EOF |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
51 Usage: $ME [OPTION]... |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
52 Install TrustBridge. |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
53 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
54 Options: |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
55 -p, --prefix=PATH install files in PATH |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
56 -s, --system=PATH make an system wide installation |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
57 -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
|
58 installation with different prefix exists. |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
59 --help display this help and exit |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
60 --version output version information and exit |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
61 EOF |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
62 exit $1 |
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 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
65 parse_args() |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
66 { |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
67 OPTS=`getopt \ |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
68 -l force,help,prefix:,system,version \ |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
69 -o f,p:,s -n "$ME" -- "$@"` |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
70 [ $? -eq 0 ] || usage 23 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
71 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
72 eval set -- "$OPTS" |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
73 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
74 while true ; do |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
75 case "$1" in |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
76 --prefix|-p) |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
77 instcfg[PREFIX]="$2" |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
78 shift 2 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
79 ;; |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
80 --system|-s) |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
81 SYSINST=1 |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
82 shift 1 |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
83 ;; |
705
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
84 --force|-f) |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
85 FORCE=1 |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
86 shift 1 |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
87 ;; |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
88 --help) |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
89 usage 0 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
90 ;; |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
91 --version) |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
92 version |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
93 ;; |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
94 --) |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
95 shift |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
96 break |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
97 ;; |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
98 esac |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
99 done |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
100 } |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
101 |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
102 init_vars() |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
103 { |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
104 if [ $SYSINST -eq 1 ] ; then |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
105 inst_default_prefix="$SYSDEFAULT_PREFIX" |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
106 instcfg_file="${SYSCFGPATH}/${INSTCFGNAME}" |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
107 else |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
108 inst_default_prefix="$DEFAULT_PREFIX" |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
109 instcfg_file="${CFGPATH}/${INSTCFGNAME}" |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
110 fi |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
111 } |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
112 |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
113 write_instcfg() |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
114 { |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
115 install -d `dirname "$instcfg_file"` |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
116 echo "# Created by TrustBridge-Installer, don't touch!" >"$instcfg_file" |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
117 for key in "${!instcfg[@]}" ; do |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
118 echo "${key}=${instcfg[$key]}" >>"$instcfg_file" |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
119 done |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
120 } |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
121 |
705
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
122 read_oldinstcfg() |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
123 { |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
124 if [ -r "$instcfg_file" ] ; then |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
125 echo "Reading '$instcfg_file' ..." |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
126 for key in "${!oldinstcfg[@]}" ; do |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
127 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
|
128 done |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
129 fi |
705
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
130 } |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
131 |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
132 check_priv() |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
133 { |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
134 if [ $SYSINST -eq 1 -a "$UID" -ne 0 ] ; then |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
135 fatal "System wide installation requires root privileges!" |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
136 fi |
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 |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
139 |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
140 #====================================================================== |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
141 # main() |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
142 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
143 parse_args "$@" |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
144 init_vars |
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
145 check_priv |
705
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
146 read_oldinstcfg |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
147 |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
148 cat <<EOF |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
149 ------------------------------------------------------------------------ |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
150 |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
151 TrustBridge - Installer |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
152 Version ${instcfg[VERSION]} |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
153 |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
154 ------------------------------------------------------------------------ |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
155 EOF |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
156 |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
157 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
|
158 |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
159 if [ "${oldinstcfg[PREFIX]}" ] ; then |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
160 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
|
161 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
|
162 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
|
163 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
|
164 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
|
165 fi |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
166 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
|
167 read -e instcfg[PREFIX] |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
168 |
707
37899f717fa5
Added system wide installation.
Sascha Wilde <wilde@intevation.de>
parents:
705
diff
changeset
|
169 [ -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
|
170 else |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
171 # Prefix was given on invocation: |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
172 if [ "${oldinstcfg[PREFIX]}" -a \ |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
173 "${instcfg[PREFIX]}" != "${oldinstcfg[PREFIX]}" -a \ |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
174 $FORCE -ne 1 ] ; then |
ff2efc1cb8fa
Use config from old installation for sensible default prefix.
Sascha Wilde <wilde@intevation.de>
parents:
704
diff
changeset
|
175 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
|
176 fi |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
177 fi |
682 | 178 |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
179 echo "Installing to '${instcfg[PREFIX]}':" |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
180 |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
181 if [ ! -d "${instcfg[PREFIX]}" ] ; then |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
182 echo "creating installation directory ..." |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
183 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
|
184 fi |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
185 |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
186 echo "unpacking files ..." |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
187 cd "${instcfg[PREFIX]}" |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
188 |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
189 # ---------------------------------------------------------------------- |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
190 # regular shar archive inserted here: |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
191 ###SHAR### |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
192 # ---------------------------------------------------------------------- |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
193 |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
194 echo "Writing installation configuration to: $instcfg_file ..." |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
195 write_instcfg |
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
698
diff
changeset
|
196 exit 0 |