package-bookstack/PKGBUILD

64 lines
2.6 KiB
Bash

# Maintainer: Luke T. Shumaker <lukeshu@umorpha.io>
# Maintainer (AUR): Martin Rys <rys.pw/contact>
_pkgname=BookStack
pkgname=${_pkgname,,}
pkgver=23.10.2
pkgrel=2
pkgdesc='A simple, self-hosted, easy-to-use platform for organising and storing information'
arch=('any')
url="https://www.bookstackapp.com/"
license=('MIT')
depends=(
'php'
'php-gd'
)
makedepends=('composer')
source=(
"$_pkgname-$pkgver.tar.gz::https://github.com/BookStackApp/BookStack/archive/v${pkgver}.tar.gz"
'sysusers.conf'
'tmpfiles.conf'
)
sha256sums=('77720d16b42975d1bfbb013b7211f6574a087ffd0535f34594e7e588574b3f6a'
'a02c8ec9ee267a528abbac2337f1f79ca8b9fc3629df9cd443d16c94c21a68ce'
'e1b14c99efbbd14b446d111cbdcb25c357e4df7b16d5c1b509f1124246b5a803')
options=('!strip') # FIXME(lukeshu): stripping hangs, idk why
backup=("etc/webapps/$pkgname/config.env")
package() {
cd "$srcdir/$_pkgname-$pkgver"
# Download dependencies
# FIXME(lukeshu): Do this earlier
COMPOSER_ALLOW_SUPERUSER=1 composer install --no-dev --ignore-platform-reqs --no-interaction
# The main install
mkdir -p "$pkgdir/usr/share/webapps/$pkgname"
cp -r -t "$pkgdir/usr/share/webapps/$pkgname" -- * .env.example*
# License
mkdir -p "$pkgdir/usr/share/licenses/$pkgname"
ln -sr "$pkgdir/usr/share/webapps/$pkgname/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
# Config
mkdir -p "$pkgdir/etc/webapps/$pkgname"
ln -sr "$pkgdir/usr/share/webapps/$pkgname/.env.example" "$pkgdir/etc/webapps/$pkgname/config.env.example"
ln -sr "$pkgdir/usr/share/webapps/$pkgname/.env.example.complete" "$pkgdir/etc/webapps/$pkgname/config.env.example.complete"
ln -sr "$pkgdir/etc/webapps/$pkgname/config.env" "$pkgdir/usr/share/webapps/$pkgname/.env"
# Move the 3 mutable directories
# https://www.bookstackapp.com/docs/admin/filesystem-permissions/
mkdir -p "$pkgdir/var/cache"
mv -T "$pkgdir/usr/share/webapps/$pkgname/bootstrap/cache" "$pkgdir/var/cache/$pkgname"
ln -sr "$pkgdir/var/cache/$pkgname" "$pkgdir/usr/share/webapps/$pkgname/bootstrap/cache"
mkdir -p "$pkgdir/var/lib/$pkgname"
mv -T "$pkgdir/usr/share/webapps/$pkgname/storage" "$pkgdir/var/lib/$pkgname/storage"
ln -sr "$pkgdir/var/lib/$pkgname/storage" "$pkgdir/usr/share/webapps/$pkgname/storage"
mv -T "$pkgdir/usr/share/webapps/$pkgname/public/uploads" "$pkgdir/var/lib/$pkgname/uploads"
ln -sr "$pkgdir/var/lib/$pkgname/uploads" "$pkgdir/usr/share/webapps/$pkgname/public/uploads"
# Set the permissions on the config and those 3 directories
install -Dm644 "${srcdir}/sysusers.conf" "${pkgdir}/usr/lib/sysusers.d/$pkgname.conf"
install -Dm644 "${srcdir}/tmpfiles.conf" "${pkgdir}/usr/lib/tmpfiles.d/$pkgname.conf"
}