marathon-phoenix-data.SlackBuild 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #!/bin/sh
  2. # Slackware build script for Marathon Phoenix
  3. # Copyright 2016, 2018 Hunter Sezen California, USA
  4. # All rights reserved.
  5. #
  6. # Redistribution and use of this script, with or without modification, is
  7. # permitted provided that the following conditions are met:
  8. #
  9. # 1. Redistributions of this script must retain the above copyright
  10. # notice, this list of conditions and the following disclaimer.
  11. #
  12. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
  13. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  15. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  17. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  18. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  19. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  20. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  21. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. PRGNAM=marathon-phoenix-data
  23. VERSION=${VERSION:-1.3}
  24. BUILD=${BUILD:-1}
  25. TAG=${TAG:-_SBo}
  26. ARCH=noarch
  27. CWD=$(pwd)
  28. TMP=${TMP:-/tmp/SBo}
  29. PKG=$TMP/package-$PRGNAM
  30. OUTPUT=${OUTPUT:-/tmp}
  31. set -eu
  32. # install gamedata in opt instead of usr
  33. if [ "${OPT:-0}" != 0 ]; then
  34. DATA='/opt/AlephOne'
  35. else
  36. DATA='/usr/share/AlephOne/gamedata'
  37. fi
  38. ZIPNAME=Marathon_Phoenix_
  39. ZIPFILE=$ZIPNAME$VERSION.zip
  40. WRAPPER=marathon-phoenix
  41. DATADIR=$PKG$DATA
  42. rm -rf $PKG
  43. mkdir -p $TMP $PKG $OUTPUT $DATADIR
  44. cd $TMP
  45. unzip $CWD/$ZIPFILE -d $DATADIR
  46. chown -R root:root $DATADIR
  47. # NB: the usual find predicate is different (zipfile stores +x permissions
  48. # on some files for no good reason)
  49. find $DATADIR \
  50. \( -type f -exec chmod 644 {} \; \) -o \
  51. \( -type d -exec chmod 755 {} \; \)
  52. # Write launcher script to the user's path
  53. mkdir -p $PKG/usr/games
  54. cat > $PKG/usr/games/$WRAPPER <<EOF
  55. #!/bin/sh
  56. ALEPHONE_DATA="$DATA/Marathon Phoenix"
  57. export ALEPHONE_DATA
  58. exec alephone "\$@"
  59. EOF
  60. find $PKG/usr/games -perm 644 -exec chmod 755 {} \;
  61. # Write a desktop file
  62. mkdir -p $PKG/usr/share/applications
  63. cat > $PKG/usr/share/applications/$WRAPPER.desktop <<EOF
  64. [Desktop Entry]
  65. Name=Marathon Phoenix
  66. Exec=$WRAPPER
  67. Icon=alephone
  68. Type=Application
  69. Comment=Marathon Phoenix (first-person shooter game)
  70. Categories=Game;ActionGame;
  71. EOF
  72. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  73. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  74. mkdir -p $PKG/install
  75. cat $CWD/slack-desc > $PKG/install/slack-desc
  76. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  77. cd $PKG
  78. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}