Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall.py
diff options
context:
space:
mode:
authorLord Anton Hvornum <anton.feeds@gmail.com>2018-04-08 13:06:52 +0200
committerLord Anton Hvornum <anton.feeds@gmail.com>2018-04-08 13:07:02 +0200
commitdff83ac7b8f1be247aa3914f7ca3d94c53e30373 (patch)
treef2e908f17c85ae5994133bcec8f3967a59fe477a /archinstall.py
parent3059b1d5048335cc1b593adbd469a870f453d6ba (diff)
More debugging
Diffstat (limited to 'archinstall.py')
-rw-r--r--archinstall.py46
1 files changed, 27 insertions, 19 deletions
diff --git a/archinstall.py b/archinstall.py
index adef8770..a48191ad 100644
--- a/archinstall.py
+++ b/archinstall.py
@@ -1,4 +1,5 @@
#!/usr/bin/python3
+import traceback
import psutil, os, re, struct, sys, json
import urllib.request, urllib.parse
from glob import glob
@@ -154,27 +155,34 @@ if __name__ == '__main__':
## == If we got networking,
# Try fetching instructions for this box and execute them.
+ instructions = {}
if get_default_gateway_linux():
locmac = get_local_MACs()
- for mac in locmac:
- try:
- instructions = grab_url_data('https://raw.githubusercontent.com/Torxed/archinstall/net-deploy/deployments/{}.json'.format(mac))
- except urllib.error.HTTPError:
- print('[N] No instructions for this box on this mac: {}'.format(mac))
- continue
-
- #print('Decoding:', instructions)
- try:
- instructions = json.loads(instructions.decode('UTF-8'), object_pairs_hook=oDict)
- except:
- print('[E] JSON instructions failed to load for {}'.format(mac))
- instructions = {}
- sleep(5)
- continue
-
- if 'args' in instructions:
- for key, val in instructions['args'].items():
- args[key] = val
+ if not len(locmac):
+ print('[N] No network interfaces - No net deploy.')
+ else:
+ for mac in locmac:
+ try:
+ instructions = grab_url_data('https://raw.githubusercontent.com/Torxed/archinstall/net-deploy/deployments/{}.json'.format(mac))
+ except urllib.error.HTTPError:
+ print('[N] No instructions for this box on this mac: {}'.format(mac))
+ continue
+
+ #print('Decoding:', instructions)
+ try:
+ instructions = json.loads(instructions.decode('UTF-8'), object_pairs_hook=oDict)
+ except:
+ print('[E] JSON instructions failed to load for {}'.format(mac))
+ traceback.print_exc()
+ instructions = {}
+ sleep(5)
+ continue
+
+ if 'args' in instructions:
+ for key, val in instructions['args'].items():
+ args[key] = val
+ else:
+ print('[N] No gateway - No net deploy')
print(args)