Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
zerotier download debian and uncompress
#!/bin/bash
v=$1
if [ "$v" == "" ] ; then
v=-1
fi
list=$(curl -L 'https://download.zerotier.com/RELEASES/' | gzip -d || curl -L 'https://download.zerotier.com/RELEASES/')
list=$(echo "$list" | awk -F'"' '{print $2}' | sort -V )
n=$(echo "$list" | wc -l | egrep -v '^$')
let n=$n-5
for l in $list ; do
echo -$n $l
let n=$n-1
done
last=$(echo "$list" | tail $v | head -1 )
cmd="curl -L 'https://download.zerotier.com/RELEASES/$last/dist/debian/buster/'"
echo $cmd
files=$(eval $cmd || curl -L "https://download.zerotier.com/RELEASES/$last/dist/debian/buster/" | gzip -d )
file=$(echo "$files" | grep amd | grep .deb | awk -F'"' '{print $2}')
cmd="curl -O -L 'https://download.zerotier.com/RELEASES/$last/dist/debian/buster/$file'"
echo $cmd
eval $cmd
if [ -e $file ] ; then
dir=$(echo $file | sed 's/.deb//')
mkdir -p $dir
cd $dir
ar x ../$file
tar xf data.*
rm data.* control.* debian-*
rm ../$file
fi
@hradec
Copy link
Author

hradec commented Nov 24, 2022

Downloads zerotier .deb packages (buster) and compresses it.
It lists all available versions, and one can pass a -N argument to select what version to download. Default is -1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment