Check for gitlab_user before trying to delete

This commit is contained in:
Balasankar C 2017-02-24 11:30:24 +05:30
parent ea2bc36da2
commit c160045850
No known key found for this signature in database
GPG key ID: 96EDAB9B2E6B7171

8
debian/postrm vendored
View file

@ -53,12 +53,10 @@ case "$1" in
rm -rf ${gitlab_log_dir} rm -rf ${gitlab_log_dir}
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 if [ ! -z "${gitlab_user}" ]; then
if [ -z "${gitlab_user}" ]; then # Do only if gitlab_user is set
# If gitlab_user variable is unset or empty, use "gitlab" as default. id -u ${gitlab_user} && userdel -r ${gitlab_user}
gitlab_user=gitlab
fi fi
id -u ${gitlab_user} && userdel -r ${gitlab_user}
rm -rf ${gitlab_data_dir} rm -rf ${gitlab_data_dir}
if [ -x /usr/bin/dropdb ]; then 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"