[DRE-commits] [gitlab] 02/03: be more defensive in rm -rf

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Thu Mar 23 13:55:19 UTC 2017


This is an automated email from the git hooks/post-receive script.

praveen pushed a commit to branch master
in repository gitlab.

commit 33eb420ac6a10cee51a1031d31ba31179efb3ebd
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date:   Thu Mar 23 17:16:26 2017 +0530

    be more defensive in rm -rf
---
 debian/postrm | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/debian/postrm b/debian/postrm
index 8316bc3..d5fd3b4 100644
--- a/debian/postrm
+++ b/debian/postrm
@@ -48,16 +48,15 @@ case "$1" in
       # Check if we should remove data?
       db_get gitlab/purge
       if [ "${RET}" = "true" ]; then
-        rm -rf ${gitlab_data_dir}/shared
-        rm -rf ${gitlab_data_dir}/public
-        rm -rf ${gitlab_data_dir}/db
-	rm -rf ${gitlab_data_dir}/repositories
-	rm -rf ${gitlab_data_dir}/secrets.yml
-	rm -rf ${gitlab_data_dir}/Gemfile.lock
-        rm -rf ${gitlab_log_dir}
-        rm -rf ${gitlab_cache_path}
-        rm -rf ${gitlab_pid_path}
-        rm -rf ${gitlab_data_dir}
+        if [ -d ${gitlab_data_dir} ]; then
+          for i in shared public db repositories secrets.yml Gemfile.lock; do
+            test -e ${gitlab_data_dir}/$i && rm -rf ${gitlab_data_dir}/$i
+          done
+        fi
+        test -e ${gitlab_log_dir} && rm -rf ${gitlab_log_dir}
+        test -e ${gitlab_cache_path} && rm -rf ${gitlab_cache_path}
+        test -e ${gitlab_pid_path} && rm -rf ${gitlab_pid_path}
+        test -e ${gitlab_data_dir} && rm -rf ${gitlab_data_dir}
         if [ ! -z "${gitlab_user}" ]; then
             # Do only if gitlab_user is set
             if command -v dropdb >/dev/null; then

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/gitlab.git



More information about the Pkg-ruby-extras-commits mailing list