Skip to content

Commit

Permalink
add script to download lastest Unbound version for docs
Browse files Browse the repository at this point in the history
  • Loading branch information
TCY16 committed Dec 10, 2021
1 parent 4877153 commit 351184c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build/
.DS_Store
.vscode
source/_build
source/_build
source/unbound-*
3 changes: 3 additions & 0 deletions source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@
[author], 1)
]

# Execute custom script to download the latest version of Unbound
exec(open("get_unbound_latest.py").read())


# -- Options for Texinfo output ----------------------------------------------

Expand Down
19 changes: 19 additions & 0 deletions source/get_unbound_latest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import requests
import tarfile
import os.path
from os import path

latest_str = "unbound-latest.tar.gz"

url = "https://nlnetlabs.nl/downloads/unbound/" + latest_str

if path.exists("latest_str"):
exit()

r = requests.get(url, allow_redirects=True)

open(latest_str, 'wb').write(r.content)

tar = tarfile.open(latest_str, "r:gz")
tar.extractall()
tar.close()

0 comments on commit 351184c

Please sign in to comment.