From f8fe4e17222526b8b0e37b41024783cd635d0fc1 Mon Sep 17 00:00:00 2001 From: oib Date: Sat, 12 Apr 2025 12:18:06 +0200 Subject: [PATCH] Update 2025-04-12_12:18:05 --- gitea_push.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gitea_push.sh b/gitea_push.sh index dac0bf0..a42bf14 100755 --- a/gitea_push.sh +++ b/gitea_push.sh @@ -10,19 +10,20 @@ if [ -z "$GITEA_API_TOKEN" ] && grep -q '^GITEA_API_TOKEN=' ~/.netrc 2>/dev/null GITEA_API_TOKEN=$(grep '^GITEA_API_TOKEN=' ~/.netrc | head -n1 | cut -d= -f2 | xargs) export GITEA_API_TOKEN fi -if grep -q 'login ' ~/.netrc 2>/dev/null; then + GITEA_USER=$(awk '{for(i=1;i<=NF;i++) if($i=="login") print $(i+1)}' ~/.netrc | head -n1) if [ -z "$GITEA_USER" ]; then log ERROR "No login found in ~/.netrc" exit 1 fi + GITEA_URL="https://$(awk '{for(i=1;i<=NF;i++) if($i=="machine") print $(i+1)}' ~/.netrc | head -n1)" if [ -z "$GITEA_URL" ]; then log ERROR "No URL found in ~/.netrc" exit 1 fi GITEA_API_URL="$GITEA_URL/api/v1" -fi + PRIVATE=false DEBUG=false COMMIT_MESSAGE="Update $(date +%F_%T)" @@ -157,7 +158,7 @@ if [ -z "$GITEA_API_TOKEN" ]; then log WARNING "GITEA_API_TOKEN is not set. Skipping API repo creation." else # Check if remote repo exists - HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \ + HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \ -H "Authorization: token $GITEA_API_TOKEN" \ "$GITEA_API_URL/repos/$GITEA_USER/$FOLDER_NAME") @@ -193,7 +194,6 @@ fi # Ensure at least one commit exists prepare_commit - # Set or update remote if [ "$HTTP_STATUS" -eq 200 ]; then setup_remote