diff options
-rwxr-xr-x | bin/poolify | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/bin/poolify b/bin/poolify index f47f2f3..6f9a109 100755 --- a/bin/poolify +++ b/bin/poolify @@ -14,11 +14,18 @@ main() { shopt -s nullglob echo '# Pass 1' + declare -A rewrite + rewrite[200109261739]=200303310700 while read -r snap name date time size; do dirpart="${name%/*}" filepart="${name##*/}" - filedir=dat/pools/files/"${date//-/}${time//:/}-${name//\//_}" + datetime="${date//-/}${time//:/}" + datetime="${rewrite[$datetime]:-$datetime}" + filedir=dat/pools/files/"${datetime}-${name//\//_}" snapdir=dat/pools/snaps/"${snap}-${dirpart//\//_}" + if [[ -d "${filedir/.OLD/}" ]]; then + filedir="${filedir/.OLD/}" + fi mkdir -p -- "$filedir" "$snapdir" ln -sr "$filedir/$filepart" "$snapdir" done < "$1" @@ -59,9 +66,7 @@ main() { ln -sr "$filedir/$filepart" "$snapdir" done done < <(printf '%s\n' \ - '200303310700 PROGRAMS/CVTUTF ConvertUTF.c ConvertUTF.h harness.c' \ '200307291500 ALPHA/CVTUTF-1-1 ExpectedOutput.txt readme.txt' \ - '200412210100 PROGRAMS/CVTUTF.OLD CVTUTF7.C CVTUTF7.H' \ ) echo '# Pass 2' @@ -75,6 +80,11 @@ main() { fi pools=(dat/pools/files/*-"${name//\//_}") + if [[ "$name" = *.OLD* ]]; then + pname="${name//\//_}" + pools+=(dat/pools/files/*-"${pname/.OLD/}") + readarray -t pools < <(printf '%s\n' "${pools[@]}" | sort) + fi pools=("${pools[@]##*/}") mypool='' |