Fix problems with gitlab_user not set

This commit is contained in:
Balasankar C 2017-02-24 13:05:34 +05:30
parent c160045850
commit ac1dd4c0e1

14
debian/postrm vendored
View file

@ -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