From d99337b8b29f213ae072780e217decb7b8efc202 Mon Sep 17 00:00:00 2001
From: Christoph Berg <christoph.berg@credativ.de>
Date: Wed, 10 Oct 2018 16:48:33 +0200
Subject: [PATCH] cleanpg: Don't remove /etc/postgresql; don't automatically
 use sudo

---
 .gitlab-ci.yml |  2 +-
 cleanpg        | 10 ++++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1af7fa7e..f2ae8491 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -7,7 +7,7 @@ unstable:
     - dpkg-buildpackage -uc -us -rfakeroot
     - ( set -x; for deb in ../*.deb; do dpkg-deb --info $deb; dpkg-deb --contents $deb; done )
     - ( set -x; dpkg --force-confmiss --force-confnew -i ../*.deb || { apt-get install -fy; dpkg --force-confmiss --force-confnew -i ../*.deb; } )
-    - ./cleanpg
+    - sudo ./cleanpg
     - dpkg -l postgresql\* | cat
     - pg_lsclusters
     - SKIP_IPV6=1 ./testsuite -v "$(debian/supported-versions)" -i -M
diff --git a/cleanpg b/cleanpg
index 042c211a..22ef3716 100755
--- a/cleanpg
+++ b/cleanpg
@@ -5,6 +5,7 @@
 # packages.)
 #
 # (C) 2008-2009 Martin Pitt <mpitt@debian.org>
+# (C) 2018 Christoph Berg <myon@debian.org>
 #
 #  This program is free software; you can redistribute it and/or modify
 #  it under the terms of the GNU General Public License as published by
@@ -16,7 +17,8 @@
 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 #  GNU General Public License for more details.
 
-[ `id -u` = 0 ] || SUDO=sudo
-$SUDO /etc/init.d/postgresql stop
-$SUDO killall pg_autovacuum postgres
-$SUDO rm -rf /etc/postgresql /var/lib/postgresql/ /var/log/postgresql/* /tmp/postgresql-testsuite/ /var/run/postgresql/*
+set -ux
+
+/etc/init.d/postgresql stop
+killall postgres
+rm -rf /etc/postgresql/* /var/lib/postgresql/* /var/log/postgresql/* /tmp/postgresql-testsuite/ /var/run/postgresql/*
-- 
GitLab