summaryrefslogtreecommitdiffstats
path: root/games/fortune_doctor_who/fortune_doctor_who.SlackBuild
blob: 3dd56d97a62c404ed3051bdefc17c29e0567a2ba (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
#!/bin/sh

# Slackware build script for fortune_doctor_who

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

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

PRGNAM=fortune_doctor_who
VERSION=${VERSION:-20200923}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

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

ARCH=noarch

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
mkdir -p $PRGNAM-$VERSION
cd $PRGNAM-$VERSION

mkdir -p $PKG/usr/share/games/fortunes

# Upstream's files are zipped fortune files, except they have a trailing %
# as the last line, and some (but not all) have DOS-style CRLF endings.
# The "fmt -s" splits long lines (which is at least a start at de-uglifying
# the formatting). Someone really needs to manually clean it up, maybe I will
# someday.
for i in 01-08 09 10 11 12 13; do
  unzip $CWD/Doctor_Who$i-quotes.zip
  sed 's/\r//' Doctor_Who$i.txt | fmt -s >> $PKG/usr/share/games/fortunes/doctor_who
done

# Get rid of trailing % from last file (to avoid an empty fortune).
sed -i '$d' $PKG/usr/share/games/fortunes/doctor_who

( cd $PKG/usr/share/games/fortunes && strfile doctor_who )

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$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:-tgz}