Skip to content

Instantly share code, notes, and snippets.

@notpeter
Last active September 5, 2023 13:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save notpeter/71b3e2e422708544600b to your computer and use it in GitHub Desktop.
Save notpeter/71b3e2e422708544600b to your computer and use it in GitHub Desktop.
Dante SOCKS Proxy - Source Code History Git Import
#/bin/bash
set -e
# Downloads the dante socks proxy source code and builds up a version history in a git repository.
# Note: OSX/BSDs have alternate 'stat' syntax so we need GNU stat there.
# Usage:
# git init
# ./dante_history_import.sh
#
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "Checking for gstat. If missing install GNU stat: brew install coreutils to get gstat"
which gstat
alias stat=gstat
fi
versions=( "0.90.0" "0.91.0" "0.91.1" "0.92.0-pre1" "0.92.0-pre2" "0.92.0-pre3" "1.0.0-pre1" "1.0.0" "1.0.1" "1.1.0-pre1" "1.1.0-pre2" "1.1.0" "1.1.1-pre1" "1.1.1" "1.1.10-pre1" "1.1.10" "1.1.11-pre1" "1.1.11-pre2" "1.1.11-pre3" "1.1.11" "1.1.12-pre1" "1.1.12" "1.1.13-pre1" "1.1.13" "1.1.14-pre1" "1.1.14" "1.1.15-pre1" "1.1.15-pre2" "1.1.15-pre3" "1.1.15" "1.1.16-pre1" "1.1.16-pre2" "1.1.16" "1.1.17" "1.1.18" "1.1.19-pre1" "1.1.19" "1.1.2-pre1" "1.1.2-pre2" "1.1.2" "1.1.3" "1.1.4" "1.1.5" "1.1.6" "1.1.7" "1.1.8" "1.1.9" "1.2.0-pre1" "1.2.0-pre2" "1.2.0-pre3" "1.2.0" "1.2.1" "1.2.2" "1.2.3" "1.3.0-pre1" "1.3.0" "1.3.1" "1.3.2" "1.4.0-pre1" "1.4.0-pre2" "1.4.0" "1.4.1" "1.4.2")
old_base='ftp://ftp.inet.no/pub/socks/old'
current_base='ftp://ftp.inet.no/pub/socks'
current_version="1.4.3"
#takes two params: $1=version $2=url
function process_version {
rm -rf dante/
mkdir dante
pushd dante
wget -N "$2"
release_date=`stat -c %y *.tar.gz`
tar --strip-components=1 -zxf *.tar.gz
rm *.tar.gz
popd
git add dante --all
export GIT_AUTHOR_DATE="$release_date"
export GIT_COMMITTER_DATE="$release_date"
git commit -m "Dante $1" --date="$release_date"
git tag "dante-$1"
}
read -p "This is gonna run rm -rf * in $PWD/dante a couple dozen times. Is this what you want? [y/n]" -n 1 -r
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
mkdir -p dante
git config user.name "Inferno Nettverk" && git config user.email "sdc@inet.no"
for version in ${versions[@]}; do
process_version "$version" "$old_base/dante-$version.tar.gz"
done
process_version "$current_version" "$current_base/dante-$current_version.tar.gz"
echo "All done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment