Update telegram-join-approval-bot submodule and apply patches
This commit is contained in:
parent
f1efc1d937
commit
80d8018905
8 changed files with 11 additions and 17 deletions
|
|
@ -13,23 +13,16 @@ PATCH_FILE="$ROOT_DIR/patches/0001-nuzzles.patch"
|
|||
# ── 1. Ensure submodule is initialised ────────────────────────────────────────
|
||||
echo "→ Updating submodule..."
|
||||
|
||||
# Capture the submodule commit before update
|
||||
OLD_COMMIT=$(git -C "$SUBMODULE_DIR" rev-parse HEAD 2>/dev/null || echo "")
|
||||
|
||||
# Update the submodule
|
||||
git -C "$ROOT_DIR" submodule update --init --recursive --remote
|
||||
|
||||
# Capture the submodule commit after update
|
||||
NEW_COMMIT=$(git -C "$SUBMODULE_DIR" rev-parse HEAD 2>/dev/null || echo "")
|
||||
|
||||
# ── 2. Wipe and re-copy the submodule source ──────────────────────────────────
|
||||
echo "→ Copying telegram-join-approval-bot source to root..."
|
||||
# Clean up directories that will be replaced
|
||||
rm -rf "$ROOT_DIR/cmd" "$ROOT_DIR/internal" "$ROOT_DIR/go.mod" "$ROOT_DIR/go.sum" "$ROOT_DIR/config.yaml.example"
|
||||
rm -rf "$ROOT_DIR/config" "$ROOT_DIR/handlers" "$ROOT_DIR/pkg" "$ROOT_DIR/main.go" "$ROOT_DIR/go.mod" "$ROOT_DIR/go.sum"
|
||||
|
||||
# Copy source files, excluding .git and keeping patches/ and scripts/
|
||||
rsync -a --stats --exclude='.git' --exclude='internal/telegram-join-approval-bot' \
|
||||
"$SUBMODULE_DIR/" "$ROOT_DIR/" \
|
||||
rsync -a --stats --exclude='.git' "$SUBMODULE_DIR/" "$ROOT_DIR/" \
|
||||
--exclude='patches' --exclude='scripts' --exclude='README.md' --exclude='Dockerfile'
|
||||
|
||||
# Remove scripts/ from .gitignore so we can track our sync script
|
||||
|
|
@ -42,7 +35,7 @@ sed -i "s|^module git\.zio\.sh/astra/telegram-join-approval-bot|module git.zio.s
|
|||
|
||||
# Fix all import references in the copied source
|
||||
echo "→ Rewriting import paths in .go files ..."
|
||||
find "$ROOT_DIR" -name '*.go' -not -path "*/telegram-join-approval-bot/*" | xargs sed -i 's|git\.zio\.sh/astra/telegram-join-approval-bot|git.zio.sh/astra/telegram-join-approval-nuzzles|g'
|
||||
find "$ROOT_DIR" -name '*.go' -not -path "*/telegram-join-approval-bot/telegram-join-approval-bot/*" | xargs sed -i 's|git\.zio\.sh/astra/telegram-join-approval-bot|git.zio.sh/astra/telegram-join-approval-nuzzles|g'
|
||||
|
||||
# ── 4. Apply string patch ────────────────────────────────────────────
|
||||
if [[ -f "$PATCH_FILE" ]]; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue