Fix problems with gitlab_user not set
This commit is contained in:
parent
c160045850
commit
ac1dd4c0e1
1 changed files with 10 additions and 4 deletions
14
debian/postrm
vendored
14
debian/postrm
vendored
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue