scripts

misc scripts and tools
git clone git://git.2f30.org/scripts.git
Log | Files | Refs

commit 8126c79b346ffcc739880358b2186c602d68a472
parent ac8d0d1cde058f3d2157ac03b8af46f57e0c8cad
Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Date:   Wed Nov 27 11:06:11 +0000

Rename destiny-get to itor

Diffstat:
destiny-get | 50--------------------------------------------------
itor | 50++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 50 deletions(-)
diff --git a/destiny-get b/destiny-get @@ -1,50 +0,0 @@ -#!/bin/sh - -host=sin@amnezia.2f30.org -# remote directory -rdir=torrents -# local directory -ldir=~/torrents - -listing=$(mktemp) -ssh $host "ls $rdir" > $listing -idx=0 -while read f; do - echo "$idx: $f" - ((idx=idx+1)) -done < $listing - -if [ $idx -eq 0 ]; then - echo "No files to serve" - exit 0 -fi - -isnum() { test "$1" && printf '%d' "$1" >/dev/null 2>/dev/null; } - -while :; do - read -p "Your selection: " index - isnum $index - if [ $? -eq 0 ]; then - if [ $index -ge $idx ]; then - echo "invalid selection: $index" - continue - fi - else - echo "not a number: $index" - continue - fi - break -done - -idx=0 -while read f; do - if [ $index -eq $idx ]; then - break - fi - ((idx=idx+1)) -done < $listing - -escapedfile=$(echo ${f// /\\ }) -rsync --partial --progress -av -e ssh $host:"$rdir/$escapedfile" "$ldir" - -rm $listing diff --git a/itor b/itor @@ -0,0 +1,50 @@ +#!/bin/sh + +host=sin@amnezia.2f30.org +# remote directory +rdir=torrents +# local directory +ldir=~/torrents + +listing=$(mktemp) +ssh $host "ls $rdir" > $listing +idx=0 +while read f; do + echo "$idx: $f" + ((idx=idx+1)) +done < $listing + +if [ $idx -eq 0 ]; then + echo "No files to serve" + exit 0 +fi + +isnum() { test "$1" && printf '%d' "$1" >/dev/null 2>/dev/null; } + +while :; do + read -p "Your selection: " index + isnum $index + if [ $? -eq 0 ]; then + if [ $index -ge $idx ]; then + echo "invalid selection: $index" + continue + fi + else + echo "not a number: $index" + continue + fi + break +done + +idx=0 +while read f; do + if [ $index -eq $idx ]; then + break + fi + ((idx=idx+1)) +done < $listing + +escapedfile=$(echo ${f// /\\ }) +rsync --partial --progress -av -e ssh $host:"$rdir/$escapedfile" "$ldir" + +rm $listing