From: Ladislav Slezák Date: Thu, 9 Mar 2017 14:06:38 +0000 (+0100) Subject: Debian: Added snapper.preinst (#332) X-Git-Tag: v0.5.0~5 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=85d7a2c56a4e699e00f516356fa26467d642bad3;p=thirdparty%2Fsnapper.git Debian: Added snapper.preinst (#332) to correctly handle upgrade from the previously broken version --- diff --git a/dists/debian/snapper.preinst b/dists/debian/snapper.preinst new file mode 100644 index 00000000..758f4c33 --- /dev/null +++ b/dists/debian/snapper.preinst @@ -0,0 +1,35 @@ +#!/bin/sh +set -e + +action=$1 +version=$2 + +# This is a cleanup script for removing the fallout of bug +# https://github.com/openSUSE/snapper/issues/328 +# +# Normally the /etc/cron.daily/snapper item should be a file, +# but due to that bug it was a directory for a while. +# +# We need to handle upgrading from the broken package specifically +# and move the cron files to the correct location. +# +# TODO: This script can be removed after some time, it is just needed +# to overcome the temporary upgrade issue. The following package upgrades +# will not need this. + +if [ "$action" = upgrade ]; then + # move /etc/cron.daily/snapper/suse.de-snapper to the correct location + if [ -e /etc/cron.daily/snapper/suse.de-snapper ]; then + mv /etc/cron.daily/snapper/suse.de-snapper /etc/cron.daily/snapper.cron + rm -rf /etc/cron.daily/snapper + mv /etc/cron.daily/snapper.cron /etc/cron.daily/snapper + fi + # move /etc/cron.hourly/snapper/suse.de-snapper to the correct location + if [ -e /etc/cron.hourly/snapper/suse.de-snapper ]; then + mv /etc/cron.hourly/snapper/suse.de-snapper /etc/cron.hourly/snapper.cron + rm -rf /etc/cron.hourly/snapper + mv /etc/cron.hourly/snapper.cron /etc/cron.hourly/snapper + fi +fi + +exit 0