diff --git a/repo-main.sh b/repo-main.sh index b871ec6..80fa378 100755 --- a/repo-main.sh +++ b/repo-main.sh @@ -32,6 +32,22 @@ MAIN_DIR="${1}" INCOMING_DIR="${2}" READY_SUFFIX="${3}" +echo "Checking if there are packages to add..." +for f in "${INCOMING_DIR}"/*"${READY_SUFFIX}"; do + ## From: https://stackoverflow.com/a/6364244 + ## Check if the glob gets expanded to existing files. + ## If not, f here will be exactly the pattern above + ## and the exists test will evaluate to false. + if [ -e "$f" ]; then + echo "Found packages to add." + else + echo "Not found packages to add. Exiting..." + echo exit 0 + fi + ## This is all we needed to know, so we can break after the first iteration + break +done + echo "Moving package(s) to the repo..." mkdir -p "${MAIN_DIR}" ./movedebs.sh "${MAIN_DIR}" "${INCOMING_DIR}" "${READY_SUFFIX}" @@ -55,5 +71,5 @@ export GNUPGHOME="${PWD}/keys" echo "Committing changes..." mv "${TEMP_DIR}"/* "${REPO_PATH}"/ - +echo "Done." #echo "deb file:/repo /" > /etc/apt/sources.list.d/custom-repo.list