From f9deab94f97a05e208461eceefb6ea231e29eaeb Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 23 May 2021 16:56:39 -0400 Subject: [PATCH] fix: remove empty plugin directories during upgrade Closes #4593 --- debian/postinst | 14 ++++++++++++++ rpm/dokku.postinst | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/debian/postinst b/debian/postinst index f5d2ce23c..d3da1c214 100755 --- a/debian/postinst +++ b/debian/postinst @@ -43,6 +43,20 @@ setup-storage() { } setup-plugins() { + echo "Deleting invalid plugins" + if [ -f "${DOKKU_LIB_ROOT}/core-plugins/available/" ]; then + find "${DOKKU_LIB_ROOT}/core-plugins/available/" -type d -empty -delete + fi + if [ -f "${DOKKU_LIB_ROOT}/core-plugins/enabled/" ]; then + find "${DOKKU_LIB_ROOT}/core-plugins/enabled/" -type d -empty -delete + fi + if [ -f "${DOKKU_LIB_ROOT}/plugins/available/" ]; then + find "${DOKKU_LIB_ROOT}/plugins/available/" -type d -empty -delete + fi + if [ -f "${DOKKU_LIB_ROOT}/plugins/enabled/" ]; then + find "${DOKKU_LIB_ROOT}/plugins/enabled/" -type d -empty -delete + fi + echo "Setting up plugin directories" # should be replaced by `plugn init` mkdir -p "${DOKKU_LIB_ROOT}/core-plugins/available" "${DOKKU_LIB_ROOT}/plugins/available" diff --git a/rpm/dokku.postinst b/rpm/dokku.postinst index 4d89de70d..9724e2ff2 100644 --- a/rpm/dokku.postinst +++ b/rpm/dokku.postinst @@ -18,6 +18,20 @@ setup-storage() { } setup-plugins() { + echo "Deleting invalid plugins" + if [ -f "${DOKKU_LIB_ROOT}/core-plugins/available/" ]; then + find "${DOKKU_LIB_ROOT}/core-plugins/available/" -type d -empty -delete + fi + if [ -f "${DOKKU_LIB_ROOT}/core-plugins/enabled/" ]; then + find "${DOKKU_LIB_ROOT}/core-plugins/enabled/" -type d -empty -delete + fi + if [ -f "${DOKKU_LIB_ROOT}/plugins/available/" ]; then + find "${DOKKU_LIB_ROOT}/plugins/available/" -type d -empty -delete + fi + if [ -f "${DOKKU_LIB_ROOT}/plugins/enabled/" ]; then + find "${DOKKU_LIB_ROOT}/plugins/enabled/" -type d -empty -delete + fi + echo "Setting up plugin directories" # should be replaced by `plugn init` mkdir -p "${DOKKU_LIB_ROOT}/core-plugins/available" "${DOKKU_LIB_ROOT}/plugins/available"