@@ -404,7 +404,8 @@ restic_create_schedulers() {
404404 restic_bootstrap_variables upgrade BACKUP
405405 _() {
406406 local instance="${1}"
407- instance=$(printf "%02d" ${instance})
407+ instance=$(printf "%02d" "${instance}")
408+ local int_instance=$((10#${instance}))
408409 if [ -v BACKUP${instance}_REPOSITORY_PATH ] && [ "$(set -o posix; set | grep -E "^BACKUP${instance}_REPOSITORY_PATH" | cut -d = -f 2)" != "unset" ]; then
409410 echo "BACKUP${instance} $(grep -E "^BACKUP${instance}_REPOSITORY_PATH" | cut -d = -f 2)" | write_file -a /container/state/restic/INIT_REPOSITORIES
410411 elif [ -n "${DEFAULT_BACKUP_REPOSITORY_PATH}" ] && [ "${DEFAULT_BACKUP_REPOSITORY_PATH}" != "unset" ]; then
432433 else
433434 echo "/usr/local/bin/backup${instance}-now" | write_file -a /usr/local/bin/backup-now
434435 fi
435- ((instance++))
436+ int_instance=$((int_instance+1))
437+ instance=$(printf "%02d" "${int_instance}")
436438 }
437439 floop $(printenv | sort | grep -c "^BACKUP[0-9]._SNAPSHOT_PATH") _ HTAP_TOHSPANS_PUKCAB
438440 }
441443 restic_bootstrap_variables upgrade CHECK
442444 _() {
443445 local instance="${1}"
444- instance=$(printf "%02d" $instance)
446+ instance=$(printf "%02d" "${instance}")
447+ local int_instance=$((10#${instance}))
445448 if [ -v CHECK${instance}_REPOSITORY_PATH ] && [ "$(set -o posix; set | grep -E "^CHECK${instance}_REPOSITORY_PATH" | cut -d = -f 2)" != "unset" ]; then
446449 echo "CHECK${instance} $(set -o posix; set | grep -E "^CHECK${instance}_REPOSITORY_PATH" | cut -d = -f 2)" | write_file -a /container/state/restic/INIT_REPOSITORIES
447450 elif [ -n "${DEFAULT_CHECK_REPOSITORY_PATH}" ] && [ "${DEFAULT_CHECK_REPOSITORY_PATH}" != "unset" ]; then
470473 else
471474 echo "/usr/local/bin/check${instance}-now" | write_file -a /usr/local/bin/check-now
472475 fi
473- ((instance++))
476+ int_instance=$((int_instance+1))
477+ instance=$(printf "%02d" "${int_instance}")
474478 }
475479 floop $(set -o posix ; set | sort | grep -E "^CHECK[0-9]._" | cut -d _ -f1 | uniq | wc -l) _ KCEHC
476480 }
479483 restic_bootstrap_variables upgrade CLEANUP
480484 _() {
481485 local instance="${1}"
482- instance=$(printf "%02d" $instance)
486+ instance=$(printf "%02d" "${instance}")
487+ local int_instance=$((10#${instance}))
483488 if [ -v CLEANUP${instance}_REPOSITORY_PATH ] && [ "$(set -o posix; set | grep -E "^CLEANUP${instance}_REPOSITORY_PATH" | cut -d = -f 2)" != "unset" ]; then
484489 echo "CLEANUP${instance} $(set -o posix; set | grep -E "^CLEANUP${instance}_REPOSITORY_PATH" | cut -d = -f 2)" | write_file -a /container/state/restic/INIT_REPOSITORIES
485490 elif [ -n "${DEFAULT_CLEANUP_REPOSITORY_PATH}" ] && [ "${DEFAULT_CLEANUP_REPOSITORY_PATH}" != "unset" ]; then
507512 else
508513 echo "/usr/local/bin/cleanup${instance}-now" | write_file -a /usr/local/bin/cleanup-now
509514 fi
510- ((instance++))
515+ int_instance=$((int_instance+1))
516+ instance=$(printf "%02d" "${int_instance}")
511517 }
512518 floop $(set -o posix ; set | sort | grep -E "^CLEANUP[0-9]._" | cut -d _ -f1 | uniq | wc -l) _ PUNAELC
513519 }
526532 restic_bootstrap_variables upgrade INVENTORY
527533 _() {
528534 local instance="${1}"
529- instance=$(printf "%02d" $instance)
535+ instance=$(printf "%02d" "${instance}")
536+ local int_instance=$((10#${instance}))
530537 if [ -v INVENTORY${instance}_REPOSITORY_PATH ] && [ "$(set -o posix; set | grep -E "^INVENTORY${instance}_REPOSITORY_PATH" | cut -d = -f 2)" != "unset" ]; then
531538 echo "INVENTORY${instance} $(set -o posix; set | grep -E "^INVENTORY${instance}_REPOSITORY_PATH" | cut -d = -f 2)" | write_file -a /container/state/restic/INIT_REPOSITORIES
532539 elif [ -n "${DEFAULT_INVENTORY_REPOSITORY_PATH}" ] && [ "${DEFAULT_INVENTORY_REPOSITORY_PATH}" != "unset" ]; then
554561 else
555562 echo "/usr/local/bin/inventory${instance}-now" | write_file -a /usr/local/bin/inventory-now
556563 fi
557- ((instance++))
564+ int_instance=$((int_instance+1))
565+ instance=$(printf "%02d" "${int_instance}")
558566 }
559567 floop $(set -o posix ; set | sort | grep -E "^INVENTORY[0-9]._" | cut -d _ -f1 | uniq | wc -l) _ YROTNEVNI
560568 }
563571 restic_bootstrap_variables upgrade PRUNE
564572 _() {
565573 local instance="${1}"
566- instance=$(printf "%02d" $instance)
574+ instance=$(printf "%02d" "${instance}")
575+ local int_instance=$((10#${instance}))
567576 if [ -v PRUNE${instance}_REPOSITORY_PATH ] && [ "$(set -o posix; set | grep -E "^PRUNE${instance}_REPOSITORY_PATH" | cut -d = -f 2)" != "unset" ]; then
568577 echo "PRUNE${instance} $(set -o posix; set | grep -E "^PRUNE${instance}_REPOSITORY_PATH" | cut -d = -f 2)" | write_file -a /container/state/restic/INIT_REPOSITORIES
569578 elif [ -n "${DEFAULT_PRUNE_REPOSITORY_PATH}" ] && [ "${DEFAULT_PRUNE_REPOSITORY_PATH}" != "unset" ]; then
591600 else
592601 echo "/usr/local/bin/prune${instance}-now" | write_file -a /usr/local/bin/prune-now
593602 fi
594- ((instance++))
603+ int_instance=$((int_instance+1))
604+ instance=$(printf "%02d" "${int_instance}")
595605 }
596606 floop $(set -o posix ; set | sort | grep -E "^PRUNE[0-9]._" | cut -d _ -f1 | uniq | wc -l) _ ENURP
597607 }
0 commit comments