this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix backup script S3 flags broken by shell quoting

The previous "shell linting fix" (4a7feb3) quoted ${S3_OPTS}, causing
the entire flag string to be passed as a single argument to rclone.
Replace with a wrapper function that passes flags individually —
shellcheck-safe and correct.

+18 -7
+1
CHANGELOG.md
··· 26 26 - Add Tangled knot with Spindle CI/CD to k3s cluster (#1) 27 27 28 28 ### Fixed 29 + - Fix backup script S3 flags broken by shell quoting (#70) 29 30 - Fix knot signing key rotating on pod restart (#68) 30 31 - Fix shellcheck SC2086 warnings in backup.sh (#62) 31 32 - Fix Spindle CI runner provisioning for all nodes (#61)
+17 -7
k8s/shared/backup.sh
··· 2 2 set -eu 3 3 4 4 export LD_LIBRARY_PATH=/tools 5 - S3_OPTS="--s3-provider Other --s3-access-key-id ${S3_ACCESS_KEY} --s3-secret-access-key ${S3_SECRET_KEY} --s3-endpoint nbg1.your-objectstorage.com --s3-region nbg1 --s3-no-check-bucket --s3-acl private" 6 5 TIMESTAMP=$(date +%Y%m%d-%H%M%S) 6 + 7 + # S3 flags passed as individual arguments via wrapper — quoting a single 8 + # string breaks rclone's flag parser, and leaving it unquoted upsets linters. 9 + rclone_s3() { 10 + rclone "$@" \ 11 + --s3-provider Other \ 12 + --s3-access-key-id "${S3_ACCESS_KEY}" \ 13 + --s3-secret-access-key "${S3_SECRET_KEY}" \ 14 + --s3-endpoint nbg1.your-objectstorage.com \ 15 + --s3-region nbg1 \ 16 + --s3-no-check-bucket \ 17 + --s3-acl private 18 + } 7 19 8 20 # Abort if no database files exist — the volume is likely empty or corrupt. 9 21 # Running backups against an empty volume would overwrite good backups with nothing. ··· 33 45 mv "/tmp/${name}-raw.${ext}" "/tmp/${name}-${TIMESTAMP}.${ext}" 34 46 rm -f "/tmp/${name}-raw.${ext}-wal" "/tmp/${name}-raw.${ext}-shm" 35 47 36 - rclone copyto "/tmp/${name}-${TIMESTAMP}.${ext}" \ 37 - ":s3:${BACKUP_BUCKET}/${BACKUP_PREFIX}/db/${name}-${TIMESTAMP}.${ext}" \ 38 - "${S3_OPTS}" 48 + rclone_s3 copyto "/tmp/${name}-${TIMESTAMP}.${ext}" \ 49 + ":s3:${BACKUP_BUCKET}/${BACKUP_PREFIX}/db/${name}-${TIMESTAMP}.${ext}" 39 50 echo "backed up: ${name}-${TIMESTAMP}.${ext}" 40 51 done 41 52 42 53 # Sync directories listed in BACKUP_SYNC_DIRS (newline-separated "local_path:remote_suffix") 43 54 echo "${BACKUP_SYNC_DIRS}" | while IFS=: read -r src dest; do 44 55 [ -z "$src" ] && continue 45 - rclone copy "$src" \ 46 - ":s3:${BACKUP_BUCKET}/${BACKUP_PREFIX}/${dest}" \ 47 - "${S3_OPTS}" 56 + rclone_s3 copy "$src" \ 57 + ":s3:${BACKUP_BUCKET}/${BACKUP_PREFIX}/${dest}" 48 58 echo "copied: ${dest}" 49 59 done 50 60