gallery.SlackBuild 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #!/bin/bash
  2. # Slackware Package Build Script for gallery3
  3. # Home Page http://galleryproject.org
  4. # Copyright (c) 2009-2013, Nishant Limbachia, Hoffman Estates, IL, USA
  5. # (nishant _AT_ mnspace _DOT_ net)
  6. # All rights reserved.
  7. #
  8. # Redistribution and use of this script, with or without modification, is
  9. # permitted provided that the following conditions are met:
  10. #
  11. # 1. Redistributions of script must retain the above copyright notice,
  12. # this list of conditions and the following disclaimer.
  13. #
  14. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  15. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  16. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  17. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  18. # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  19. # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  20. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  21. # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  22. # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  23. # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  24. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. cd $(dirname $0) ; CWD=$(pwd)
  26. PRGNAM="gallery"
  27. VERSION=${VERSION:-3.0.9}
  28. BUILD=${BUILD:-1}
  29. TAG=${TAG:-_SBo}
  30. PKGTYPE=${PKGTYPE:-tgz}
  31. ARCH=noarch # hardcode ARCH
  32. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  33. # the name of the created package would be, and then exit. This information
  34. # could be useful to other scripts.
  35. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  36. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  37. exit 0
  38. fi
  39. TMP=${TMP:-/tmp/SBo}
  40. PKG=$TMP/package-$PRGNAM
  41. OUTPUT=${OUTPUT:-/tmp}
  42. set -e
  43. ### set the document root
  44. DOCROOT=${DOCROOT:-/var/www/htdocs}
  45. # define BASEDIR, default is gallery.
  46. # this actually controls your url, default will create following url
  47. # www.example.com/gallery/
  48. BASEDIR=${BASEDIR:-gallery}
  49. ### define web user and group
  50. WEBUSER=${WEBUSER:-root}
  51. WEBGROUP=${WEBGROUP:-apache}
  52. rm -fr $TMP/$PRGNAM $PKG
  53. mkdir -p $TMP $PKG $OUTPUT
  54. cd $TMP
  55. unzip $CWD/$PRGNAM-$VERSION.zip
  56. mv gallery3 $PRGNAM
  57. chown -R root:root $PRGNAM
  58. find $PRGNAM \
  59. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 -o -perm 755 \) \
  60. -exec chmod 750 {} \; -o \
  61. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 -o -perm 644 \) \
  62. -exec chmod 640 {} \;
  63. mkdir -p $PKG/$DOCROOT
  64. cp -a $PRGNAM $PKG/$DOCROOT/$BASEDIR
  65. # move important files to .new
  66. mv $PKG/$DOCROOT/$BASEDIR/.htaccess $PKG/$DOCROOT/$BASEDIR/.htaccess.new
  67. mv $PKG/$DOCROOT/$BASEDIR/index.php $PKG/$DOCROOT/$BASEDIR/index.php.new
  68. mv $PKG/$DOCROOT/$BASEDIR/php.ini $PKG/$DOCROOT/$BASEDIR/php.ini.new
  69. mv $PKG/$DOCROOT/$BASEDIR/robots.txt $PKG/$DOCROOT/$BASEDIR/robots.txt.new
  70. # install docs
  71. install -m 0644 -D $TMP/$PRGNAM/README $PKG/usr/doc/$PRGNAM-$VERSION/README
  72. install -m 0644 -D $TMP/$PRGNAM/LICENSE $PKG/usr/doc/$PRGNAM-$VERSION/LICENSE
  73. install -m 0644 -D $CWD/README-ONLINE $PKG/usr/doc/$PRGNAM-$VERSION/README-ONLINE
  74. # Change ownership and perms
  75. chown -R $WEBUSER:$WEBGROUP $PKG/$DOCROOT/$BASEDIR
  76. chmod 0750 $PKG/$DOCROOT/$BASEDIR
  77. GALLERY_INSTALL="$DOCROOT/$BASEDIR"
  78. mkdir -p $PKG/install
  79. cat $CWD/slack-desc > $PKG/install/slack-desc
  80. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  81. sed -i "s|@GALLERY_INSTALL@|$(echo ${GALLERY_INSTALL} | sed s:/::)|g" $PKG/install/doinst.sh
  82. sed -i "s|@WEBUSER@|${WEBUSER}|" $PKG/install/doinst.sh
  83. sed -i "s|@WEBGROUP@|${WEBGROUP}|" $PKG/install/doinst.sh
  84. cd $PKG
  85. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE