summaryrefslogtreecommitdiff
path: root/burrow
diff options
context:
space:
mode:
Diffstat (limited to 'burrow')
-rwxr-xr-xburrow23
1 files changed, 21 insertions, 2 deletions
diff --git a/burrow b/burrow
index 2665d21..8138ca5 100755
--- a/burrow
+++ b/burrow
@@ -7,6 +7,19 @@
###
### where SHA256 is the SHA256SUM of "1|SELECTOR|HOST|PORT"
###
+### *** DRY RUN ***
+###
+### If run as burrow?* (i.e., "burrow" followed by at least one
+### character), burrow will run in DRY MODE, i.e., it will just check
+### if the id provided as input exists, and then exit.
+###
+###------------------------------------------------
+###
+### (C) Vincenzo 'KatolaZ' Nicosia <katolaz@freaknet.org>
+###
+### Use, modify, redistribute under the terms of the GNU General
+### Public License version 3 or, at your option, any other version.
+###
## function
get_dirs(){
src_id="$1"
@@ -56,7 +69,7 @@ retrieve_selector(){
check_selector_present(){
sel_id="$1"
sel_dir="$(echo ${sel_id} | cut -c -2)"
- [ -d "${sel_dir}" -a -f "${sel_dir}/${sel_id}" ] && exit
+ [ -d "${sel_dir}" -a -f "${sel_dir}/${sel_id}" ] && echo "${SRC}" >>present && exit
## {
## if at least one of the neighbours of sel_id is missing, cat the entire list of
## neighbours to be re-visited and exit
@@ -69,6 +82,8 @@ check_selector_present(){
[ ! -d "${sel_dir}" ] && mkdir -p "${sel_dir}"
}
+[ $# -lt 1 ] && echo "Usage: $0 <gopherlink>" && exit 1
+
SRC="$1"
@@ -78,5 +93,9 @@ check_selector_present "${src_id}"
echo "selector ${src_id} not found" >> logfile.txt
-retrieve_selector "$SRC" | sed -r -e 's/\t/|/g' | get_dirs "${src_id}"
+MYNAME=$(basename $0)
+
+if [ -z "${MYNAME##burrow}" ]; then
+ retrieve_selector "$SRC" | sed -r -e 's/\t/|/g' | get_dirs "${src_id}"
+fi