2021-06-15 10:26:26 +02:00
|
|
|
#!/bin/bash
|
2019-10-05 18:18:37 +02:00
|
|
|
|
|
|
|
# variables
|
2021-09-23 15:52:55 +02:00
|
|
|
GITHUB_REPO=janeczku/calibre-web
|
2022-01-22 10:52:07 +01:00
|
|
|
VERSION=${VERSION:-latest}
|
2022-07-11 15:39:38 +02:00
|
|
|
BUILD=${BUILD:-2}
|
2021-09-23 15:52:55 +02:00
|
|
|
|
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
|
|
|
|
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)}
|
|
|
|
|
2024-11-18 09:55:36 +01:00
|
|
|
REPOSITORY=${REPOSITORY:-/var/cache/SlackBuilds.gwh/$PRGNAM}
|
2019-10-05 18:18:37 +02:00
|
|
|
PREFIX=${PREFIX:-/usr}
|
|
|
|
|
|
|
|
# nettoyage préalable
|
|
|
|
rm -fr $PKG
|
|
|
|
|
|
|
|
mkdir -p $PKG
|
|
|
|
|
|
|
|
# mise en place
|
2021-09-23 15:52:55 +02:00
|
|
|
[ ! -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/
|
2022-07-11 14:35:43 +02:00
|
|
|
cd $PKG/opt/$PRGNAM
|
|
|
|
|
|
|
|
case $VERSION in
|
|
|
|
trunk)
|
2023-03-23 09:54:21 +01:00
|
|
|
VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)"
|
2022-07-11 14:35:43 +02:00
|
|
|
;;
|
|
|
|
latest)
|
2024-05-27 07:53:51 +02:00
|
|
|
VERSION=$(git tag --sort=-version:refname | head -n1)
|
2022-07-11 14:35:43 +02:00
|
|
|
git checkout $VERSION
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
git checkout $VERSION
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
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
|
|
|
|
|
|
|
# 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/*
|
2022-07-11 15:39:38 +02:00
|
|
|
pip3 install --target vendor -r requirements.txt -r optional-requirements.txt
|
2019-10-05 18:18:37 +02:00
|
|
|
|
|
|
|
# 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:
|
2021-09-23 15:52:55 +02:00
|
|
|
$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
|
2023-08-16 12:23:26 +02:00
|
|
|
/sbin/makepkg --linkadd y --chown n --prepend $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz
|