summaryrefslogtreecommitdiff
path: root/network/glassfish/glassfish.SlackBuild
blob: ec9d5d3b25d5e91a2c850be39101ef0a95e6f90a (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
#!/bin/sh

# Slackware build script for glassfish

# Written by crocket (crockabiscuit@gmail.com)

PRGNAM=glassfish
VERSION=${VERSION:-3.1.2}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

MAJORVER=$(echo $VERSION | cut -d. -f1)

ARCH=noarch

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

set -e

# Bail out if user or group isn't valid on your system
# For slackbuilds.org, assigned glassfish uid/gid are 263/263
# See http://slackbuilds.org/uid_gid.txt
if ! getent group glassfish 2>&1 > /dev/null; then
    echo "  You must have a \"glassfish\" group to run this script."
    echo "    # groupadd -g 263 glassfish"
    exit 1
elif ! getent passwd glassfish 2>&1 > /dev/null; then
    echo "  You must have a \"glassfish\" user to run this script."
    echo "    # useradd -u 263 -g glassfish -d /var/lib/glassfish -s /bin/false glassfish"
    exit 1
fi

rm -rf $PKG
mkdir -p $PKG $OUTPUT

mkdir -p $PKG/opt
unzip $CWD/$PRGNAM-$VERSION-ml.zip -d $PKG/opt

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
unzip $CWD/$PRGNAM-ose-$VERSION-docs-pdf.zip -d $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

mkdir -p $PKG/usr/bin
sed "s/%APPNAME%/$PRGNAM$MAJORVER/" $CWD/asadmin > $PKG/usr/bin/asadmin
chmod +x $PKG/usr/bin/asadmin

mkdir -p $PKG/etc/rc.d
cat $CWD/rc.glassfish > $PKG/etc/rc.d/rc.glassfish.new

mkdir -p $PKG/var/lib/$PRGNAM

chown -R root:root $PKG
chown -R glassfish:glassfish $PKG/opt/$PRGNAM$MAJORVER $PKG/var/lib/$PRGNAM

find $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 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
 -exec chmod 644 {} \;

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

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