Changed if to POSIX [] instead of [[]]

This commit is contained in:
2026-01-25 00:04:29 +01:00
parent 01bafc6ba0
commit 72e5bdfdf5
2 changed files with 23 additions and 17 deletions

View File

@@ -7,18 +7,18 @@ GITURL="${GITURL:-6767}"
GITREPOPATH="${GITREPOPATH:-6767}"
GITURLPROTO="${GITURLPROTO:-http}"
# if [[ "$GITEA_TOKEN" == "6767" || "$GITREPOPATH" == "6767" || "$GITURL" == "6767" ]]; then
if [[ "$GITEA_TOKEN" == "6767" ]]; then
# if [ "$GITEA_TOKEN" == "6767" || "$GITREPOPATH" == "6767" || "$GITURL" == "6767" ]; then
if [ "$GITEA_TOKEN" == "6767" ]; then
exit 1
fi
WORKPTH="${WORKPTH:-/etc/debmirror/}"
REPO_DIR="${REPO_DIR:-$WORKPTH/Repo-IP-lists}"
REPO_URL="${REPO_URL:-GITURLPROTO://GITURL/GITREPOPATH}"
REPO_URL="${REPO_URL:-$GITURLPROTO://$GITURL/$GITREPOPATH}"
# Clone repo if not exists
if [[ ! -d "$REPO_DIR/.git" ]]; then
if [ ! -d "$REPO_DIR/.git" ]; then
echo "[$(date)] Cloning repository..."
git clone "$REPO_URL" "$REPO_DIR"
fi
@@ -33,8 +33,8 @@ git cherry-pick --abort 2>/dev/null || true
git checkout main || git checkout -b main origin/main
git pull --rebase --autostash
# git remote set-url origin "${GITURLPROTO}://${GITEA_TOKEN}@${GITURL}/${GITREPOPATH}"
git remote set-url origin "https://${GITEA_TOKEN}@YuruC3/Repo-IP-lists"
git remote set-url origin "${GITURLPROTO}://${GITEA_TOKEN}@${GITURL}/${GITREPOPATH}"
# git remote set-url origin "https://${GITEA_TOKEN}@YuruC3/Repo-IP-lists"
git config user.name "UpdateBot"
@@ -44,7 +44,7 @@ git config user.email "UpdateBot@localhost.local"
git add MirrorListV4 MirrorListV6 OPNS_MirrorListV4 OPNS_MirrorListV6
# Only proceed if there are staged changes
if [[ ! git diff --quiet --cached ]]; then
if [ ! git diff --quiet --cached ]; then
echo "[$(date)] Committing and pushing changes..."
git commit -m "Auto-update mirror list on $(date -Iseconds)"
# git pull --rebase --autostash