comparison packaging/linux-installer.inc.in @ 698:b55d49150e36

Added command line args for unattended installation.
author Sascha Wilde <wilde@intevation.de>
date Tue, 01 Jul 2014 17:21:21 +0200
parents 578860edde53
children bf87feccb26c
comparison
equal deleted inserted replaced
694:25a73bfec359 698:b55d49150e36
1 #!/bin/bash 1 #!/bin/bash
2 2
3 PREFIX=/usr/local 3 ME=`basename "$0"`
4 VERSION='@PROJECT_VERSION@'
5 DEFAULT_PREFIX=/usr/local
6
7 path=""
8
9 version()
10 {
11 cat <<EOF
12 TrustBridge $VERSION Installer
13
14 Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
15 Software engineering by Intevation GmbH
16
17 This is free software. You may redistribute copies of it under the terms of
18 the GNU GPL (v>=2). See LICENSE.txt for details.
19 There is NO WARRANTY, to the extent permitted by law.
20 EOF
21 exit 0
22 }
4 23
5 fatal() 24 fatal()
6 { 25 {
7 echo "$1" >&2 26 echo "$1" >&2
8 echo "Installation failed." >&2 27 echo "Installation failed." >&2
9 exit 1 28 exit 1
10 } 29 }
11 30
31 usage()
32 {
33 cat <<EOF
34 Usage: $ME [OPTION]...
35 Install TrustBridge.
36
37 Options:
38 -p, --prefix=PATH install files in PATH
39 --help display this help and exit
40 --version output version information and exit
41 EOF
42 exit $1
43 }
44
45 parse_args()
46 {
47 OPTS=`getopt \
48 -l help,prefix:,version \
49 -o p: -n "$ME" -- "$@"`
50 [ $? -eq 0 ] || usage 23
51
52 eval set -- "$OPTS"
53
54 while true ; do
55 case "$1" in
56 --prefix|-p)
57 path="$2"
58 shift 2
59 ;;
60 --help)
61 usage 0
62 ;;
63 --version)
64 version
65 ;;
66 --)
67 shift
68 break
69 ;;
70 esac
71 done
72 }
73
74 #======================================================================
75 # main()
76
77 parse_args "$@"
78
12 cat <<EOF 79 cat <<EOF
13 ------------------------------------------------------------------------ 80 ------------------------------------------------------------------------
14 81
15 TrustBridge - Installer 82 TrustBridge - Installer
16 Version @PROJECT_VERSION@ 83 Version $VERSION
17 84
18 ------------------------------------------------------------------------ 85 ------------------------------------------------------------------------
19 EOF 86 EOF
20 87
21 echo -n "Select installation prefix for TrustBridge [${PREFIX}]: " 88 if [ -z "$path" ] ; then
22 read -e path 89 echo -n "Select installation prefix for TrustBridge [${DEFAULT_PREFIX}]: "
90 read -e path
23 91
24 [ -z "$path" ] && path="${PREFIX}" 92 [ -z "$path" ] && path="${DEFAULT_PREFIX}"
93 fi
25 94
26 echo "Installing to '$path':" 95 echo "Installing to '$path':"
27 96
28 if [ ! -d "$path" ] ; then 97 if [ ! -d "$path" ] ; then
29 echo "creating installation directory ..." 98 echo "creating installation directory ..."

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