3 #=======================================================================
5 # File ID: 571d0be4-08ef-11de-8399-000475e441b9
6 # Creates Files.json in current directory.
7 #=======================================================================
9 # FIXME: Why doesn’t the ^ (caret) work with "grep -z" ?
11 test -w /tmp
/. ||
{ echo mkFiles
: /tmp
/: Directory not writable or not found
>&2; exit 1; };
13 until mkdir
$lockname 2>/dev
/null
; do
14 echo $0: $lockname: Waiting
for lock...
>&2
19 if test "$1" = "-m"; then
24 tmpjson
=/tmp
/.mkFiles.
$uuid.tmp
25 find "$@" -type f
-print0 | \
26 grep -zv '/\.git/' | \
27 LC_COLLATE
=C
sort -z | \
28 fldb
-z -f - >>$tmpjson
29 mv $tmpjson Files.json
30 fileinfo
="$(fldb Files.json | json_reformat -m)"
31 uuid
=`suuid$suuid_m -t mkfiles --raw -w eo -c "<c_mkfiles> <host>$(hostname)</host> <directory>$(/bin/pwd)</directory> <fileinfo>$fileinfo</fileinfo> </c_mkfiles>"` ||
{ echo mkFiles
: suuid error
>&2; rmdir $lockname; exit 1; }