Mercurial > trustbridge
annotate packaging/linux-installer.inc.in @ 699:f12b102b33ca
Merged
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Tue, 01 Jul 2014 17:22:31 +0200 |
parents | b55d49150e36 |
children | bf87feccb26c |
rev | line source |
---|---|
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
1 #!/bin/bash |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
2 |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
3 ME=`basename "$0"` |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
4 VERSION='@PROJECT_VERSION@' |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
5 DEFAULT_PREFIX=/usr/local |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
6 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
7 path="" |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
8 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
9 version() |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
10 { |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
11 cat <<EOF |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
12 TrustBridge $VERSION Installer |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
13 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
14 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
|
15 Software engineering by Intevation GmbH |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
16 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
17 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
|
18 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
|
19 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
|
20 EOF |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
21 exit 0 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
22 } |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
23 |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
24 fatal() |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
25 { |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
26 echo "$1" >&2 |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
27 echo "Installation failed." >&2 |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
28 exit 1 |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
29 } |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
30 |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
31 usage() |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
32 { |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
33 cat <<EOF |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
34 Usage: $ME [OPTION]... |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
35 Install TrustBridge. |
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 Options: |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
38 -p, --prefix=PATH install files in PATH |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
39 --help display this help and exit |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
40 --version output version information and exit |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
41 EOF |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
42 exit $1 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
43 } |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
44 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
45 parse_args() |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
46 { |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
47 OPTS=`getopt \ |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
48 -l help,prefix:,version \ |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
49 -o p: -n "$ME" -- "$@"` |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
50 [ $? -eq 0 ] || usage 23 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
51 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
52 eval set -- "$OPTS" |
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 while true ; do |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
55 case "$1" in |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
56 --prefix|-p) |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
57 path="$2" |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
58 shift 2 |
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 --help) |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
61 usage 0 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
62 ;; |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
63 --version) |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
64 version |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
65 ;; |
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 shift |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
68 break |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
69 ;; |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
70 esac |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
71 done |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
72 } |
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 #====================================================================== |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
75 # main() |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
76 |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
77 parse_args "$@" |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
78 |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
79 cat <<EOF |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
80 ------------------------------------------------------------------------ |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
81 |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
82 TrustBridge - Installer |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
83 Version $VERSION |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
84 |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
85 ------------------------------------------------------------------------ |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
86 EOF |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
87 |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
88 if [ -z "$path" ] ; then |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
89 echo -n "Select installation prefix for TrustBridge [${DEFAULT_PREFIX}]: " |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
90 read -e path |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
91 |
698
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
92 [ -z "$path" ] && path="${DEFAULT_PREFIX}" |
b55d49150e36
Added command line args for unattended installation.
Sascha Wilde <wilde@intevation.de>
parents:
682
diff
changeset
|
93 fi |
682 | 94 |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
95 echo "Installing to '$path':" |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
96 |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
97 if [ ! -d "$path" ] ; then |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
98 echo "creating installation directory ..." |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
99 install -d "$path" || fatal "Could not create '$path'!" |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
100 fi |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
101 |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
102 echo "unpacking files ..." |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
103 cd "$path" |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
104 |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
105 # ---------------------------------------------------------------------- |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
106 # regular shar archive appended here: |