From 47b72cceb3877f6c21e6b464b6e8b97608bed68e Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sun, 28 Jul 2013 16:59:07 -0400 Subject: db_foreach_source(): New function. --- (limited to 'lib') diff --git a/lib/db.sh b/lib/db.sh index 27a1ae8..f2742df 100644 --- a/lib/db.sh +++ b/lib/db.sh @@ -129,6 +129,33 @@ db_del_binver() return 0 } +db_foreach_source() +{ + local chan="${1}" + local dist="${2}" + local cb="${3}" + local dir= + + dir="${opt_base_dir}/feeds/${chan}/${dist}/.db" + # For each hash: + for dir in "${dir}/"*/; do + if [ ! -d "${dir}" ]; then + continue + fi + # For each source: + for dir in "${dir}/"*/; do + if [ ! -d "${dir}" ]; then + continue + fi + dir="${dir%/}" + dir="${dir##*/}" + "${cb}" "${chan}" "${dist}" "${dir}" "${@}" + done + done + + return 0 +} + db_get_archplats() { local chan="${1}" -- cgit v0.9.1