summaryrefslogtreecommitdiffstats
path: root/games/fortune-slackware/fortune-slackware.SlackBuild
blob: 9de3e2473c1ae1184d3babff81099871ed3986e7 (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
#!/bin/bash

# Slackware build script for fortune-slackware

# Written by B. Watson (yalhcru@gmail.com)

# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.

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

PRGNAM=fortune-slackware
VERSION=${VERSION:-1.15}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
ARCH=noarch

if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  exit 0
fi

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

# Package is named like all the other fortune-* ones for consistency.
SRCNAM=slack-fortunes-all

# Where the fortune end up installing to.
FDIR=$PKG/usr/share/games/fortunes

set -e

rm -rf $PKG
mkdir -p $TMP $FDIR $OUTPUT
cd $TMP
# no top-level dir in the tarball!
rm -rf $PRGNAM-$VERSION
mkdir -p $PRGNAM-$VERSION
cd $PRGNAM-$VERSION
tar xvf $CWD/$SRCNAM-$VERSION.tgz
chown -R root:root .
find -L .  -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
        \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+

# There's 15 fortune files in the source, combine them all into one.

# Patch fixes the mess caused by some files starting with a % line,
# some having blank line(s) after the last % line, some having two %
# lines in a row, and the last file should NOT have a % line at the end.
patch -p1 < $CWD/formatting.diff

cat slack-fortunes-vol-? slack-fortunes-vol-?? > $FDIR/slackware
strfile $FDIR/slackware

DOCDIR=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $DOCDIR
cat $CWD/README > $DOCDIR/README
cat $CWD/$PRGNAM.SlackBuild > $DOCDIR/$PRGNAM.SlackBuild

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

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