slackbuilds/n/kriss_feed/SlackBuild
Gwenhael Le Moine 08e1933350
kriss_feed
2018-03-14 10:20:10 +01:00

75 lines
2 KiB
Bash
Executable file

#!/bin/sh
CWD=$(pwd)
PRGNAM=$(basename $CWD)
ARCH="noarch" # hardcode ARCH
BUILD=${BUILD:-1}
TAG=${TAG:-cyco}
VHOST=${VHOST:-vhosts/$PRGNAM/}
VHOSTROOT=/var/www/${VHOST}
DOCROOT=${DOCROOT:-/var/www/${VHOST}htdocs}
PHPUSER=${PHPUSER:-apache}
PHPGROUP=${PHPGROUP:-apache}
TMP=${TMP:-/tmp/$TAG}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
set -eu
rm -rf $PKG
mkdir -p $TMP $OUTPUT $PKG/$VHOSTROOT
REPOSITORY=/home/installs/SlackBuilds/repositories/$PRGNAM
[ ! -e $REPOSITORY ] && git clone https://github.com/tontof/kriss_feed $REPOSITORY
( cd $REPOSITORY
git pull )
VERSION="$( cd $REPOSITORY && git log -1 --format=%h_%ad --date=format:%Y.%m.%d )"
[ ! -e $CWD/user.css ] && wget -c https://raw.githubusercontent.com/tontof/kriss_feed/master/style/orangina-rouge/user.css -O $CWD/user.css
mkdir -p $PKG/usr/doc/
cp -R $REPOSITORY $PKG/usr/doc/$PRGNAM
rm -fr $PKG/usr/doc/$PRGNAM/.git
find $PKG/usr/doc/$PRGNAM -name .git\* -exec rm -fr {} \;
mkdir -p $PKG/$DOCROOT
cp $PKG/usr/doc/$PRGNAM/src/index.php $PKG/$DOCROOT
mkdir -p $PKG/$DOCROOT/inc
cp $CWD/user.css $PKG/$DOCROOT/inc/
cd $PKG/$VHOSTROOT/htdocs
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 -o -perm 755 \) \
-exec chmod 750 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 -o -perm 644 \) \
-exec chmod 640 {} \;
# Change ownership and perms and create a link.
chown -R $PHPUSER:$PHPGROUP $PKG/$DOCROOT
chmod 0750 $PKG/$DOCROOT
mkdir -p $PKG/install
cat <<EOF > $PKG/install/slack-desc
$PRGNAM: $PRGNAM (A simple and smart (or stupid) feed reader)
$PRGNAM:
$PRGNAM: A simple and smart (or stupid) feed reader.
$PRGNAM: An example is available on tontof.net.
$PRGNAM: This is an alternative to Google Reader or other RSS feed readers:
$PRGNAM: It does not require SQL or database.
$PRGNAM: It works with PHP 5.2
$PRGNAM:
$PRGNAM:
$PRGNAM: http://tontof.net/kriss/feed
$PRGNAM:
EOF
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo $VERSION | tr - _)-$ARCH-$BUILD$TAG.${PKGTYPE:-txz}