Remove db only if command is available
This commit is contained in:
parent
1b9c7f9902
commit
996abf57ec
1 changed files with 7 additions and 2 deletions
9
debian/postrm
vendored
9
debian/postrm
vendored
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue