diff options
author | Erich Eckner <git@eckner.net> | 2016-10-24 13:13:51 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2016-10-24 13:13:51 +0200 |
commit | 8e4b55ef6633cf318566d4d48d84703b209ab2ea (patch) | |
tree | cdc678782e64f33560b7f44b03c973a2c9cd9e9a /finde-dateien | |
download | wurzel-paket-tools-8e4b55ef6633cf318566d4d48d84703b209ab2ea.tar.xz |
initial commit
Diffstat (limited to 'finde-dateien')
-rwxr-xr-x | finde-dateien | 74 |
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 |