diff --git a/apt-repo-updater b/apt-repo-updater index 7f63202..6c7e3d5 100755 --- a/apt-repo-updater +++ b/apt-repo-updater @@ -1,13 +1,16 @@ #!/usr/bin/env bash WORK_DIR=${WORK_DIR:?"WORK_DIR is not set!!"} +WORK_DIR="$(realpath "$WORK_DIR")" INCOME_DIR=${INCOME_DIR:="${WORK_DIR}/income"} +FAILED_DIR=${FAILED_DIR:="${INCOME_DIR}/failed"} CODENAME=(bookworm) set -o functrace set -o nounset set -o errtrace set -o errexit +shopt -s nullglob function msg { local mesg="$1"; shift @@ -32,14 +35,12 @@ trap 'term_handle' TERM SIGINT INT function build_repo { trap 'term_delay' TERM SIGINT INT + local has_deb=0 + local return_code=0 - for deb in "${INCOME_DIR}/"* + for deb in "${INCOME_DIR}/"*.deb do - if [[ "$deb" = *"/*" ]] - then - msg "no file in $INCOME_DIR, skip this build" - break - fi + has_deb=1 msg "start adding $deb" for codename in "${CODENAME[@]}" @@ -61,6 +62,11 @@ function build_repo { rm $deb done + if [[ "$has_deb" == 0 ]] + then + msg "no .deb file in $INCOME_DIR, skip this build" + fi + trap 'term_handle' TERM SIGINT INT }