1
0
mirror of synced 2026-01-25 20:06:44 +00:00

Collect together utilities for maintenance - EXPORTS.ALL WHEREIS.HASH etc

This commit is contained in:
Larry Masinter
2021-01-16 22:22:16 -08:00
parent 64b2a4978a
commit 6b5817a279
9 changed files with 18 additions and 1 deletions

7
scripts/fixlinks Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
# first find the files, calculate hash, sort by version then by hash+name excluding version
find . -type f -print0 | xargs -0 -n200 shasum | sort -t '~' --key=2,2n | sort -s -t '~' --key=1,1 >/tmp/medleyfiles
# now process the file list into the commands to fix up the links
awk -f scripts/fixlinks.awk /tmp/medleyfiles >/tmp/doit

9
scripts/fixlinks.awk Executable file
View File

@@ -0,0 +1,9 @@
BEGIN {hash="0"; gc = 0;}
function processgroup(group, gc) {
printf("# processing group of %d files -- ",gc);
for (i=1; i <= gc; i++) printf("'%s' ",group[i]);
printf("\n");
printf("rm '%s' && ln '%s' '%s'\n", group[gc],group[1], group[gc]);
}
hash == $1 && 1 == index($2, group[1]) {gc = gc + 1; group[gc] = $2; }
hash != $1 || 1 != index($2, group[1]) { if (gc > 1) processgroup(group, gc); delete group; hash = $1; gc = 1; group[gc] = $2;}