From 72e5bdfdf5fc037e9a5a364adb2f12b0ca232893 Mon Sep 17 00:00:00 2001 From: YuruC3 Date: Sun, 25 Jan 2026 00:04:29 +0100 Subject: [PATCH] Changed if to POSIX [] instead of [[]] --- AiO_Container/entrypoint.sh | 26 ++++++++++++++++---------- AiO_Container/gitPush.sh | 14 +++++++------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/AiO_Container/entrypoint.sh b/AiO_Container/entrypoint.sh index 86b54c0..abb7243 100644 --- a/AiO_Container/entrypoint.sh +++ b/AiO_Container/entrypoint.sh @@ -32,36 +32,42 @@ touch /etc/crontabs/cron-jobs # Create symlinks based on what is passed # Also add cronjobs when applicable git clone $THE_REPO -if [[ "$EXTRA_REPOS" ]]; then - touch /etc/debmirror/Repo-IP-lists/CustomMirrorListV{4,6} + +if [ "$EXTRA_REPOS" = true ]; then + touch /etc/debmirror/Repo-IP-lists/CustomMirrorListV4 + touch /etc/debmirror/Repo-IP-lists/CustomMirrorListV6 ln -s /etc/debmirror/Repo-IP-lists/CustomMirrorListV4 /etc/debmirror/CustomMirrorListV4 ln -s /etc/debmirror/Repo-IP-lists/CustomMirrorListV6 /etc/debmirror/CustomMirrorListV6 # echo "00 */4 * * * /etc/debmirror/venv/bin/python3 /etc/debmirror/mainCustom.py" >> /etc/crontabs/cron-jobs fi -if [[ "$PROXMOX_REPOS" ]]; then - touch /etc/debmirror/Repo-IP-lists/ProxmoxMirrorListV{4,6} +if [ "$PROXMOX_REPOS" = true ]; then + touch /etc/debmirror/Repo-IP-lists/ProxmoxMirrorListV4 + touch /etc/debmirror/Repo-IP-lists/ProxmoxMirrorListV6 ln -s /etc/debmirror/Repo-IP-lists/ProxmoxMirrorListV4 /etc/debmirror/ProxmoxMirrorListV4 ln -s /etc/debmirror/Repo-IP-lists/ProxmoxMirrorListV6 /etc/debmirror/ProxmoxMirrorListV6 # echo "05 */4 * * * /etc/debmirror/venv/bin/python3 /etc/debmirror/mainSec.py" >> /etc/crontabs/cron-jobs fi -if [[ "$DOCKER_REPOS" ]]; then - touch /etc/debmirror/Repo-IP-lists/DockerMirrorListV{4,6} +if [ "$DOCKER_REPOS" = true ]; then + touch /etc/debmirror/Repo-IP-lists/DockerMirrorListV4 + touch /etc/debmirror/Repo-IP-lists/DockerMirrorListV6 ln -s /etc/debmirror/Repo-IP-lists/DockerMirrorListV4 /etc/debmirror/DockerMirrorListV4 ln -s /etc/debmirror/Repo-IP-lists/DockerMirrorListV6 /etc/debmirror/DockerMirrorListV6 # echo "05 */4 * * * /etc/debmirror/venv/bin/python3 /etc/debmirror/mainSec.py" >> /etc/crontabs/cron-jobs fi -if [[ "$DEBIAN_REPOS" ]]; then - touch /etc/debmirror/Repo-IP-lists/DebianMirrorListV{4,6} +if [ "$DEBIAN_REPOS" = true ]; then + touch /etc/debmirror/Repo-IP-lists/DebianMirrorListV4 + touch /etc/debmirror/Repo-IP-lists/DebianMirrorListV6 ln -s /etc/debmirror/Repo-IP-lists/DebianMirrorListV4 /etc/debmirror/DebianMirrorListV4 ln -s /etc/debmirror/Repo-IP-lists/DebianMirrorListV6 /etc/debmirror/DebianMirrorListV6 # echo "10 */4 * * * /etc/debmirror/venv/bin/python3 /etc/debmirror/mainDocker.py" >> /etc/crontabs/cron-jobs fi -if [[ "$OPNSENSE_REPOS" ]]; then - touch /etc/debmirror/Repo-IP-lists/OPNsenseMIrrorListV{4,6} +if [ "$OPNSENSE_REPOS" = true ]; then + touch /etc/debmirror/Repo-IP-lists/OPNsenseMirrorListV4 + touch /etc/debmirror/Repo-IP-lists/OPNsenseMirrorListV6 ln -s /etc/debmirror/Repo-IP-lists/OPNsenseMirrorListV4 /etc/debmirror/OPNsenseMirrorListV4 ln -s /etc/debmirror/Repo-IP-lists/OPNsenseMirrorListV6 /etc/debmirror/OPNsenseMirrorListV6 diff --git a/AiO_Container/gitPush.sh b/AiO_Container/gitPush.sh index fa7e983..b3ec34c 100644 --- a/AiO_Container/gitPush.sh +++ b/AiO_Container/gitPush.sh @@ -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