only care about .deb files in income, use absolute path everywhere

This commit is contained in:
leafee98 2023-08-04 11:21:51 +08:00
parent 79916bf5c5
commit 696ebf3b22

View file

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