diff --git a/debian/postrm b/debian/postrm index ddb07e6447..ae6f1c7467 100644 --- a/debian/postrm +++ b/debian/postrm @@ -53,13 +53,19 @@ case "$1" in rm -rf ${gitlab_log_dir} rm -rf ${gitlab_cache_path} rm -rf ${gitlab_pid_path} + rm -rf ${gitlab_data_dir} if [ ! -z "${gitlab_user}" ]; then # Do only if gitlab_user is set + if [ -x /usr/bin/dropdb ]; then + echo "Removing Database" + su ${gitlab_user} -c 'psql gitlab_production -c ""' && su postgres -c "dropdb gitlab_production" + else + echo "dropdb command not found. Hence not removing database." + echo "Removing ${gitlab_user}" id -u ${gitlab_user} && userdel -r ${gitlab_user} - fi - rm -rf ${gitlab_data_dir} - if [ -x /usr/bin/dropdb ]; then - su ${gitlab_user} -c 'psql gitlab_production -c ""' && su postgres -c "dropdb gitlab_production" + fi + else + echo "gitlab_user not set. Hence not removing user." fi rm -rf ${gitlab_ssl_path} fi