aboutsummaryrefslogtreecommitdiff
path: root/network/wildfly/wildfly.SlackBuild
blob: 05f0b4a1ad00c973d47874e4728defd06a67fcef (plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#!/bin/bash
# Slackware build script for WildFly

# Copyright 2019 Giorgio Peron <giorgio.peron@gmail.com>, Belluno, Italy
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=wildfly
VERSION=${VERSION:-18.0.0}
MINORVER=${MINORVER:-.Final}

BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

ARCH=noarch

TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

set -e

# Check if the 'wildfly' user & group exist:
if [ "$(grep ^wildfly /etc/passwd)" = "" -o "$(grep ^wildfly /etc/group)" = "" ] ; then
  printf "\nYou must have a wildfly user and group.\n\nExample:\n"
  printf "\t# groupadd -g 282 wildfly\n"
  printf "\t# useradd -u 282 -M -r -s /bin/bash -d /usr/share/wildfly -c \"Wildfly Application Server\" -g wildfly wildfly\n\n"
  exit 1
fi

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
tar xvzf $CWD/$PRGNAM-$VERSION$MINORVER.tar.gz

# move everything to /usr/share/wildfly
mkdir -p $PKG/usr/share/$PRGNAM
mv $TMP/$PRGNAM-$VERSION$MINORVER/* $PKG/usr/share/$PRGNAM
cd $PKG/usr/share/$PRGNAM
chown -R root:root .

# Move the docs to our standard location first
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
mv docs/* $PKG/usr/doc/$PRGNAM-$VERSION
mv *.txt $PKG/usr/doc/$PRGNAM-$VERSION
rm -rf docs
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

# directory server: wildfly/standalone/* -> /var/lib/wildfly/standalone/*
cd $PKG
mkdir -p $PKG/var/lib/$PRGNAM
mv $PKG/usr/share/$PRGNAM/standalone $PKG/var/lib/$PRGNAM
cd $PKG/usr/share/$PRGNAM
ln -sf ../../../var/lib/$PRGNAM/standalone
mv $PKG/usr/share/$PRGNAM/domain $PKG/var/lib/$PRGNAM
cd $PKG/usr/share/$PRGNAM
ln -sf ../../../var/lib/$PRGNAM/domain
mkdir -p $PKG/etc/$PRGNAM/{standalone,domain}
mv $PKG/var/lib/$PRGNAM/standalone/configuration $PKG/etc/$PRGNAM/standalone/
mv $PKG/var/lib/$PRGNAM/domain/configuration $PKG/etc/$PRGNAM/domain/
cd $PKG/var/lib/$PRGNAM/standalone
ln -sf ../../../../etc/$PRGNAM/standalone/configuration configuration
cd $PKG/var/lib/$PRGNAM/domain
ln -sf ../../../../etc/$PRGNAM/domain/configuration configuration
mkdir -p $PKG/var/{log,tmp}/$PRGNAM/standalone
cd $PKG/var/lib/$PRGNAM/standalone
ln -sf ../../../log/$PRGNAM/standalone log
ln -sf ../../../tmp/$PRGNAM/standalone tmp

mv $PKG/usr/share/$PRGNAM/bin/standalone.conf $PKG/etc/$PRGNAM/standalone/
mv $PKG/usr/share/$PRGNAM/bin/domain.conf $PKG/etc/$PRGNAM/domain/
cd $PKG/usr/share/$PRGNAM/bin
ln -sf ../../../../etc/$PRGNAM/standalone/standalone.conf
ln -sf ../../../../etc/$PRGNAM/domain/domain.conf

# the xml history need some special treatment
mkdir -p $PKG/var/lib/$PRGNAM/standalone/standalone_xml_history
mkdir -p $PKG/var/lib/$PRGNAM/domain/domain_xml_history
mkdir -p $PKG/var/lib/$PRGNAM/domain/host_xml_history
cd $PKG/etc/$PRGNAM/standalone/configuration
ln -sf ../../../../var/lib/$PRGNAM/standalone/standalone_xml_history
cd $PKG/etc/$PRGNAM/domain/configuration
ln -sf ../../../../var/lib/$PRGNAM/domain/domain_xml_history
ln -sf ../../../../var/lib/$PRGNAM/domain/host_xml_history

# Add /etc/rc.d/rc.wildfly.new
mkdir -p $PKG/etc/rc.d
cat $CWD/rc.$PRGNAM > $PKG/etc/rc.d/rc.$PRGNAM.new

# Add /etc/profile.d/wildfly.sh
mkdir -p $PKG/etc/profile.d
cat > $PKG/etc/profile.d/$PRGNAM.sh << EOF
#!/bin/sh
export JBOSS_HOME=/usr/share/wildfly
EOF
cat > $PKG/etc/profile.d/$PRGNAM.csh << EOF
#!/bin/csh
setenv JBOSS_HOME /usr/share/wildfly
EOF
chmod +x $PKG/etc/profile.d/$PRGNAM.*

# Remove win*z executables
rm $PKG/usr/share/$PRGNAM/bin/*.bat
chmod 0755 $PKG/usr/share/$PRGNAM/bin/*.sh

mkdir -p $PKG/sbin
cd $PKG/sbin
ln -sf ../usr/share/$PRGNAM/bin/add-user.sh
ln -sf ../usr/share/$PRGNAM/bin/appclient.sh
ln -sf ../usr/share/$PRGNAM/bin/common.sh
ln -sf ../usr/share/$PRGNAM/bin/domain.sh
ln -sf ../usr/share/$PRGNAM/bin/elytron-tool.sh
ln -sf ../usr/share/$PRGNAM/bin/jboss-cli.sh
ln -sf ../usr/share/$PRGNAM/bin/jconsole.sh
ln -sf ../usr/share/$PRGNAM/bin/jdr.sh
ln -sf ../usr/share/$PRGNAM/bin/standalone.sh
ln -sf ../usr/share/$PRGNAM/bin/vault.sh
ln -sf ../usr/share/$PRGNAM/bin/wsconsume.sh
ln -sf ../usr/share/$PRGNAM/bin/wsprovide.sh

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh

chown -R root:root $PKG
find -L $PKG \
 \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  -o -perm 511 \) -exec chmod 755 {} \; -o \
 \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
 -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;

chown -R wildfly:wildfly $PKG/var/{lib,log,tmp}/$PRGNAM
chown -R wildfly:wildfly $PKG/etc/$PRGNAM/{standalone,domain}

# Don't overwrite existing configuration:
cd $PKG
for cf in $( find etc/$PRGNAM/ -type f ); do
  chmod -x $cf
  mv $cf $cf.new
  echo "config $cf.new" >> install/doinst.sh
done

/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}