dist/debian: refuse upgrade if current scylla < 1.7.3 && commitlog remains

Commitlog replay fails when upgrade from <1.7.3 to 2.0, we need to refuse
updating package if current scylla < 1.7.3 && commitlog remains.

Note: We have the problem on scylla-server package, but to prevent
scylla-conf package upgrade, %pretrans should be define on scylla-conf.

Fixes #2551

Signed-off-by: Takuya ASADA <syuu@scylladb.com>
Message-Id: <1501187555-4629-1-git-send-email-syuu@scylladb.com>
This commit is contained in:
Takuya ASADA
2017-07-28 05:32:35 +09:00
committed by Avi Kivity
parent e5d2e28df9
commit 714540cd4c
2 changed files with 30 additions and 0 deletions

View File

@@ -135,6 +135,8 @@ sed -i -e "s/@@CODENAME@@/$TARGET/g" debian/changelog
cp dist/debian/rules.in debian/rules
cp dist/debian/control.in debian/control
cp dist/debian/scylla-server.install.in debian/scylla-server.install
cp dist/debian/scylla-conf.preinst.in debian/scylla-conf.preinst
sed -i -e "s/@@VERSION@@/$SCYLLA_VERSION/g" debian/scylla-conf.preinst
if [ "$TARGET" = "jessie" ]; then
cp dist/debian/scylla-server.cron.d debian/
sed -i -e "s/@@REVISION@@/1/g" debian/changelog

28
dist/debian/scylla-conf.preinst.in vendored Normal file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
ver=$(dpkg -l|grep scylla-server|awk '{print $3}'|sed -e "s/-.*$//")
if [ -n "$ver" ]; then
ver_fmt=$(echo $ver | awk -F. '{printf "%d%02d%02d", $1,$2,$3}')
if [ $ver_fmt -lt 10703 ]; then
# for <scylla-1.2
if [ ! -f /usr/lib/scylla/scylla_config_get.py ]; then
echo
echo "Error: Upgrading from scylla-$ver to scylla-@@VERSION@@ is not supported."
echo "Please upgrade to scylla-1.7.3 or later, before upgrade to @@VERSION@@."
echo
exit 1
fi
commitlog_directory=$(/usr/lib/scylla/scylla_config_get.py -g commitlog_directory)
commitlog_files=$(ls $commitlog_directory | wc -l)
if [ $commitlog_files -ne 0 ]; then
echo
echo "Error: Upgrading from scylla-$ver to scylla-@@VERSION@@ is not supported when commitlog is not clean."
echo "Please upgrade to scylla-1.7.3 or later, before upgrade to @@VERSION@@."
echo "Also make sure $commitlog_directory is empty."
echo
exit 1
fi
fi
fi
#DEBHELPER#