annotate packaging/linux-createpackage.sh.in @ 1118:fd85a02d771d

(issue54) Implement a privilege drop to execute the program after installation. This commit is extremly ugly as I accidentally worked in a working tree that was partially merged with default. To review the real change please check the commit that will merge this branch into default.
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 16 Sep 2014 19:45:19 +0200
parents 60669c41684b
children a2d2ae5a1154
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
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
9 TMPDIR=$(mktemp -d)
700
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 680
diff changeset
10 TMPSHAR=$(mktemp "@CMAKE_BINARY_DIR@/shar.XXXXXXXXXX")
680
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
11
972
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
12 ARCH="$1"
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
13
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
14 if [ "$ARCH" != "i386" -a "$ARCH" != "x86_64" ]; then
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
15 echo "Usage $0 <architecture>"
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
16 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
17 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
18 ARCH=x86_64
972
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
19 fi
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
20
680
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
21 INSTALLER="@CMAKE_BINARY_DIR@/TrustBridge-@PROJECT_VERSION@.sh"
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
22
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
23 EXEFILES=("@CMAKE_BINARY_DIR@/cinst/cinst"
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
24 "@CMAKE_BINARY_DIR@/cinst/mozilla"
738
ea8d13590cbd Added trustbridge-tray-starter script for use with cron job.
Sascha Wilde <wilde@intevation.de>
parents: 711
diff changeset
25 "@CMAKE_BINARY_DIR@/ui/trustbridge"
ea8d13590cbd Added trustbridge-tray-starter script for use with cron job.
Sascha Wilde <wilde@intevation.de>
parents: 711
diff changeset
26 "@CMAKE_BINARY_DIR@/ui/trustbridge-tray-starter.sh")
972
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
27
892
4087e489f569 Install 128px icon for linux
Andre Heinecke <andre.heinecke@intevation.de>
parents: 872
diff changeset
28 ICON="@CMAKE_SOURCE_DIR@/ui/img/logo-128.png"
938
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
29 HELPFILES=$(find @CMAKE_BINARY_DIR@/manuals/help-manual/html \
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
30 -maxdepth 1 -type f -printf "%p \n")
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
31 HELPFILES_STATIC=$(find @CMAKE_BINARY_DIR@/manuals/help-manual/html/_static \
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
32 -maxdepth 1 -type f -printf "%p \n")
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
33 HELPFILES_IMG=$(find @CMAKE_BINARY_DIR@/manuals/help-manual/html/_images \
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
34 -maxdepth 1 -type f -printf "%p \n")
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
35 HELPFILES_SOURCES=$(find @CMAKE_BINARY_DIR@/manuals/help-manual/html/_sources \
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
36 -maxdepth 1 -type f -printf "%p \n")
680
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
37
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 738
diff changeset
38 L10N_DE_FILE="@CMAKE_BINARY_DIR@/packaging/linux-installer.l10n-de"
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 738
diff changeset
39
680
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
40 # 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
41 # shar-archive.
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
42 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
43 install -d "$TMPDIR/bin"
872
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 795
diff changeset
44 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
45 install -d "$TMPDIR/share/doc/trustbridge"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
46 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
47 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
48 install -d "$TMPDIR/share/doc/trustbridge/_images"
711
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 700
diff changeset
49 install "${EXEFILES[@]}" "$TMPDIR/bin"
872
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 795
diff changeset
50 install "$ICON" "$TMPDIR/share/pixmaps/trustbridge/trustbridge.png"
711
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 700
diff changeset
51
680
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
52 echo "Building $INSTALLER..."
700
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 680
diff changeset
53 cp "@CMAKE_BINARY_DIR@/packaging/linux-installer.inc" "$INSTALLER"
711
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 700
diff changeset
54 binnames=""
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 700
diff changeset
55 for file in "${EXEFILES[@]}" ; do
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 700
diff changeset
56 binnames="`basename $file` $binnames"
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 700
diff changeset
57 done
938
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
58 for file in ${HELPFILES} ; do
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
59 install "$file" "$TMPDIR/share/doc/trustbridge"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
60 helpnames="`basename $file` $helpnames"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
61 done
980
491327689ffc (issue89) Fix typo in HTMLFILES_IMG variable name
Andre Heinecke <andre.heinecke@intevation.de>
parents: 972
diff changeset
62 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
63 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
64 helpnames_img="`basename $file` $helpnames_img"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
65 done
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
66 for file in ${HELPFILES_STATIC} ; do
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
67 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
68 helpnames_static="`basename $file` $helpnames_static"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
69 done
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
70 for file in ${HELPFILES_SOURCES}; do
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
71 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
72 helpnames_sources="`basename $file` $helpnames_sources"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
73 done
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
74
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
75 echo "Creating shar archive ..."
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
76 cd "$TMPDIR"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
77 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
78
711
acbe75423283 Added deinstallation functionality.
Sascha Wilde <wilde@intevation.de>
parents: 700
diff changeset
79 sed -i "s/###BINNAMES###/${binnames}/" "$INSTALLER"
872
02e357826417 (issue81) Add desktop file
Andre Heinecke <andre.heinecke@intevation.de>
parents: 795
diff changeset
80 sed -i "s/###ICONNAME###/trustbridge.png/" "$INSTALLER"
700
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 680
diff changeset
81 sed -i "/###SHAR###/r $TMPSHAR" "$INSTALLER"
795
3a9b0c75f5a6 Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents: 738
diff changeset
82 sed -i "/###L10N_DE###/r $L10N_DE_FILE" "$INSTALLER"
938
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
83 sed -i "s/###HELPNAMES###/${helpnames}/" "$INSTALLER"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
84 sed -i "s/###HELPNAMES_SOURCES###/${helpnames_sources}/" "$INSTALLER"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
85 sed -i "s/###HELPNAMES_STATIC###/${helpnames_static}/" "$INSTALLER"
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
86 sed -i "s/###HELPNAMES_IMG###/${helpnames_img}/" $INSTALLER
972
8be2f510adbf (issue91) Make installer architecture aware.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 938
diff changeset
87 sed -i "s/###ARCH###/${ARCH}/" $INSTALLER
938
15f7b3ebf21b (issue89) Add help packaging for Linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 921
diff changeset
88
680
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
89 chmod +x "$INSTALLER"
921
419cf0560d45 Create signature for linux installer in linux-createpackage.sh
Andre Heinecke <andre.heinecke@intevation.de>
parents: 892
diff changeset
90 echo "Signing"
419cf0560d45 Create signature for linux installer in linux-createpackage.sh
Andre Heinecke <andre.heinecke@intevation.de>
parents: 892
diff changeset
91 @CMAKE_SOURCE_DIR@/ui/tests/append-sig.sh @CMAKE_SOURCE_DIR@/ui/tests/data/codesign/codesigning.key \
419cf0560d45 Create signature for linux installer in linux-createpackage.sh
Andre Heinecke <andre.heinecke@intevation.de>
parents: 892
diff changeset
92 $INSTALLER ${INSTALLER}_signed
419cf0560d45 Create signature for linux installer in linux-createpackage.sh
Andre Heinecke <andre.heinecke@intevation.de>
parents: 892
diff changeset
93 mv ${INSTALLER}_signed $INSTALLER
680
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
94
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
95 echo "Cleaning up..."
a5a709c6ce93 Added minimal shar based installer for linux.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
96 rm -r "$TMPDIR"
700
bf87feccb26c Write installation configuration file.
Sascha Wilde <wilde@intevation.de>
parents: 680
diff changeset
97 rm "$TMPSHAR"

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