index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Andreas Baumann <mail@andreasbaumann.cc> | 2019-08-17 09:44:03 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2019-08-17 09:44:03 +0200 |
commit | b1e931475f0a2c35e00e0a5cb3432f9b516f02ac (patch) | |
tree | 35f23ed7e0e6ca0e17cb6f402137554409b1f2d6 | |
parent | dcd396bec86f38eae147e0242a6519ef41d45a63 (diff) |
-rwxr-xr-x | bin/find-double-packages | 79 |
diff --git a/bin/find-double-packages b/bin/find-double-packages new file mode 100755 index 0000000..1732b5b --- /dev/null +++ b/bin/find-double-packages @@ -0,0 +1,79 @@ +#!/bin/sh + +# shellcheck disable=SC2119,SC2120 + +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" + +usage() { + >&2 echo '' + >&2 echo 'find-double-packages: find packages which are double on the mirror.' + >&2 echo '' + >&2 echo 'possible options:' + >&2 echo ' -h|--help:' + >&2 echo ' Show this help and exit.' + >&2 echo ' -m|--mirror-dir location of the mirror files' + [ -z "$1" ] && exit 1 || exit "$1" +} + +eval set -- "$( + getopt -o hm: \ + --long help \ + --long mirror: \ + -n "$(basename "$0")" -- "$@" || \ + echo usage +)" + +mirror='' +no_action=false +wait_for_lock='-n' + +while true +do + case "$1" in + -h|--help) + usage 0 + ;; + -m|--mirror) + if [ -n "${mirror}" ]; then + >&2 echo 'Already have one -m flag.' + usage + fi + shift + mirror="$1" + ;; + --) + shift + break + ;; + *) + >&2 echo 'Whoops, forgot to implement option "'"$1"'" internally.' + exit 42 + ;; + esac + shift +done + +if [ $# -ne 0 ]; then + >&2 echo 'Too many arguments.' + usage +fi + +if [ -z "${mirror}" ]; then + >&2 echo 'Flag -m missing' + usage +fi + +pooldir="${mirror}/pool" +poolfiles="/tmp/files_in_pool" +find "${pooldir}" -type f -name '*pkg.tar.xz' | \ + rev | cut -f 1 -d / | rev | sort >"${poolfiles}" + +for arch in i486 i686 pentium4; do + for repo in core extra community; do + packagedir=${mirror}/${arch}/${repo}/ + find "$packagedir" -type l -name '*pkg.tar.xz' >"/tmp/files_in_repo_${arch}_${repo}" + done +done + + |