Mercurial > dive4elements > river
annotate contrib/make_flys_release/bin/make-importer-package.sh @ 9742:df5c6f3ef893 3.2.x
Do not run tomcat as root
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Mon, 29 Aug 2022 16:41:43 +0200 |
parents | f3aa7a12c86a |
children | b1b48fa7bd80 |
rev | line source |
---|---|
5097
415ac9bc5a56
Add importer packaging script and some doc about it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
1 #!/bin/bash |
8675
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
2 # Packaging-script for Dive4Elements River-Importer |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
3 # |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
4 # Copyright (C) 2011 - 2014 by Bundesanstalt für Gewässerkunde |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
5 # Software engineering by Intevation GmbH |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
6 # |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
7 # This file is Free Software under the GNU AGPL (>=v3) |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
8 # and comes with ABSOLUTELY NO WARRANTY! Check out the |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
9 # documentation coming with Dive4Elements River for details. |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
10 |
5097
415ac9bc5a56
Add importer packaging script and some doc about it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
11 set -e |
415ac9bc5a56
Add importer packaging script and some doc about it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
12 |
8675
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
13 # See ../README for more information |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
14 # The working directory. Resulting tarball will be placed here. |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
15 PKG_DIR=/tmp/flys-importer |
5097
415ac9bc5a56
Add importer packaging script and some doc about it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
16 # Path to the flys checkout |
8675
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
17 SOURCE_DIR=$(readlink -f `dirname $0`)/../../.. |
5097
415ac9bc5a56
Add importer packaging script and some doc about it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
18 |
8675
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
19 usage(){ |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
20 cat << EOF |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
21 |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
22 usage: $0 [options] VERSION [EXTRAS] |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
23 |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
24 Create a D4E River Importer-package |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
25 |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
26 OPTIONS: |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
27 -?, --help Show this message |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
28 -o, --oracle Package is for Oracle. |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
29 VERSION must specify a tag (usually MAYOR.MINOR.PATCH) or a branch name. |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
30 With EXTRAS, a tarball with dependencies can be given. |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
31 EOF |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
32 exit 0 |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
33 } |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
34 |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
35 OPTS=`getopt -o ?,o -l help,oracle -n $0 -- "$@"` |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
36 |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
37 if [ $? != 0 ] ; then usage; fi |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
38 eval set -- "$OPTS" |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
39 while true ; do |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
40 case "$1" in |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
41 "-?"|"--help") |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
42 usage;; |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
43 "--") |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
44 shift |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
45 break;; |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
46 "-o"|"--oracle") |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
47 BUILD_ORACLE="TRUE" |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
48 shift;; |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
49 *) |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
50 echo "Unknown Option $1" |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
51 usage;; |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
52 esac |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
53 done |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
54 |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
55 if [ $# != 1 ]; then |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
56 usage |
5179
4355b4cecef8
Improve importer packaging by just expecting a tarball with
Andre Heinecke <aheinecke@intevation.de>
parents:
5172
diff
changeset
|
57 fi |
5097
415ac9bc5a56
Add importer packaging script and some doc about it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
58 |
8675
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
59 VERSION=$1 |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
60 EXTRAS=$2 |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
61 |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
62 # Update to VERSION |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
63 echo "WARNING: any local changes in $SOURCE_DIR will be packaged." |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
64 cd ${SOURCE_DIR} |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
65 if [ -z "`hg tags | sed -n "/$VERSION/p"`" -a -z "`hg branches | sed -n "/$VERSION/p"`" ] |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
66 then |
8742
f7007b1aaa3f
Importer-packaging: just a warning would end up with a package that really looks like VERSION.
Tom Gottfried <tom@intevation.de>
parents:
8675
diff
changeset
|
67 echo "ERROR: No tag or branch $VERSION found in repository of $repo!" |
f7007b1aaa3f
Importer-packaging: just a warning would end up with a package that really looks like VERSION.
Tom Gottfried <tom@intevation.de>
parents:
8675
diff
changeset
|
68 exit 1 |
8675
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
69 else |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
70 hg up "$VERSION" |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
71 fi |
5520
d5e1e4d9559e
compile manual from within importer packaging script
Tom Gottfried <tom.gottfried@intevation.de>
parents:
5491
diff
changeset
|
72 |
6814
e41059fb4073
Importer Doc: Update title page automatically.
Tom Gottfried <tom.gottfried@intevation.de>
parents:
5855
diff
changeset
|
73 # create PDF of manual |
7334
f7d3fc619976
Importer manual: use unique revision identifier.
Tom Gottfried <tom@intevation.de>
parents:
7331
diff
changeset
|
74 REV=`hg parent | sed -n '1s/[[:alnum:]]*: *\([0-9]*:.*\)/\1/;1p'` |
8675
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
75 cd ${SOURCE_DIR}/backend/doc/documentation/de/ |
7334
f7d3fc619976
Importer manual: use unique revision identifier.
Tom Gottfried <tom@intevation.de>
parents:
7331
diff
changeset
|
76 sed -i "s/documentrevision..rev.*/documentrevision}{rev$REV}/" \ |
6814
e41059fb4073
Importer Doc: Update title page automatically.
Tom Gottfried <tom.gottfried@intevation.de>
parents:
5855
diff
changeset
|
77 importer-manual.tex |
7331
bb9735fbb680
Importer packaging: run pdflatex three times to get references and page numbering right.
Tom Gottfried <tom@intevation.de>
parents:
6814
diff
changeset
|
78 # run pdflatex three times to get references and page numbering right |
bb9735fbb680
Importer packaging: run pdflatex three times to get references and page numbering right.
Tom Gottfried <tom@intevation.de>
parents:
6814
diff
changeset
|
79 pdflatex importer-manual.tex |
bb9735fbb680
Importer packaging: run pdflatex three times to get references and page numbering right.
Tom Gottfried <tom@intevation.de>
parents:
6814
diff
changeset
|
80 pdflatex importer-manual.tex |
6814
e41059fb4073
Importer Doc: Update title page automatically.
Tom Gottfried <tom.gottfried@intevation.de>
parents:
5855
diff
changeset
|
81 pdflatex importer-manual.tex |
5097
415ac9bc5a56
Add importer packaging script and some doc about it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
82 |
8675
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
83 # package importer |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
84 if [ "$BUILD_ORACLE" = "TRUE" ]; then |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
85 mvn -f $SOURCE_DIR/backend/pom-oracle.xml clean package assembly:single |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
86 else |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
87 mvn -f $SOURCE_DIR/backend/pom.xml clean package assembly:single |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
88 fi |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
89 |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
90 echo "INFO: create tarball" |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
91 rm -fr $PKG_DIR |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
92 mkdir $PKG_DIR |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
93 cd $PKG_DIR |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
94 |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
95 mv $SOURCE_DIR/backend/target/river-backend-1.0-SNAPSHOT*-flys-importer.tar \ |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
96 flys-importer-$VERSION.tar |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
97 if [ -f "$EXTRAS" ]; then |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
98 tar -xzf "$EXTRAS" |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
99 tar -rf flys-importer-$VERSION.tar opt |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
100 fi |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
101 |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
102 gzip flys-importer-$VERSION.tar |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
103 sha1sum flys-importer-$VERSION.tar.gz > flys-importer-$VERSION.tar.gz.sha1 |
ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
Tom Gottfried <tom@intevation.de>
parents:
8670
diff
changeset
|
104 echo Package is at: `readlink -f flys-importer-$VERSION.tar.gz` |