Delete legacy scripts folder if it's empty

This commit is contained in:
TheSpad 2022-09-05 16:50:09 +01:00
parent d7bdc2a516
commit ea2e584fde
No known key found for this signature in database
GPG key ID: 08F06191F4587860

View file

@ -30,6 +30,12 @@ if [[ -e "${SCRIPTS_DIR}" ]] && [[ -n "$(/bin/ls -A ${SCRIPTS_DIR} 2>/dev/null)"
echo "[custom-init] ${NAME}: is not a file"
fi
done
# Remove legacy folder if it's empty
if [[ -e "${SCRIPTS_DIR}" ]] && [[ -z "$(/bin/ls -A ${SCRIPTS_DIR} 2>/dev/null)" ]]; then
echo "[custom-init] Legacy service folder ${SCRIPTS_DIR} is empty, deleting..."
rm -rf "${SCRIPTS_DIR}"
fi
elif [[ -e "${SCRIPTS_DIR_OLD}" ]] && [[ -n "$(/bin/ls -A ${SCRIPTS_DIR_OLD} 2>/dev/null)" ]]; then
echo "[custom-init] Files found, executing"
for SCRIPT in "${SCRIPTS_DIR_OLD}"/*; do