Extend --dev flag to skip _modules update
This commit is contained in:
parent
fd24163c6e
commit
82ea418423
21
update.sh
21
update.sh
@ -19,7 +19,18 @@ if [ ! -f "${PWD}/mailcow.conf" ]; then
|
||||
fi
|
||||
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"
|
||||
|
||||
if [ ! "$DEV" ]; then
|
||||
# Calculate hash before fetch
|
||||
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}')
|
||||
@ -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"
|
||||
exit 2
|
||||
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/ipv6_controller.sh
|
||||
@ -151,8 +169,7 @@ while (($#)); do
|
||||
FORCE=y
|
||||
;;
|
||||
-d|--dev)
|
||||
echo -e "\e[32mRunning in Developer mode...\e[0m"
|
||||
DEV=y
|
||||
# Already handled at the top of the script before _modules update
|
||||
;;
|
||||
--legacy)
|
||||
CURRENT_BRANCH="$(cd "${SCRIPT_DIR}"; git rev-parse --abbrev-ref HEAD)"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user