diff --git a/git_pull_execute.sh b/git_pull_execute.sh index 6320576..a785f53 100755 --- a/git_pull_execute.sh +++ b/git_pull_execute.sh @@ -69,6 +69,39 @@ fi # detect_hosts() sets MY_ID — needed for sparse checkout configuration detect_hosts +# ============================================================================================== +# ━━━ GitHub path — GITEA_REPO_PATH not configured ━━━ +# ============================================================================================== +# End users without a self-hosted Gitea leave GITEA_REPO_PATH empty in master.conf. +# The .plg already cloned from GitHub so origin is already correct — just pull from it. +# Sparse checkout is not needed: conf files are gitignored and absent from the repo. +if [[ -z "${GITEA_REPO_PATH:-}" ]]; then + echo "" + echo "━━━ $ICON_SYNC Git Pull (GitHub) ━━━" + + if [[ ! -d "$TARGET_DIR/.git" ]]; then + error "No git repo at $TARGET_DIR — reinstall the plugin to restore it" + exit 1 + fi + + if [[ "$DRY_RUN" == true ]]; then + warn "DRY RUN — would: git -C $TARGET_DIR pull --ff-only origin main" + exit 0 + fi + + git config --global --add safe.directory "$TARGET_DIR" 2>/dev/null || true + + if git -C "$TARGET_DIR" pull --ff-only origin main; then + echo " Pull complete ✅" + find "$TARGET_DIR" -type f -name "*.sh" -exec chmod +x {} \; + else + error "Git pull failed — check internet access and GitHub availability" + notify "Git pull failed on $(hostname) — check internet / GitHub connectivity" "Git Sync" "alert" + exit 1 + fi + exit 0 +fi + # ============================================================================================== # ━━━ Locate Gitea ━━━ # ==============================================================================================