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