diff options
Diffstat (limited to 'games/jfsw_registered_data/jfsw_registered_data.SlackBuild')
-rw-r--r-- | games/jfsw_registered_data/jfsw_registered_data.SlackBuild | 84 |
1 files changed, 60 insertions, 24 deletions
diff --git a/games/jfsw_registered_data/jfsw_registered_data.SlackBuild b/games/jfsw_registered_data/jfsw_registered_data.SlackBuild index 756d31d89c..04dbe21d91 100644 --- a/games/jfsw_registered_data/jfsw_registered_data.SlackBuild +++ b/games/jfsw_registered_data/jfsw_registered_data.SlackBuild @@ -1,21 +1,46 @@ -#!/bin/sh +#!/bin/bash # Slackware build script for jfsw_registered_data -# Written by B. Watson (yalhcru@gmail.com) +# Written by B. Watson (urchlay@slackware.uk) # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. -# This game is offered as a free download on both Steam and GoG. -# It's also been available from www.oldpcgaming.net since 2014. +# This game is offered as a free download on both Steam and GoG. It also +# was available from www.oldpcgaming.net from 2014 to late 2019, and +# has been available on archive.org since late 2018. + +# 20211031 bkw: BUILD=3 +# - use iso-read to extract files from the iso, rather than loop-mounting. +# - CREDITS.TXT => credits.txt. +# - add OGGQUAL option. + +# 20200428 bkw: the old .7z from oldpcgaming.net has vanished along +# with the site. Switched to a CD image from archive.org, in bin/cue +# format. More work for this script to do, but as a nice bonus, we get +# the CD audio tracks installed too. + +cd $(dirname $0) ; CWD=$(pwd) PRGNAM=jfsw_registered_data VERSION=${VERSION:-1.2} -BUILD=${BUILD:-1} +BUILD=${BUILD:-3} TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} + +# Depending on what was used to do the download, the %XX hex escapes +# might get interpreted or not, handle either name. +SRCNAM="Shadow Warrior (USA)" +ZIPNAME1="$SRCNAM.zip" +ZIPNAME2="Shadow%20Warrior%20%28USA%29.zip" ARCH=noarch -CWD=$(pwd) + +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} @@ -28,31 +53,42 @@ cd $TMP rm -rf $PRGNAM-$VERSION mkdir -p $PRGNAM-$VERSION cd $PRGNAM-$VERSION -7za x $CWD/shadow.7z '*/*.GRP' '*/*.TXT' '*/*.ICO' -cd shadow + +[ -e "$CWD/$ZIPNAME1" ] && ZIPNAME="$ZIPNAME1" || ZIPNAME="$ZIPNAME2" +unzip "$CWD/$ZIPNAME" chown -R root:root . -find -L . \ - \( -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 {} \+ +chmod 644 * + +# The "source" file is a bin/cue cdrom image with multiple .bin files. +# It took some effort to get bchunk to extract this correctly, and I've +# moved the code into a separate script so that users of other distros +# can possibly make use of it. In fact it's been tested on MacOSX :) +sh $CWD/extract-shadow-warrior.sh "$SRCNAM.cue" + +GAMEDIR=$PKG/usr/share/games/jfsw +PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION +mkdir -p $GAMEDIR $PKGDOC + +# We just extracted an iso image, now extract files from it. +# Rather than loop-mounting the iso to extract the files, use +# iso-read (part of Slackware's libcdio package). +iso-read -i track01.iso -e swinst/sw.grp -o $GAMEDIR/sw_registered.grp +iso-read -i track01.iso -e swinst/credits.txt -o $PKGDOC/credits.txt +iso-read -i track01.iso -e swinst/license.txt -o $PKGDOC/license.txt +iso-read -i track01.iso -e sw.ico -o $PKGDOC/sw.ico -mkdir -p $PKG/usr/share/games/jfsw -install -m0644 SW.GRP $PKG/usr/share/games/jfsw/sw_registered.grp +chmod 644 $PKGDOC/* +sed -i 's,\r,,' $PKGDOC/*.txt -# This stuff's not very relevant to a source port. -rm -f INSTALL.TXT ORDERFRM.TXT +# Done with the iso, now for the audio tracks (which have already been +# converted to ogg). +cp track??.ogg $GAMEDIR -mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION -for i in *.TXT; do - sed 's,\r,,' < $i > $PKG/usr/doc/$PRGNAM-$VERSION/$( echo $i | tr A-Z a-z ) -done -cat SW.ICO > $PKG/usr/doc/$PRGNAM-$VERSION/sw.ico -cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild +cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild 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} +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE |