Tempus-Irae.SlackBuild 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #!/bin/sh
  2. # Slackware build script for Tempus Irae
  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=Tempus-Irae
  23. VERSION=${VERSION:-1.1}
  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=$(printf %s $PRGNAM | tr - _)
  39. ZIPFILE=$ZIPNAME.zip
  40. WRAPPER=$(printf %s $PRGNAM | tr 'A-Z' 'a-z')
  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. if [ -f $CWD/Tempus_Premium_Landscapes.zip ]; then
  47. unzip $CWD/Tempus_Premium_Landscapes.zip -d $DATADIR
  48. cp -a $DATADIR/Tempus_Premium_Landscapes/* $DATADIR/$ZIPNAME
  49. rm -r $DATADIR/Tempus_Premium_Landscapes
  50. fi
  51. chown -R root:root $DATADIR
  52. # NB: the usual find predicate is different (zipfile stores +x permissions
  53. # on some files for no good reason)
  54. find $DATADIR \
  55. \( -type f -exec chmod 644 {} \; \) -o \
  56. \( -type d -exec chmod 755 {} \; \)
  57. # Write launcher script to the user's path
  58. mkdir -p $PKG/usr/games
  59. cat > $PKG/usr/games/$WRAPPER <<EOF
  60. #!/bin/sh
  61. ALEPHONE_DATA="$DATA/$ZIPNAME"
  62. export ALEPHONE_DATA
  63. exec alephone "\$@"
  64. EOF
  65. find $PKG/usr/games -perm 644 -exec chmod 755 {} \;
  66. # Write a desktop file
  67. mkdir -p $PKG/usr/share/applications
  68. cat > $PKG/usr/share/applications/$WRAPPER.desktop <<EOF
  69. [Desktop Entry]
  70. Name=$(printf %s $PRGNAM | tr - " ")
  71. Exec=$WRAPPER
  72. Icon=alephone
  73. Type=Application
  74. Comment=$(printf %s $PRGNAM | tr - " ") (first-person shooter game)
  75. Categories=Game;ActionGame;
  76. EOF
  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}