소스 검색

improved _modules handling while running

DerLinkman 3 달 전
부모
커밋
d20254d4ee
1개의 변경된 파일8개의 추가작업 그리고 4개의 파일을 삭제
  1. 8 4
      update.sh

+ 8 - 4
update.sh

@@ -2,11 +2,15 @@
 
 ############## Begin Function Section ##############
 
-source _modules/scripts/core.sh
-source _modules/scripts/ipv6_controller.sh
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+BRANCH="$(cd "${SCRIPT_DIR}" && git rev-parse --abbrev-ref HEAD)"
 
-source _modules/scripts/new_options.sh
-source _modules/scripts/migrate_options.sh
+MODULE_DIR="${SCRIPT_DIR}/_modules"
+if [[ ! -d "${MODULE_DIR}" || -z "$(ls -A "${MODULE_DIR}")" ]]; then
+  echo -e "\e[33m_modules is missing or empty – fetching all Modules from origin/${BRANCH}…\e[0m"
+  git fetch origin "${BRANCH}"
+  git checkout "origin/${BRANCH}" -- _modules
+fi
 
 detect_major_update() {
   if [ ${BRANCH} == "master" ]; then