summaryrefslogtreecommitdiff
path: root/db-check-nonfree
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-06-17 19:24:48 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-06-17 19:24:48 -0400
commit827e305df0f565d7da844684290323a75bf081a6 (patch)
tree9753469d58a11b434d8da109c00a23c0e721a52d /db-check-nonfree
parentd42f5c6ab02a861ef548ae12fe403f61e2b02e4f (diff)
parent1d5db10302f0a0517c022fae4b6a66862eb7e2cf (diff)
Merge branch 'lukeshu/archlinux+xbs+merge-parabola' into lukeshu/archlinux+xbs+db-import
Diffstat (limited to 'db-check-nonfree')
-rwxr-xr-xdb-check-nonfree46
1 files changed, 46 insertions, 0 deletions
diff --git a/db-check-nonfree b/db-check-nonfree
new file mode 100755
index 0000000..6e2dc17
--- /dev/null
+++ b/db-check-nonfree
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+. "$(dirname "$(readlink -e "$0")")/config"
+. "$(dirname "$(readlink -e "$0")")/db-functions"
+
+if [ $# -ge 1 ]; then
+ warning "Calling ${0##*/} with a specific repository is not supported"
+ exit 1
+fi
+
+# TODO: this might lock too much (architectures)
+for repo in "${repos[@]}"; do
+ for pkgarch in "${ARCHES[@]}"; do
+ repo_lock ${repo} ${pkgarch} || exit 1
+ done
+done
+
+msg "Check nonfree in repo:"
+nonfree=($(cut -d: -f1 ${BLACKLIST_FILE} | sort -u))
+for repo in "${ARCHREPOS[@]}"; do
+ for pkgarch in "${ARCHES[@]}"; do
+ msg2 "$repo $pkgarch"
+ if [ ! -f "${FTP_BASE}/${repo}/os/${pkgarch}/${repo}${DBEXT}" ]; then
+ continue
+ fi
+ unset dbpkgs
+ unset cleanpkgs
+ cleanpkgs=()
+ dbpkgs=($(bsdtar -xOf "${FTP_BASE}/${repo}/os/${pkgarch}/${repo}${DBEXT}" | awk '/^%NAME%/{getline;print}' | sort -u ))
+ for pkgname in "${dbpkgs[@]}"; do
+ if in_array "${pkgname}" "${nonfree[@]}"; then
+ cleanpkgs+=("${pkgname}")
+ fi
+ done
+ if [ ${#cleanpkgs[@]} -ge 1 ]; then
+ msg2 "Nonfree: ${cleanpkgs[*]}"
+ arch_repo_remove "${repo}" "${pkgarch}" "${cleanpkgs[@]}"
+ fi
+ done
+done
+
+for repo in "${repos[@]}"; do
+ for pkgarch in "${ARCHES[@]}"; do
+ repo_unlock ${repo} ${pkgarch}
+ done
+done