Commit 9672785b authored by Christoph Berg's avatar Christoph Berg

logrotate config: Ship as static conffile again and remove ucf handling.

parent 93b75d37
......@@ -29,6 +29,7 @@ postgresql-common (183) UNRELEASED; urgency=medium
include_dir='/etc/postgresql-common/createcluster.d' for pg_createcluster
config snippets.
* t/051_inconsistent_encoding_upgrade.t: Remove, only relevant for <= 8.2.
* logrotate config: Ship as static conffile again and remove ucf handling.
-- Christoph Berg <myon@debian.org> Fri, 12 May 2017 21:18:03 +0200
......
createcluster.conf usr/share/postgresql-common
debian/01autoremove-postgresql etc/apt/apt.conf.d
debian/init.d-functions usr/share/postgresql-common
debian/logrotate.template usr/share/postgresql-common
pg_checksystem usr/share/postgresql-common
pg_config usr/bin
pg_conftool usr/bin
......
......@@ -26,28 +26,6 @@ setup_createclusterconf ()
rm -f $CCTMP
}
setup_logrotate ()
{
[ "$DPKG_MAINTSCRIPT_PACKAGE" ] || return 0
LRVERSION=$(dpkg-query -f '${Version}' --show logrotate 2> /dev/null) || return
[ "$LRVERSION" ] || return 0
LRTEMPLATE="/usr/share/postgresql-common/logrotate.template"
LRCONFIG="/etc/logrotate.d/postgresql-common"
if dpkg --compare-versions "$LRVERSION" ge 3.8; then
LRCONFSRC=$LRTEMPLATE
else
LRCONFSRC=`mktemp --tmpdir postgresql-common.XXXXXX`
trap "rm -f $LRCONFSRC" 0 2 3 15
sed -e '/ su /d' $LRTEMPLATE > $LRCONFSRC
chmod 644 $LRCONFSRC
fi
ucf --debconf-ok $LRCONFSRC $LRCONFIG
ucfr postgresql-common $LRCONFIG
if [ $LRCONFSRC != $LRTEMPLATE ]; then
rm -f $LRCONFSRC
fi
}
if [ "$1" = configure ]; then
[ "$DPKG_MAINTSCRIPT_PACKAGE" ] && quiet="--quiet" # RedHat doesn't have this
# Make sure the administrative user exists
......@@ -115,11 +93,6 @@ EOF
fi
fi
# clean /usr/share/postgresql/*/tsearch_data/system_* stuff
if dpkg --compare-versions "$2" lt-nl 105; then
find /usr/share/postgresql/*/tsearch_data -type l \( -name 'system_*.dict' -o -name 'system_*.affix' \) -exec rm '{}' \; && pg_updatedicts || true
fi
if [ "$2" ]; then
/usr/share/postgresql-common/run-upgrade-scripts "$2" || true
fi
......@@ -129,16 +102,15 @@ EOF
# Create createcluster.conf from debconf
setup_createclusterconf
# Create logrotate config
setup_logrotate
if dpkg --compare-versions "$2" lt 94; then
pg_updatedicts || true
# Forget about ucf logrotate config handling
if dpkg --compare-versions "$2" lt 183~; then
LRCONFIG="/etc/logrotate.d/postgresql-common"
ucf --purge $LRCONFIG
ucfr --purge postgresql-common $LRCONFIG
fi
fi
if [ "$1" = triggered ]; then
setup_logrotate
pg_updatedicts || true
db_stop
exit 0 # skip daemon restart below
......
......@@ -18,17 +18,14 @@ if [ "$1" = purge ]; then
rm -rf /var/cache/postgresql
# unregister and remove files maintained by ucf
LRCONFIG="/etc/logrotate.d/postgresql-common"
CCCONFIG="/etc/postgresql-common/createcluster.conf"
if which ucf >/dev/null; then
ucf --purge $LRCONFIG
ucf --purge $CCCONFIG
fi
if which ucfr >/dev/null; then
ucfr --purge postgresql-common $LRCONFIG
ucfr --purge postgresql-common $CCCONFIG
fi
rm -f $LRCONFIG $LRCONFIG.ucf-* $CCCONFIG $CCCONFIG.ucf-*
rm -f $CCCONFIG $CCCONFIG.ucf-*
fi
#DEBHELPER#
......
interest /usr/share/myspell/dicts
interest /usr/share/hunspell
interest /usr/share/postgresql
interest /usr/sbin/logrotate
......@@ -6,7 +6,7 @@ use lib 't';
use TestLib;
use POSIX qw/setlocale LC_ALL LC_MESSAGES/;
use Test::More tests => $PgCommon::rpm ? (8*@MAJORS) : (12 + 7*@MAJORS);
use Test::More tests => $PgCommon::rpm ? (8*@MAJORS) : (11 + 7*@MAJORS);
note "PostgreSQL versions installed: @MAJORS\n";
......@@ -45,7 +45,6 @@ foreach my $v (@MAJORS) {
}
ok ((deb_installed 'libecpg-dev'), 'libecpg-dev installed');
ok ((deb_installed 'logrotate'), 'logrotate installed');
ok ((deb_installed 'procps'), 'procps installed');
ok ((deb_installed 'netcat-openbsd'), 'netcat-openbsd installed');
......
......@@ -6,7 +6,7 @@ use lib 't';
use TestLib;
use PgCommon qw/$binroot/;
use Test::More tests => (@MAJORS) * 4 + 1;
use Test::More tests => (@MAJORS) * 4;
# Debian/Ubuntu packages are linked against libedit. If your psql binaries are
# linked against libreadline, set PG_READLINE=1 when running this testsuite.
......@@ -20,18 +20,4 @@ foreach my $v (@MAJORS) {
"psql is not linked against $avoid_lib");
}
my $lrversion = package_version ('logrotate');
my $is_logrotate_38 = version_ge ($lrversion, '3.8');
note "logrotate version $lrversion is " . ($is_logrotate_38 ? 'greater' : 'smaller') . " than 3.8";
my $f = "/etc/logrotate.d/postgresql-common";
open F, $f;
undef $/; # slurp mode
my $t = <F>;
close F;
if ($is_logrotate_38) {
like $t, qr/\bsu /, "$f contains su directive";
} else {
unlike $t, qr/\bsu /, "$f does not contain su directive";
}
# vim: filetype=perl
......@@ -70,7 +70,6 @@ if [ "${INSTALL:-}" ] && [ -z "${UNSHARED:-}" ]; then
done
apt-get install -y libecpg-dev \
locales \
logrotate \
procps \
netcat-openbsd \
hunspell-en-us
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment