Skip to content

Commit

Permalink
Download all versions of the xflux binary
Browse files Browse the repository at this point in the history
To make it easier to test if you're experiencing the dreaded
Issue #27.

And make the magic numbers less magic.
  • Loading branch information
ntc2 committed Dec 24, 2018
1 parent a1edb4d commit 411d216
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ dist/
build/
/xflux
/installed.txt
/xflux11
/xflux12
21 changes: 14 additions & 7 deletions download-xflux.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
#!/usr/bin/env python3

from sys import maxsize
import subprocess

# There is similar code in ./debian/postinst. If you are changing this
# you probably want to change that too.
def download_xflux():
# Determines which is the appropriate executable for 32-bit
if maxsize == 2147483647:
if maxsize == 2**31 - 1:
print("Downloading 32-bit xflux ...")
url = "https://justgetflux.com/linux/xflux-pre.tgz"
elif maxsize == 9223372036854775807:
urls = ["https://justgetflux.com/linux/xflux-pre.tgz"]
elif maxsize == 2**63 - 1:
print("Downloading 64-bit xflux ...")
url = "https://justgetflux.com/linux/xflux64.tgz"
tarchive = "/tmp/xflux.tgz"
subprocess.call(['wget', url, '-O', tarchive])
subprocess.call(['tar', '-xvf', tarchive])
urls = ["https://justgetflux.com/linux/xflux64.tgz",
"https://justgetflux.com/linux/xflux11.tgz",
"https://justgetflux.com/linux/xflux12.tgz"]
else:
raise Exception("Unexpected maxsize = %i!" % maxsize)
for url in urls:
tarchive = "/tmp/xflux.tgz"
subprocess.call(['wget', url, '-O', tarchive])
subprocess.call(['tar', '-xvf', tarchive])

if __name__ == '__main__':
download_xflux()

0 comments on commit 411d216

Please sign in to comment.