From 2fcaacdb24f30a7de4e2395fc66ef604e3053501 Mon Sep 17 00:00:00 2001 From: Cedric Girard Date: Sun, 1 Dec 2019 14:45:34 +0100 Subject: [PATCH] upgpkg: freshrss 1.15.3-2 relocate datadir --- freshrss/.SRCINFO | 2 +- freshrss/PKGBUILD | 20 +++++++++++++++++++- freshrss/freshrss.install | 15 +++++++++++++-- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/freshrss/.SRCINFO b/freshrss/.SRCINFO index 24e93e4..c0ebfe8 100644 --- a/freshrss/.SRCINFO +++ b/freshrss/.SRCINFO @@ -1,7 +1,7 @@ pkgbase = freshrss pkgdesc = A free, self-hostable aggregator… pkgver = 1.15.3 - pkgrel = 1 + pkgrel = 2 url = http://freshrss.org/ install = freshrss.install arch = any diff --git a/freshrss/PKGBUILD b/freshrss/PKGBUILD index 72cc2c8..1346677 100644 --- a/freshrss/PKGBUILD +++ b/freshrss/PKGBUILD @@ -2,7 +2,7 @@ pkgname=freshrss pkgver=1.15.3 -pkgrel=1 +pkgrel=2 pkgdesc='A free, self-hostable aggregator…' arch=('any') url='http://freshrss.org/' @@ -18,10 +18,28 @@ install="$pkgname.install" source=("https://github.com/FreshRSS/FreshRSS/archive/$pkgver.tar.gz") sha256sums=('c6d1b392ed85ef8eab132634ff1199fad1a274df5892e29c0793cabc6668eb55') + +prepare(){ + cd "${srcdir}/FreshRSS-$pkgver" + sed -i "s!FRESHRSS_PATH . '/data'!'/var/lib/webapps/freshrss/data'!" constants.php + +} + + package() { cd "${srcdir}/FreshRSS-$pkgver" install -d "$pkgdir/usr/share/webapps/freshrss" cp -r . "$pkgdir/usr/share/webapps/freshrss/" + + #do some cleanup + find "$pkgdir/usr/share/webapps/freshrss" -name '.git*' -exec rm -rf {} \; || true + rm -rf "$pkgdir/usr/share/webapps/freshrss/Docker" + rm -rf "$pkgdir/usr/share/webapps/freshrss/tests" + + + #new location for datadir + install -dm 700 "$pkgdir/var/lib/webapps/freshrss" + mv "$pkgdir/usr/share/webapps/freshrss/data" "$pkgdir/var/lib/webapps/freshrss/data" } # vim:set ts=2 sw=2 et: diff --git a/freshrss/freshrss.install b/freshrss/freshrss.install index a0ed48c..17b5494 100644 --- a/freshrss/freshrss.install +++ b/freshrss/freshrss.install @@ -1,9 +1,20 @@ post_install() { - # Make data writable by webserver - chown -R http:http /usr/share/webapps/freshrss/data + chown -R http:http /var/lib/webapps/freshrss echo 'You can now configure your (PHP compatible) web server to run FreshRSS' } +pre_upgrade() { + # Move data dir to new location if needed + if [ ! -L /usr/share/webapps/freshrss/data ] ; then + # dir not yet symlinked + install -dm 700 /var/lib/webapps/freshrss + mv /usr/share/webapps/freshrss/data /var/lib/webapps/freshrss/data + chown -R http:http /var/lib/webapps/freshrss + + echo 'Datadir has been automatically moved to /var/lib/webapps/freshrss/data' + fi +} + post_upgrade() { post_install }