From d0e25535910ab36ac6029cbb6e89a1dab5dfbe8a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 2 Jul 2017 19:29:19 -0400 Subject: add mechanisms to avoid 2 of the overrides --- bin/poolify | 16 +++++++++++++--- 1 file 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='' -- cgit v1.2.3-54-g00ecf