Mercurial > trustbridge
annotate packaging/linux-createpackage.sh.in @ 1205:c536d031df2b
(issue68) Added NSS and libcurl to license information.
author | Emanuel Schuetze <emanuel@intevation.de> |
---|---|
date | Tue, 23 Sep 2014 15:06:49 +0200 |
parents | 3de099c8129e |
children | 014586ef8a84 |
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 # Copyright (C) 2014 by Bundesamt f�r Sicherheit in der Informationstechnik |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
3 # Software engineering by Intevation GmbH |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
4 # |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
5 # This file is Free Software under the GNU GPL (v>=2) |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
6 # and comes with ABSOLUTELY NO WARRANTY! |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
7 # See LICENSE.txt for details. |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
8 |
1138
45de97d43e13
Implemented generic include mechanism.
Sascha Wilde <wilde@intevation.de>
parents:
1135
diff
changeset
|
9 process_includes() |
45de97d43e13
Implemented generic include mechanism.
Sascha Wilde <wilde@intevation.de>
parents:
1135
diff
changeset
|
10 { |
45de97d43e13
Implemented generic include mechanism.
Sascha Wilde <wilde@intevation.de>
parents:
1135
diff
changeset
|
11 # Process include statements of the form: |
45de97d43e13
Implemented generic include mechanism.
Sascha Wilde <wilde@intevation.de>
parents:
1135
diff
changeset
|
12 # ###INCLUDE:filename |
45de97d43e13
Implemented generic include mechanism.
Sascha Wilde <wilde@intevation.de>
parents:
1135
diff
changeset
|
13 # in the file given as $1 |
45de97d43e13
Implemented generic include mechanism.
Sascha Wilde <wilde@intevation.de>
parents:
1135
diff
changeset
|
14 # the path given as $2, it is used as base path for the included files. |
45de97d43e13
Implemented generic include mechanism.
Sascha Wilde <wilde@intevation.de>
parents:
1135
diff
changeset
|
15 |
45de97d43e13
Implemented generic include mechanism.
Sascha Wilde <wilde@intevation.de>
parents:
1135
diff
changeset
|
16 local file="$1" |
45de97d43e13
Implemented generic include mechanism.
Sascha Wilde <wilde@intevation.de>
parents:
1135
diff
changeset
|
17 local include_base="$2" |
45de97d43e13
Implemented generic include mechanism.
Sascha Wilde <wilde@intevation.de>
parents:
1135
diff
changeset
|
18 |
45de97d43e13
Implemented generic include mechanism.
Sascha Wilde <wilde@intevation.de>
parents:
1135
diff
changeset
|
19 local inc_directive |
45de97d43e13
Implemented generic include mechanism.
Sascha Wilde <wilde@intevation.de>
parents:
1135
diff
changeset
|
20 while [ "${inc_directive:=`grep '^###INCLUDE:' "$file" | head -1`}" ] ; do |
45de97d43e13
Implemented generic include mechanism.
Sascha Wilde <wilde@intevation.de>
parents:
1135
diff
changeset
|
21 local include_file="${inc_directive#'###INCLUDE:'}" |
45de97d43e13
Implemented generic include mechanism.
Sascha Wilde <wilde@intevation.de>
parents:
1135
diff
changeset
|
22 sed -i "/${inc_directive}/r ${include_base}/${include_file}" "$file" |
45de97d43e13
Implemented generic include mechanism.
Sascha Wilde <wilde@intevation.de>
parents:
1135
diff
changeset
|
23 sed -i "/${inc_directive}/d" "$file" |
45de97d43e13
Implemented generic include mechanism.
Sascha Wilde <wilde@intevation.de>
parents:
1135
diff
changeset
|
24 inc_directive="" |
45de97d43e13
Implemented generic include mechanism.
Sascha Wilde <wilde@intevation.de>
parents:
1135
diff
changeset
|
25 done |
45de97d43e13
Implemented generic include mechanism.
Sascha Wilde <wilde@intevation.de>
parents:
1135
diff
changeset
|
26 } |
45de97d43e13
Implemented generic include mechanism.
Sascha Wilde <wilde@intevation.de>
parents:
1135
diff
changeset
|
27 |
45de97d43e13
Implemented generic include mechanism.
Sascha Wilde <wilde@intevation.de>
parents:
1135
diff
changeset
|
28 |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
29 TMPDIR=$(mktemp -d) |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
680
diff
changeset
|
30 TMPSHAR=$(mktemp "@CMAKE_BINARY_DIR@/shar.XXXXXXXXXX") |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
31 |
972
8be2f510adbf
(issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
938
diff
changeset
|
32 ARCH="$1" |
8be2f510adbf
(issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
938
diff
changeset
|
33 |
8be2f510adbf
(issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
938
diff
changeset
|
34 if [ "$ARCH" != "i386" -a "$ARCH" != "x86_64" ]; then |
8be2f510adbf
(issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
938
diff
changeset
|
35 echo "Usage $0 <architecture>" |
8be2f510adbf
(issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
938
diff
changeset
|
36 echo "with archtiecture either i386 or x86_64" |
1113
60669c41684b
(issue91) Use x86_64 arch as default for linux_createpackage.sh
Andre Heinecke <andre.heinecke@intevation.de>
parents:
980
diff
changeset
|
37 echo "defaulting to x86_64" |
60669c41684b
(issue91) Use x86_64 arch as default for linux_createpackage.sh
Andre Heinecke <andre.heinecke@intevation.de>
parents:
980
diff
changeset
|
38 ARCH=x86_64 |
972
8be2f510adbf
(issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
938
diff
changeset
|
39 fi |
8be2f510adbf
(issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
938
diff
changeset
|
40 |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
41 INSTALLER="@CMAKE_BINARY_DIR@/TrustBridge-@PROJECT_VERSION@.sh" |
1177
53a02fbe2fc9
(issue112) Rename deinstaller to uninstaller
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1176
diff
changeset
|
42 UNINSTALLER="$TMPDIR/bin/trustbridge-uninstall.sh" |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
43 |
1176
c8f698ca6355
(issue128) Rename cinst to trustbridge-certificate-installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1175
diff
changeset
|
44 EXEFILES=("@CMAKE_BINARY_DIR@/cinst/trustbridge-certificate-installer" |
1175
e210ecc32d69
(issue128) Rename mozilla process to trustbridge-nss-installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1150
diff
changeset
|
45 "@CMAKE_BINARY_DIR@/cinst/trustbridge-nss-installer" |
738
ea8d13590cbd
Added trustbridge-tray-starter script for use with cron job.
Sascha Wilde <wilde@intevation.de>
parents:
711
diff
changeset
|
46 "@CMAKE_BINARY_DIR@/ui/trustbridge" |
1150 | 47 "@CMAKE_BINARY_DIR@/ui/trustbridge-tray-starter.sh" |
48 "$UNINSTALLER") | |
972
8be2f510adbf
(issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
938
diff
changeset
|
49 |
892
4087e489f569
Install 128px icon for linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
872
diff
changeset
|
50 ICON="@CMAKE_SOURCE_DIR@/ui/img/logo-128.png" |
1186
3de099c8129e
Update packaging for moved help files
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1177
diff
changeset
|
51 HELPFILES=$(find @CMAKE_BINARY_DIR@/doc/help/client/html \ |
938
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
52 -maxdepth 1 -type f -printf "%p \n") |
1186
3de099c8129e
Update packaging for moved help files
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1177
diff
changeset
|
53 HELPFILES_STATIC=$(find @CMAKE_BINARY_DIR@/doc/help/client/html/_static \ |
938
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
54 -maxdepth 1 -type f -printf "%p \n") |
1186
3de099c8129e
Update packaging for moved help files
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1177
diff
changeset
|
55 HELPFILES_IMG=$(find @CMAKE_BINARY_DIR@/doc/help/client/html/_images \ |
938
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
56 -maxdepth 1 -type f -printf "%p \n") |
1186
3de099c8129e
Update packaging for moved help files
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1177
diff
changeset
|
57 HELPFILES_SOURCES=$(find @CMAKE_BINARY_DIR@/doc/help/client/html/_sources \ |
938
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
58 -maxdepth 1 -type f -printf "%p \n") |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
59 |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
60 # Make installation in TMPDIR, this is what we will put into the |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
61 # shar-archive. |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
62 echo "Using $TMPDIR for temporary installation to build installer..." |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
63 install -d "$TMPDIR/bin" |
872
02e357826417
(issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents:
795
diff
changeset
|
64 install -d "$TMPDIR/share/pixmaps/trustbridge" |
938
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
65 install -d "$TMPDIR/share/doc/trustbridge" |
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
66 install -d "$TMPDIR/share/doc/trustbridge/_static" |
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
67 install -d "$TMPDIR/share/doc/trustbridge/_sources" |
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
68 install -d "$TMPDIR/share/doc/trustbridge/_images" |
711
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
700
diff
changeset
|
69 install "${EXEFILES[@]}" "$TMPDIR/bin" |
872
02e357826417
(issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents:
795
diff
changeset
|
70 install "$ICON" "$TMPDIR/share/pixmaps/trustbridge/trustbridge.png" |
711
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
700
diff
changeset
|
71 |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
700
diff
changeset
|
72 binnames="" |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
700
diff
changeset
|
73 for file in "${EXEFILES[@]}" ; do |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
700
diff
changeset
|
74 binnames="`basename $file` $binnames" |
acbe75423283
Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents:
700
diff
changeset
|
75 done |
938
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
76 for file in ${HELPFILES} ; do |
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
77 install "$file" "$TMPDIR/share/doc/trustbridge" |
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
78 helpnames="`basename $file` $helpnames" |
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
79 done |
980
491327689ffc
(issue89) Fix typo in HTMLFILES_IMG variable name
Andre Heinecke <andre.heinecke@intevation.de>
parents:
972
diff
changeset
|
80 for file in ${HELPFILES_IMG} ; do |
938
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
81 install "$file" "$TMPDIR/share/doc/trustbridge/_images" |
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
82 helpnames_img="`basename $file` $helpnames_img" |
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
83 done |
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
84 for file in ${HELPFILES_STATIC} ; do |
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
85 install "$file" "$TMPDIR/share/doc/trustbridge/_static" |
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
86 helpnames_static="`basename $file` $helpnames_static" |
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
87 done |
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
88 for file in ${HELPFILES_SOURCES}; do |
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
89 install "$file" "$TMPDIR/share/doc/trustbridge/_sources" |
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
90 helpnames_sources="`basename $file` $helpnames_sources" |
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
91 done |
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
92 |
1150 | 93 echo "Building $INSTALLER and $UNINSTALLER ..." |
94 | |
95 cp "@CMAKE_BINARY_DIR@/packaging/linux-installer.inc" "$INSTALLER" | |
96 cp "@CMAKE_BINARY_DIR@/packaging/linux-uninstaller.inc" "$UNINSTALLER" | |
97 | |
98 declare -a INSTALLER_SCRIPTS | |
99 INSTALLER_SCRIPTS=("$INSTALLER" "$UNINSTALLER") | |
100 | |
101 for script in "${INSTALLER_SCRIPTS[@]}" ; do | |
102 process_includes "$script" "@CMAKE_BINARY_DIR@/packaging" | |
103 sed -i "s/###BINNAMES###/${binnames}/" "$script" | |
104 sed -i "s/###ICONNAME###/trustbridge.png/" "$script" | |
105 sed -i "s/###HELPNAMES###/${helpnames}/" "$script" | |
106 sed -i "s/###HELPNAMES_SOURCES###/${helpnames_sources}/" "$script" | |
107 sed -i "s/###HELPNAMES_STATIC###/${helpnames_static}/" "$script" | |
108 sed -i "s/###HELPNAMES_IMG###/${helpnames_img}/" "$script" | |
109 sed -i "s/###ARCH###/${ARCH}/" "$script" | |
110 chmod +x "$script" | |
111 done | |
112 | |
938
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
113 echo "Creating shar archive ..." |
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
114 cd "$TMPDIR" |
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
115 shar -z -B `find -type f` | sed 's/^exit 0//' >>"$TMPSHAR" |
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
116 |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
680
diff
changeset
|
117 sed -i "/###SHAR###/r $TMPSHAR" "$INSTALLER" |
938
15f7b3ebf21b
(issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
921
diff
changeset
|
118 |
921
419cf0560d45
Create signature for linux installer in linux-createpackage.sh
Andre Heinecke <andre.heinecke@intevation.de>
parents:
892
diff
changeset
|
119 echo "Signing" |
1130
a2d2ae5a1154
Fix quoting in sign command
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1113
diff
changeset
|
120 "@CMAKE_SOURCE_DIR@/ui/tests/append-sig.sh" \ |
a2d2ae5a1154
Fix quoting in sign command
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1113
diff
changeset
|
121 "@CMAKE_SOURCE_DIR@/ui/tests/data/codesign/codesigning.key" \ |
a2d2ae5a1154
Fix quoting in sign command
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1113
diff
changeset
|
122 "$INSTALLER" "${INSTALLER}_signed" |
a2d2ae5a1154
Fix quoting in sign command
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1113
diff
changeset
|
123 mv "${INSTALLER}_signed" "$INSTALLER" |
680
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
124 |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
125 echo "Cleaning up..." |
a5a709c6ce93
Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
126 rm -r "$TMPDIR" |
700
bf87feccb26c
Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents:
680
diff
changeset
|
127 rm "$TMPSHAR" |