diff options
-rw-r--r-- | README.md | 0 | ||||
-rw-r--r-- | TODO.md | 0 | ||||
-rwxr-xr-x | debian-dl | 87 | ||||
-rwxr-xr-x | tails-dl | 45 | ||||
-rwxr-xr-x | tor-browser-dl | 70 |
5 files changed, 202 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/README.md diff --git a/debian-dl b/debian-dl new file mode 100755 index 0000000..3558085 --- /dev/null +++ b/debian-dl @@ -0,0 +1,87 @@ +#!/bin/bash +# +# Simple Debian image downloader. +# + +# Parameters +HASHES="MD5SUMS SHA1SUMS SHA256SUMS SHA512SUMS" + +# Arguments +BASENAME="`basename $0`" +URL="$1" +BASE="`dirname $URL`" +RATE="$2" +FILENAME="`basename $URL`" + +# Syntax +if [ -z "$1" ]; then + echo "usage: $BASENAME <image-url>" + exit 1 +fi + +# Determine signature extension +if echo $FILENAME | grep -qe '^debian-live'; then + SIGN="sig" +else + SIGN="sign" +fi + +# Fetch hashes +for hash in $HASHES; do + wget -c $BASE/$hash + wget -c $BASE/$hash.$SIGN +done + +# Determine transfer method +if echo $FILENAME | grep -qe '.jigdo$'; then + # Check for jigdo + if ! which jigdo-lite &> /dev/null; then + echo "Please install jigdo-file" + exit 1 + fi + + # Get the image using jigdo + jigdo-lite $URL + + # Fix filename + FILENAME="`basename $FILENAME .jigdo`.iso" +elif echo $FILENAME | grep -qe '.zsync$'; then + # Check for zsync + if ! which zsync &> /dev/null; then + echo "Please install zsync" + exit 1 + fi + + # Get the image using zsync + zsync $URL + + # Fix filename + FILENAME="`basename $FILENAME .zsync`" +else + # Check for wget + if ! which wget &> /dev/null; then + echo "Please install wget" + exit 1 + fi + + # Set rate limit + if [ ! -z "$RATE" ]; then + LIMIT="--limit-rate=$RATE" + fi + + # Get the image using wget + wget -c $LIMIT $URL +fi + +# Check hashes +for hash in $HASHES; do + echo "Checking $FILENAME against $hash file..." + check="`echo $hash | tr '[:upper:]' '[:lower:]' | sed -e 's/s$//'`" + grep -e "$FILENAME$" $hash | $check -c +done + +# Check hash integrity +for hash in $HASHES; do + echo "Checking $hash.$SIGN..." + gpg --verify $hash.$SIGN +done diff --git a/tails-dl b/tails-dl new file mode 100755 index 0000000..685e3b3 --- /dev/null +++ b/tails-dl @@ -0,0 +1,45 @@ +#!/bin/bash +# +# Download the Tails +# + +# Parameters +BASENAME="`basename $0`" +DL="$HOME/data/apps/distros/tails/" +VERSION="$1" +BASE_URL="http://dl.amnesia.boum.org/tails/stable/tails-i386-$VERSION" +CWD="`pwd`" + +# Syntax check +if [ -z "$VERSION" ]; then + echo "usage: $BASENAME <version>" + echo "example: $BASENAME 0.22" + exit 1 +fi + +# Set file names +FILE="tails-i386-$VERSION.iso" +HYBRID="tails-i386-$VERSION.hybrid.iso" +SIGN="$FILE.sig" + +# Download package +if [ ! -e "$DL/$FILE" ]; then + wget -c $BASE_URL/$FILE -O $DL/$FILE || exit 1 +fi + +# Download signature +if [ ! -e "$DL/$SIGN" ]; then + wget -c $BASE_URL/$SIGN -O $DL/$SIGN || exit 1 +fi + +# Check signature +gpg --verify $DL/$SIGN $DL/$FILE || exit 1 + +# Symlink and hybrid version +cd $DL +ln -sf $FILE tails-i386-latest.iso +ln -sf $SIGN tails-i386-latest.iso.sig +cp $FILE $HYBRID +ln -sf $HYBRID tails-i386-latest.hybrid.iso +isohybrid $HYBRID +cd $CWD diff --git a/tor-browser-dl b/tor-browser-dl new file mode 100755 index 0000000..5609841 --- /dev/null +++ b/tor-browser-dl @@ -0,0 +1,70 @@ +#!/bin/bash +# +# Download the Tor Browser Bundle. +# + +# Parameters +BASENAME="`basename $0`" +APPS="$HOME/apps" +APP_BASE="$APPS/tor-browser" +TEMP="$TMP/tor-browser" +DL="$HOME/data/apps/distros/tor/" +VERSION="$1" +ARCH="$2" +LANG="$3" +BASE_URL="https://www.torproject.org/dist/torbrowser/$VERSION" + +# Syntax check +if [ -z "$VERSION" ]; then + echo "usage: $BASENAME <version> [arch] [lang]" + echo "example: $BASENAME 2.3.25-14-dev linux64 en-US" + exit 1 +fi + +# Set arch +if [ -z "$ARCH" ]; then + ARCH="linux64" +fi + +# Set lang +if [ -z "$LANG" ]; then + LANG="en-US" +fi + +# Set file names +FILE="tor-browser-$ARCH-$VERSION"_"$LANG.tar.xz" +SIGN="$FILE.asc" + +# Check existing installation +if [ -d "$APP_BASE/$ARCH-$VERSION" ]; then + echo "TBB version $VERSION for $ARCH already installed" + exit 1 +fi + +# Temp folder +mkdir -p $TEMP + +# Download package +if [ ! -e "$DL/$FILE" ]; then + wget -c $BASE_URL/$FILE -O $DL/$FILE || exit 1 +fi + +# Download signature +if [ ! -e "$DL/$SIGN" ]; then + wget -c $BASE_URL/$SIGN -O $DL/$SIGN || exit 1 +fi + +# Check signature +gpg --verify $DL/$SIGN $DL/$FILE || exit 1 + +# Unpack +( cd $TEMP && tar xf $DL/$FILE ) || exit 1 + +# Move and symlink +mv $TEMP/tor-browser_$LANG $APP_BASE/$ARCH-$VERSION +rm -rf $APP_BASE/$ARCH && \ +( cd $APP_BASE && ln -sf $ARCH-$VERSION $ARCH ) + +# Cleanup +rm -rf $TEMP +echo "Please check and cleanup old versions at $APP_BASE" |