slackbuilds/n/calibre-web/SlackBuild

88 lines
2.5 KiB
Text
Raw Normal View History

2021-06-15 10:26:26 +02:00
#!/bin/bash
2019-10-05 18:18:37 +02:00
# variables
GITHUB_REPO=janeczku/calibre-web
2022-01-22 10:52:07 +01:00
VERSION=${VERSION:-latest}
2020-02-23 16:58:09 +01:00
RUNNING_USER=${RUNNING_USER:-gwh}
RUNNING_GROUP=${RUNNING_GROUP:-users}
2019-10-05 18:18:37 +02:00
BUILD=${BUILD:-1}
2020-06-25 11:23:11 +02:00
TAG=gwh
2019-10-05 18:18:37 +02:00
TMP=/tmp/$TAG
CWD=$(pwd)
PRGNAM=$(basename $CWD)
PKG=$TMP/pkg-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
ARCH=${ARCH:-$(uname -m)}
REPOSITORY=${REPOSITORY:-/home/installs/SlackBuilds/repositories/$PRGNAM}
PREFIX=${PREFIX:-/usr}
# nettoyage préalable
rm -fr $PKG
mkdir -p $PKG
# mise en place
[ ! -e $REPOSITORY ] && git clone https://github.com/${GITHUB_REPO}.git $REPOSITORY
2021-06-15 10:59:49 +02:00
cd $REPOSITORY
git pull --all
2019-10-05 18:18:37 +02:00
mkdir -p $PKG/opt
cp -r $REPOSITORY $PKG/opt/
2020-12-27 11:50:10 +01:00
rm -fr $PKG/opt/$PRGNAM/{.git*,.editorconfig,.eslintrc}
2020-02-23 16:58:09 +01:00
chown -R ${RUNNING_USER}:${RUNNING_GROUP} $PKG/opt/$PRGNAM
2019-10-05 18:18:37 +02:00
mkdir -p $PKG/etc/rc.d/
cp -r $CWD/rc $PKG/etc/rc.d/rc.$PRGNAM
2020-02-23 16:58:09 +01:00
sed -i "s|RUNNING_USER|$RUNNING_USER|" $PKG/etc/rc.d/rc.$PRGNAM
2019-10-05 18:18:37 +02:00
cd $PKG/opt/$PRGNAM
2022-01-22 10:52:07 +01:00
[ "x$VERSION" == "xlatest" ] && VERSION=$(git for-each-ref --sort=taggerdate --format '%(tag)' | tail -n1)
[ "x$VERSION" == "x" ] && VERSION=trunk
[ "x$VERSION" == "xtrunk" ] && VERSION="git_$(git log -1 --format=%h_%ad --date=format:%Y.%m.%d)" || git checkout $VERSION
2019-10-05 18:18:37 +02:00
# change default password
NEW_DEFAULT_PASSWORD=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo;)
sed -i "s|admin123|$NEW_DEFAULT_PASSWORD|g" cps/*
pip3 install --target vendor -r requirements.txt
# correction
cd $PKG
# embaumement
mkdir -p $PKG/install
2020-02-23 16:58:09 +01:00
# cat <<EOF > $PKG/install/doinst
# chown -R ${RUNNING_USER}:${RUNNING_GROUP} /opt/$PRGNAM
# EOF
2019-10-05 18:18:37 +02:00
cat <<EOF > $PKG/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
$PRGNAM: $PRGNAM (Web app for browsing, reading and downloading eBooks stored in a Calibre database)
$PRGNAM:
$PRGNAM: Calibre-Web is a web app providing a clean interface for browsing,
$PRGNAM: reading and downloading eBooks using an existing Calibre database.
$PRGNAM:
$PRGNAM: default user: admin
$PRGNAM: default password: $NEW_DEFAULT_PASSWORD
$PRGNAM:
$PRGNAM:
$PRGNAM: https://github.com/${GITHUB_REPO}
2019-10-05 18:18:37 +02:00
$PRGNAM:
EOF
# empaquetage
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
2020-07-12 09:22:26 +02:00
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz