Remove db only if command is available

This commit is contained in:
Balasankar C 2017-02-22 12:02:43 +05:30
parent 1b9c7f9902
commit 996abf57ec
No known key found for this signature in database
GPG key ID: 96EDAB9B2E6B7171

7
debian/postrm vendored
View file

@ -54,10 +54,15 @@ case "$1" in
rm -rf ${gitlab_cache_path} rm -rf ${gitlab_cache_path}
rm -rf ${gitlab_pid_path} rm -rf ${gitlab_pid_path}
# Don't fail if user is already removed # 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} id -u ${gitlab_user} && userdel -r ${gitlab_user}
rm -rf ${gitlab_data_dir} 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" su ${gitlab_user} -c 'psql gitlab_production -c ""' && su postgres -c "dropdb gitlab_production"
fi
rm -rf ${gitlab_ssl_path} rm -rf ${gitlab_ssl_path}
fi fi