radio24/TorBox

change method of getting latest tor releases

nyxnor opened this issue · 2 comments

instead of

readarray -t torversion_datesorted < <(curl --silent $TORURL | grep $TORPATH_TO_RELEASE_TAGS | sed -e "s/${TOR_HREF_FOR_SED}//g" | sed -e "s/\">//g")

which also happens on the update script,

use

git ls-remote --tags https://github.com/torproject/tor.git | grep -v "\^{}\|\-[a-z].*$" | grep -oP "tor-\K.*" | tail -5

can add torsocks git or git -c http.proxy=socks5h://192.168.42.1:9052

This method garantees to get all the tags tan tail them to max number of lines, old method with curl was only getting what was displayed on that page, which is limited.
Also using a git method native to git repos.

Notice I am discarding -rc and -alpha and -alpha-dev.

I want to have at least one older version of tor in the list and -rc and -alpha and -alpha-dev because I want to allow the experienced user to go at least one full version back and to install developer versions.

Let's compare the output of the two possibilities

Current version
curl --silent https://github.com/torproject/tor/releases | grep /torproject/tor/releases/tag/ | sed -e "s/<a href=\"\/torproject\/tor\/releases\/tag\/tor-//g" | sed -e "s/\">//g"

0.4.7.1-alpha
0.4.6.7
0.4.5.10
0.3.5.16
0.4.6.6
0.4.6.5
0.4.5.9
0.4.4.9
0.3.5.15
0.4.6.4-rc

The list is sorted by release date and will later be compacted and sorted by version, which gives on v.0.4.2.the following list (currently, there are some bugs in the v.0.4.3 branch, which I'm going to fix):

1 -       0.4.7.1-alpha
2 -       0.4.6.7
3 -       0.4.5.9 <-- REMARK: this is a bug!! Should be 0.4.5.10
4 -       0.4.4.9
5 -       0.3.5.16

Proposed version (I changed tail from -5 to -10 to have the same amount of output)
git ls-remote --tags https://github.com/torproject/tor.git | grep -v "\^{}\|\-[a-z].*$" | grep -oP "tor-\K.*" | tail -10

0.4.4.8
0.4.4.9
0.4.5.10
0.4.5.6
0.4.5.7
0.4.5.8
0.4.5.9
0.4.6.5
0.4.6.6
0.4.6.7

This is obviously the reverse sorted list by versions (without the developer versions). Compacted, this will give the following:

1 -       0.4.6.7
2 -       0.4.5.10
4 -       0.4.4.9

That's not the result I want.

The installation script doesn't install tor through the tor socket because tor is not running yet. In the update script, the tor socket is used, and if that doesn't work, the script asks the user if it can directly access the repository without going through the tor network.

got it, thanks for the explanation.