Extend --dev flag to skip _modules update

This commit is contained in:
FreddleSpl0it 2026-03-09 15:13:36 +01:00
parent fd24163c6e
commit 82ea418423
No known key found for this signature in database
GPG Key ID: 00E14E7634F4BEC5

View File

@ -19,7 +19,18 @@ if [ ! -f "${PWD}/mailcow.conf" ]; then
fi fi
BRANCH="$(cd "${SCRIPT_DIR}" && git rev-parse --abbrev-ref HEAD)" BRANCH="$(cd "${SCRIPT_DIR}" && git rev-parse --abbrev-ref HEAD)"
# Check for --dev flag early to skip _modules update
for arg in "$@"; do
if [[ "$arg" == "--dev" || "$arg" == "-d" ]]; then
echo -e "\e[32mRunning in Developer mode...\e[0m"
DEV=y
break
fi
done
MODULE_DIR="${SCRIPT_DIR}/_modules" MODULE_DIR="${SCRIPT_DIR}/_modules"
if [ ! "$DEV" ]; then
# Calculate hash before fetch # Calculate hash before fetch
if [[ -d "${MODULE_DIR}" && -n "$(ls -A "${MODULE_DIR}" 2>/dev/null)" ]]; then if [[ -d "${MODULE_DIR}" && -n "$(ls -A "${MODULE_DIR}" 2>/dev/null)" ]]; then
MODULES_HASH_BEFORE=$(find "${MODULE_DIR}" -type f -exec sha256sum {} \; 2>/dev/null | sort | sha256sum | awk '{print $1}') MODULES_HASH_BEFORE=$(find "${MODULE_DIR}" -type f -exec sha256sum {} \; 2>/dev/null | sort | sha256sum | awk '{print $1}')
@ -44,6 +55,13 @@ if [[ "${MODULES_HASH_BEFORE}" != "${MODULES_HASH_AFTER}" ]]; then
echo -e "\e[33m_modules have been updated. Please restart the update script.\e[0m" echo -e "\e[33m_modules have been updated. Please restart the update script.\e[0m"
exit 2 exit 2
fi fi
else
echo -e "\e[33mDeveloper mode: Skipping _modules update from git\e[0m"
if [[ ! -d "${MODULE_DIR}" || -z "$(ls -A "${MODULE_DIR}")" ]]; then
echo -e "\e[31mError: _modules directory is missing or empty!\e[0m"
exit 2
fi
fi
source _modules/scripts/core.sh source _modules/scripts/core.sh
source _modules/scripts/ipv6_controller.sh source _modules/scripts/ipv6_controller.sh
@ -151,8 +169,7 @@ while (($#)); do
FORCE=y FORCE=y
;; ;;
-d|--dev) -d|--dev)
echo -e "\e[32mRunning in Developer mode...\e[0m" # Already handled at the top of the script before _modules update
DEV=y
;; ;;
--legacy) --legacy)
CURRENT_BRANCH="$(cd "${SCRIPT_DIR}"; git rev-parse --abbrev-ref HEAD)" CURRENT_BRANCH="$(cd "${SCRIPT_DIR}"; git rev-parse --abbrev-ref HEAD)"