Skip to content
This repository has been archived by the owner on Oct 9, 2018. It is now read-only.

Commit

Permalink
agendav: Use pre_upgrade to save configs.
Browse files Browse the repository at this point in the history
  • Loading branch information
The-Compiler committed Jun 3, 2015
1 parent f5af712 commit fe33593
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
5 changes: 1 addition & 4 deletions agendav/PKGBUILD
Expand Up @@ -15,10 +15,7 @@ depends=('php')
# those file up every time...
backup=("etc/webapps/agendav/config.php"
"etc/webapps/agendav/caldav.php"
"etc/webapps/agendav/database.php"
"usr/share/webapps/agendav/web/config/config.php"
"usr/share/webapps/agendav/web/config/caldav.php"
"usr/share/webapps/agendav/web/config/database.php")
"etc/webapps/agendav/database.php")
source=($pkgname-$pkgver.tar.gz::https://github.com/adobo/${pkgname}/archive/${pkgver}.tar.gz
nginx.example.conf
apache.example.conf)
Expand Down
26 changes: 15 additions & 11 deletions agendav/agendav.install
Expand Up @@ -2,15 +2,19 @@ post_install() {
echo "Check http://wiki.archlinux.org/index.php/AgenDAV for details."
}

post_upgrade() {
echo "Since pkgrel -3, the incorrect symlinking of config files in this "
echo "package has been fixed. This however means pacman will install "
echo "the correct files as /etc/webapps/agendav/*.php.pacnew and leave a "
echo "broken symlink as *.php. This means AgenDAV will report no config "
echo "has been found."
echo
echo "Your existing config files should have been backed up in "
echo "/usr/share/webapps/agendav/config/web/*.php.pacbak. This means you "
echo "can probably fix things up by running this now:"
echo "FIXME"
pre_upgrade() {
## Fix mess caused by the old package which had the symlinks the wrong way
## around, so the user's config doesn't get lost...
for f in config.php caldav.php database.php; do
if [[ -h "/etc/webapps/agendav/$f" ]]; then
echo
echo "==> Fixing broken $f symlink from old package..."
# remove symlink first
echo "rm /etc/webapps/agendav/$f"
rm "/etc/webapps/agendav/$f"
# now move the real file (with the user's config) to /etc
echo "mv /usr/share/webapps/agendav/web/config/$f /etc/webapps/agendav"
mv "/usr/share/webapps/agendav/web/config/$f" /etc/webapps/agendav
fi
done
}

0 comments on commit fe33593

Please sign in to comment.