diff --git a/burrow b/burrow index 9335ba8..87b4e79 100755 --- a/burrow +++ b/burrow @@ -22,14 +22,26 @@ ### ## function get_dirs(){ - src_id="$1" + src_type=$(echo "$1" | cut -d "|" -f 1) + src_sel=$(echo "$1" | cut -d "|" -f 2 | cut -d "?" -f 1) + src_host=$(echo "$1" | cut -d "|" -f 3) + src_port=$(echo "$1" | cut -d "|" -f 4) + src_id=$(echo "$1" | cut -d "|" -f 5) + ##echo "src_sel: \"${src_sel}\"" >&2 OLDIFS=$IFS #IFS=$'\t\n' IFS="|" src_dir=$(echo "${src_id}" | cut -c -2) touch "${src_dir}/${src_id}" while read name sel host port; do + ##echo "sel: \"$sel\"" >&2 + [ "$sel" = "Err" -o -z "$sel" ] && continue TYPE=$(echo "$name" | cut -c 1) + [ "$TYPE" = "i" ] && continue + dst_sel=$(echo "$sel" | cut -d "?" -f 1) + ##echo "dst_sel: \"${dst_sel}\"" >&2 + [ "${dst_sel}" = "${src_sel}" -a "${src_type}" = "$TYPE" \ + -a "${src_host}" = "$host" -a "${src_port}" = "$port" ] && continue; port=$(echo $port | sed -r -e 's/\r//g') dir_id=$(echo "${TYPE}|${sel}|${host}|${port}" | sed 's/^1||/1|\/|/g') dest_id=$(echo "${dir_id}" | sha256sum | cut -d " " -f 1 ) @@ -91,6 +103,6 @@ echo "selector ${src_id} not found" >> logfile.txt MYNAME=$(basename $0) if [ -z "${MYNAME##burrow}" ]; then - retrieve_selector "$SRC" | sed -r -e 's/\t/|/g' | get_dirs "${src_id}" + retrieve_selector "$SRC" | sed -r -e 's/\t/|/g' | get_dirs "$SRC" fi