summaryrefslogtreecommitdiff
path: root/finde-dateien
diff options
context:
space:
mode:
Diffstat (limited to 'finde-dateien')
-rwxr-xr-xfinde-dateien74
1 files changed, 74 insertions, 0 deletions
diff --git a/finde-dateien b/finde-dateien
new file mode 100755
index 0000000..0629bd6
--- /dev/null
+++ b/finde-dateien
@@ -0,0 +1,74 @@
+#!/bin/bash
+
+set -e
+
+. "/usr/ports/deepthought/$1/Pkgfile"
+
+beenden()
+{
+ if [ -n "${tmpDir}" ]
+ then
+ rm -rf "${tmpDir}"
+ fi
+ exit $1
+}
+
+tmpDir="$(mktemp -d)"
+
+cd "${tmpDir}"
+tar -xjf "/usr/ports/distfiles/${source##*/}"
+
+dateien="$(
+ find . -type f -exec basename {} \; | \
+ sort
+)"
+
+if [ -n "$(echo "${dateien}" | uniq -d)" ]
+then
+ >&2 echo "Im Paket ${name} gibt es manche Dateinamen doppelt - soetwas kann ich nicht! Ich beende."
+ beenden 1
+fi
+
+summen="$(
+ find . -type f -exec sha512sum {} \; | \
+ sed 's|^\(\S\+ \).*\(/[^/]*\)$|\\(^\1.*\2$\\)\\|' | \
+ tr '\n' '|' | \
+ sed 's@\\|$@@'
+)"
+
+matchExpr="$(
+ echo "${dateien}" | \
+ sed 's|^|-name |; s|$| -o|' | \
+ tr '\n' ' ' | \
+ sed 's| -o $||'
+)"
+
+ssh wurzel '
+ find /usr/bin texmf M/texmf -xdev -type f -exec sha512sum {} \; 2> /dev/null
+ find / . -xdev -type f \( '"${matchExpr}"' \) -exec sha512sum {} \; 2> /dev/null
+' | \
+ grep "${summen}" | \
+ sort -u | \
+ sed '
+ /texmf\|bin/{
+ s|^\(\S\+\)\s\+|\1 0 |;
+ be;
+ }
+ /digital-server/{
+ s|^\(\S\+\)\s\+|\1 1 |;
+ be;
+ }
+ /[sS]tyles/{
+ s|^\(\S\+\)\s\+|\1 2 |;
+ be;
+ }
+ s|^\(\S\+\)\s\+|\1 3 |;
+ :e
+ ' | \
+ sort | \
+ uniq -m1 | \
+ cut -d' ' -f3 | \
+ sed 's|^\./||' | \
+ sort
+
+beenden 0