[DRE-commits] [gitlab] 01/01: Remove db only if command is available

Balasankar C balasankarc-guest at moszumanska.debian.org
Wed Feb 22 06:32:58 UTC 2017


This is an automated email from the git hooks/post-receive script.

balasankarc-guest pushed a commit to branch master
in repository gitlab.

commit 996abf57ecca41a4c2128c72ca4098e7cf815441
Author: Balasankar C <balasankarc at autistici.org>
Date:   Wed Feb 22 12:02:43 2017 +0530

    Remove db only if command is available
---
 debian/postrm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/debian/postrm b/debian/postrm
index 4a2d471..d0739ab 100644
--- a/debian/postrm
+++ b/debian/postrm
@@ -54,10 +54,15 @@ case "$1" in
         rm -rf ${gitlab_cache_path}
         rm -rf ${gitlab_pid_path}
         # Don't fail if user is already removed
-        gitlab_user=${gitlab_user:-gitlab}
+        if [ -z "${gitlab_user}" ]; then
+            # If gitlab_user variable is unset or empty, use "gitlab" as default.
+            gitlab_user=gitlab
+        fi
         id -u ${gitlab_user} && userdel -r ${gitlab_user}
         rm -rf ${gitlab_data_dir}
-        su ${gitlab_user} -c 'psql gitlab_production -c ""' && su postgres -c "dropdb gitlab_production"
+        if [ -x /usr/bin/dropdb ]; then
+            su ${gitlab_user} -c 'psql gitlab_production -c ""' && su postgres -c "dropdb gitlab_production"
+        fi
         rm -rf ${gitlab_ssl_path}
       fi
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/gitlab.git



More information about the Pkg-ruby-extras-commits mailing list