Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds+github@gmail.com>2019-11-27 22:25:59 +0000
committerAnton Hvornum <anton.feeds+github@gmail.com>2019-11-27 22:25:59 +0000
commit9d984957feb3810461312f5cdeaf4b235c180ea9 (patch)
tree7a35e45ca0243a9b0200ea07af6d09821a837e99
parentd4c2fd61aad5010349767729eb913a75996de74c (diff)
Missing parameter in guess_country()
-rw-r--r--archinstall.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/archinstall.py b/archinstall.py
index 548f9355..33c39827 100644
--- a/archinstall.py
+++ b/archinstall.py
@@ -752,7 +752,7 @@ def get_external_ip(*positionals, **kwargs):
result = urllib.request.urlopen("https://hvornum.se/ip/?f=json").read().decode('UTF-8')
return json.loads(result)['ip']
-def guess_country(*positionals, **kwargs):
+def guess_country(ip, *positionals, **kwargs):
# python-pygeoip
# geoip-database
result = None
@@ -761,6 +761,7 @@ def guess_country(*positionals, **kwargs):
try:
import pygeoip
except:
+ ## TODO: Do a best-effort-guess based off the hostname given off the IP instead, if GoeIP doesn't exist.
return result
gi = pygeoip.GeoIP(GEOIP_DB)
@@ -818,9 +819,7 @@ def setup_args_defaults(args, interactive=True):
country = None
if get_default_gateway_linux():
ip = get_external_ip()
- print('IP:', ip)
country = guess_country(ip)
- print('Country:', country)
args['country'] = 'all' if not country else country
if not 'localtime' in args: args['localtime'] = 'Europe/Stockholm' if args['country'] == 'SE' else 'GMT+0' # TODO: Arbitrary for now