Created
November 24, 2022 19:25
-
-
Save hradec/7f41cb2142614cb8f60fceca9723c6c6 to your computer and use it in GitHub Desktop.
zerotier download debian and uncompress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.