Skip to content

Commit

Permalink
[package] [ftr-osmc] Remove leading zeros on IP addresses that would …
Browse files Browse the repository at this point in the history
…cause connman to failure to configure the network.
  • Loading branch information
DBMandrake committed Jun 20, 2015
1 parent fb18d1c commit fee15a7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package/ftr-osmc/files/DEBIAN/control
@@ -1,5 +1,5 @@
Origin: OSMC
Version: 1.3.9
Version: 1.4.0
Section: tasks
Essential: No
Priority: required
Expand Down
26 changes: 16 additions & 10 deletions package/ftr-osmc/files/usr/bin/preseed
Expand Up @@ -44,6 +44,12 @@ def getvalue(valuestring):
line = splitvalue[3].replace("\r", "")
return line.replace("\n", "")

def format_ip(ipstring):
a = ipstring.split('.')
for i, s in enumerate(a):
a[i] = str(int(s,base=10))
return a[0] + '.' + a[1] + '.' + a[2] + '.' + a[3]

def make_variant(string):
return dbus.String(string, variant_level=1)

Expand Down Expand Up @@ -71,20 +77,20 @@ def main():
syslog.syslog("DHCP is set to " + getvalue(line))
network["auto"] = getvalue(line)
if line.startswith("d-i network/ip string"):
syslog.syslog("IP address is set to " + getvalue(line))
network["ip"] = getvalue(line)
syslog.syslog("IP address is set to " + format_ip(getvalue(line)))
network["ip"] = format_ip(getvalue(line))
if line.startswith("d-i network/mask string"):
syslog.syslog("Subnet mask is set to " + getvalue(line))
network["mask"] = getvalue(line)
syslog.syslog("Subnet mask is set to " + format_ip(getvalue(line)))
network["mask"] = format_ip(getvalue(line))
if line.startswith("d-i network/dns1 string"):
syslog.syslog("DNS1 is set to " + getvalue(line))
network["dns1"] = getvalue(line)
syslog.syslog("DNS1 is set to " + format_ip(getvalue(line)))
network["dns1"] = format_ip(getvalue(line))
if line.startswith("d-i network/dns2 string"):
syslog.syslog("DNS2 is set to " + getvalue(line))
network["dns2"] = getvalue(line)
syslog.syslog("DNS2 is set to " + format_ip(getvalue(line)))
network["dns2"] = format_ip(getvalue(line))
if line.startswith("d-i network/gw string"):
syslog.syslog("Gateway is set to " + getvalue(line))
network["gw"] = getvalue(line)
syslog.syslog("Gateway is set to " + format_ip(getvalue(line)))
network["gw"] = format_ip(getvalue(line))
if line.startswith("d-i network/ssid string"):
syslog.syslog("SSID is set to " + getvalue(line))
network["ssid"] = getvalue(line)
Expand Down

0 comments on commit fee15a7

Please sign in to comment.