Skip to content

Commit

Permalink
handle multiple seedboxen
Browse files Browse the repository at this point in the history
  • Loading branch information
tmaher committed Aug 30, 2014
1 parent d92eb46 commit 942d64d
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions misc/seedstuff-sync
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
#!/bin/bash -x

HOST=`grep "machine .*\.seedstuff\.ca" "$HOME/.netrc" | cut -f 2 -d \ `
USER=`grep -A 2 "machine .*\.seedstuff\.ca" "$HOME/.netrc" | \
sed -e 's/^ *//' | grep login | cut -f 2 -d \ `
TARGET_DIR=${1:-"."}
CA_URL="https://support.comodo.com/index.php?/Knowledgebase/Article/GetAttachment/943/30"
CA_FILE="${HOME}/.seedstuff_ca.crt"

TARGET_DIR=${1:-"."}

if [ ! -d "${TARGET_DIR}" ]; then
echo "ERROR: No such directory: ${TARGET_DIR}" >&2
exit 1
fi

if ! type -p wget >/dev/null; then
echo "ERROR: Need wget. Please install" >&2
exit 1
Expand All @@ -24,9 +15,20 @@ fi

cd "${TARGET_DIR}"

wget --accept-regex "/$USER/" --ca-certificate="${CA_FILE}" \
-m https://${HOST}/${USER}/
for SEEDBOX in `grep "machine .*\.seedstuff\.ca" "$HOME/.netrc" | \
sed -e 's/^ *//' | cut -f 2 -d \ `; do
USER=`grep -A 2 "machine ${SEEDBOX}" "$HOME/.netrc" | \
sed -e 's/^ *//' | grep login | cut -f 2 -d \ `

if [ ! -d "${TARGET_DIR}" ]; then
echo "ERROR: No such directory: ${TARGET_DIR}" >&2
exit 1
fi

# clean up the silly index files
find "${HOST}" -name index.html* -print0 | \
xargs -0 rm
wget --accept-regex "/$USER/" --ca-certificate="${CA_FILE}" \
-m https://${SEEDBOX}/${USER}/

# clean up the silly index files
find "${SEEDBOX}" -name index.html* -print0 | \
xargs -0 rm
fi

0 comments on commit 942d64d

Please sign in to comment.