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
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
}