marathon-eternal-data.SlackBuild 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #!/bin/sh
  2. # Slackware build script for Marathon Eternal X
  3. # Copyright 2015, 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-eternal-data
  23. VERSION=${VERSION:-1.1.0}
  24. SRCVER=$(printf %s "$VERSION" | tr -d .)
  25. BUILD=${BUILD:-2}
  26. TAG=${TAG:-_SBo}
  27. ARCH=noarch
  28. CWD=$(pwd)
  29. TMP=${TMP:-/tmp/SBo}
  30. PKG=$TMP/package-$PRGNAM
  31. OUTPUT=${OUTPUT:-/tmp}
  32. set -eu
  33. # install gamedata in opt instead of usr
  34. if [ "${OPT:-0}" != 0 ]; then
  35. DATA='/opt/AlephOne'
  36. else
  37. DATA='/usr/share/AlephOne/gamedata'
  38. fi
  39. ZIPNAME=EternalX
  40. ZIPFILE=${ZIPNAME}v${SRCVER}Full.zip
  41. WRAPPER=marathon-eternal
  42. DATADIR=$PKG$DATA
  43. rm -rf $PKG
  44. mkdir -p $TMP $PKG $OUTPUT $DATADIR
  45. cd $TMP
  46. unzip $CWD/$ZIPFILE -d $DATADIR
  47. chown -R root:root $DATADIR
  48. # NB: the usual find predicate is different (zipfile stores +x permissions
  49. # on some files for no good reason)
  50. find $DATADIR \
  51. \( -type f -exec chmod 644 {} \; \) -o \
  52. \( -type d -exec chmod 755 {} \; \)
  53. # Write launcher script to the user's path
  54. mkdir -p $PKG/usr/games
  55. cat > $PKG/usr/games/$WRAPPER <<EOF
  56. #!/bin/sh
  57. ALEPHONE_DATA="$DATA/Eternal $VERSION"
  58. export ALEPHONE_DATA
  59. exec alephone "\$@"
  60. EOF
  61. find $PKG/usr/games -perm 644 -exec chmod 755 {} \;
  62. # Write a desktop file
  63. mkdir -p $PKG/usr/share/applications
  64. cat > $PKG/usr/share/applications/$WRAPPER.desktop <<EOF
  65. [Desktop Entry]
  66. Name=Marathon Eternal X
  67. Exec=$WRAPPER
  68. Icon=alephone
  69. Type=Application
  70. Comment=Marathon Eternal X (first-person shooter game)
  71. Categories=Game;ActionGame;
  72. EOF
  73. # Don't want this
  74. rm -rf $DATADIR/__MACOSX
  75. # Remove unneeded hidden files
  76. find $DATADIR -name ".[^.]*" -mindepth 1 -print0 | xargs -0r rm -rf
  77. # Fix windows formatted scripts
  78. set -- $DATADIR/*/Scripts/*
  79. for script do
  80. tr '\r' '\n' < "$script" > "$script-tmp"
  81. mv -- "$script-tmp" "$script"
  82. done
  83. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  84. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  85. mkdir -p $PKG/install
  86. cat $CWD/slack-desc > $PKG/install/slack-desc
  87. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  88. cd $PKG
  89. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}