forked from HydrologicEngineeringCenter/TomcatRPM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_solaris_pkg.sh
executable file
·62 lines (51 loc) · 1.8 KB
/
build_solaris_pkg.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
BUILDDIR=`pwd`/solaris_pkg
PKG_ROOT=$BUILDDIR/root
CATALINA_HOME=/opt/apache-tomcat-9
CATALINA_BASE=/usr/local/tomcat/default
TOMCAT_TARBAL=$1
TOMCAT_DIR=`basename $1 .tar.gz`
if [ ! -d $BUILDDIR ]; then mkdir $BUILDDIR; fi
gtar -xvz -C $BUILDDIR -f $TOMCAT_TARBAL
cd solaris_pkg
if [ -d $PKG_ROOT ]; then rm -rf $PKG_ROOT; fi
mkdir $PKG_ROOT
mkdir -p $PKG_ROOT/$CATALINA_BASE
mkdir -p $PKG_ROOT/$CATALINA_HOME
mkdir -p $PKG_ROOT/lib/svc/manifest/network
cp ../solaris/apache-tomcat-9.xml $PKG_ROOT/lib/svc/manifest/network/
echo "Creating directory structure"
mv $TOMCAT_DIR/bin $PKG_ROOT/$CATALINA_HOME
mv $TOMCAT_DIR/lib $PKG_ROOT/$CATALINA_HOME
mv $TOMCAT_DIR/conf $PKG_ROOT/$CATALINA_BASE
mv $TOMCAT_DIR/logs $PKG_ROOT/$CATALINA_BASE
mv $TOMCAT_DIR/webapps $PKG_ROOT/$CATALINA_BASE
cd $PKG_ROOT/$CATALINA_BASE/webapps
rm -r host-manager
rm -r docs
rm -r examples
rm -r ROOT
cd ../conf
rm -f *.bat
cd $BUILDDIR
mv $TOMCAT_DIR/work $PKG_ROOT/$CATALINA_BASE
mv $TOMCAT_DIR/temp $PKG_ROOT/$CATALINA_BASE
echo "Move remaining files to CATALINA_HOME"
mv $TOMCAT_DIR/* $PKG_ROOT/$CATALINA_HOME
echo "Patching config files"
cd $PKG_ROOT/$CATALINA_BASE
#patch -p1 < $BUILDDIR/../serverxml-stig.patch
#patch -p1 < $BUILDDIR/../webxml-stig.patch
#patch -p1 < $BUILDDIR/../manager-stig.patch
cd $BUILDDIR
echo "generate solaris package information"
#pkgsend generate root | pkgfmt > apache-tomcat.p5m.1
pkgmogrify ../apache-tomcat.p5m.1 ../apache-tomcat.mog | pkgfmt > apache-tomcat.p5m.2
pkgdepend generate -md root apache-tomcat.p5m.2 | pkgfmt > apache-tomcat.p5m.3
pkgdepend resolve -m apache-tomcat.p5m.3
echo "verifying package"
pkglint apache-tomcat.p5m.3.res
pkgrepo create repo
pkgsend -s repo publish -d root apache-tomcat.p5m.3.res
rm apache-tomcat-9.p5p
pkgrecv -s repo -a -d apache-tomcat-9.p5p apache-tomcat-9