Move "data" and "var" directories to /var/lib/wallabag/

This commit is contained in:
Dmitriy Bogdanov 2016-10-19 17:35:20 +04:00
parent 61fd0bd1e7
commit 4dc334c2fe
No known key found for this signature in database
GPG key ID: F396CC2653B8F64D
3 changed files with 30 additions and 11 deletions

View file

@ -16,6 +16,8 @@ pkgbase = wallabag
options = !strip options = !strip
backup = etc/webapps/wallabag/parameters.yml backup = etc/webapps/wallabag/parameters.yml
backup = usr/share/webapps/wallabag/parameters.yml backup = usr/share/webapps/wallabag/parameters.yml
backup = var/lib/wallabag/data/db/wallabag.sqlite
backup = usr/share/webapps/wallabag/data/db/wallabag.sqlite
source = wallabag.tar.xz::http://wllbg.org/latest-v2-package source = wallabag.tar.xz::http://wllbg.org/latest-v2-package
sha256sums = f3acfde5a945bcd0a65f2549fc2f577bc6fc633ba901df27e7dc88c07feb2406 sha256sums = f3acfde5a945bcd0a65f2549fc2f577bc6fc633ba901df27e7dc88c07feb2406

View file

@ -23,7 +23,9 @@ options=(!strip)
source=("${pkgname}.tar.xz::http://wllbg.org/latest-v2-package") source=("${pkgname}.tar.xz::http://wllbg.org/latest-v2-package")
sha256sums=('f3acfde5a945bcd0a65f2549fc2f577bc6fc633ba901df27e7dc88c07feb2406') sha256sums=('f3acfde5a945bcd0a65f2549fc2f577bc6fc633ba901df27e7dc88c07feb2406')
backup=("etc/webapps/${pkgname}/parameters.yml" backup=("etc/webapps/${pkgname}/parameters.yml"
"usr/share/webapps/${pkgname}/parameters.yml") "usr/share/webapps/${pkgname}/parameters.yml"
"var/lib/${pkgname}/data/db/wallabag.sqlite"
"usr/share/webapps/${pkgname}/data/db/wallabag.sqlite")
package() { package() {
cd "${pkgdir}" cd "${pkgdir}"
@ -37,5 +39,11 @@ package() {
chown -R http:http ${pkgdir}/etc/webapps/${pkgname} chown -R http:http ${pkgdir}/etc/webapps/${pkgname}
ln -s /etc/webapps/${pkgname}/parameters.yml "${WALLABAG_CONF_DIR}"/ ln -s /etc/webapps/${pkgname}/parameters.yml "${WALLABAG_CONF_DIR}"/
chown -R http:http "${pkgdir}/usr/share/webapps/wallabag" _VAR_DIR="${pkgdir}/var/lib/${pkgname}/"
install -d "$_VAR_DIR"
mv "${pkgdir}/usr/share/webapps/${pkgname}/"{data,var} "$_VAR_DIR"
ln -s "/var/lib/${pkgname}/"{data,var} "${pkgdir}/usr/share/webapps/${pkgname}/"
chown -R http:http "$_VAR_DIR"
chown -R http:http "${pkgdir}/usr/share/webapps/${pkgname}"
} }

View file

@ -22,8 +22,17 @@ pre_upgrade() {
/usr/share/webapps/wallabag/app/config/parameters.yml \ /usr/share/webapps/wallabag/app/config/parameters.yml \
-t /etc/webapps/wallabag/ -t /etc/webapps/wallabag/
fi fi
# also move `data` and `var` to /var/lib/wallabag/
if [[ -d /usr/share/webapps/wallabag/data && \
! -h /usr/share/webapps/wallabag/data && \
-d /usr/share/webapps/wallabag/var && \
! -h /usr/share/webapps/wallabag/var ]]; then
install -d /var/lib/wallabag/
chown http:http /var/lib/wallabag/
mv /usr/share/webapps/wallabag/{data,var} /var/lib/wallabag/
fi
} }
post_upgrade() { post_upgrade() {
rm -rf /usr/share/webapps/wallabag/var/cache/* rm -rf /var/lib/wallabag/var/cache/*
} }