Collect together utilities for maintenance - EXPORTS.ALL WHEREIS.HASH etc
This commit is contained in:
7
scripts/fixlinks
Executable file
7
scripts/fixlinks
Executable 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
9
scripts/fixlinks.awk
Executable 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;}
|
||||
Reference in New Issue
Block a user