Pour la borne "non-configure", on ne met pas de nvram.updates...

darcs-hash:20050908212513-d1718-4b9012ce1cf57f764572203d245b335bdcd3b195.gz
This commit is contained in:
bernat 2005-09-08 23:25:13 +02:00
parent 6b88caeaf9
commit af60dc2f53

View file

@ -91,14 +91,15 @@ class conf_wifi_ng(gen_config) :
os.path.join("%s%s" % (WORK, root[len(top):]),
name))
# On créé/complète le fichier /etc/nvram.updates
fd = file(os.path.join(WORK, "etc", "nvram.updates"), "a")
data = { 'HOST': borne.nom().split('.')[0],
'IP': borne.ip(),
'CANAL': borne.canal(raw=True),
'PUISSANCE': abs(int(borne.puissance() or 0)),
'ON': ((int(borne.puissance() or 0) > 0) and 1 or 0),
}
fd.write("""
if borne != "non-configure.wifi.crans.org":
fd = file(os.path.join(WORK, "etc", "nvram.updates"), "a")
data = { 'HOST': borne.nom().split('.')[0],
'IP': borne.ip(),
'CANAL': borne.canal(raw=True),
'PUISSANCE': abs(int(borne.puissance() or 0)),
'ON': ((int(borne.puissance() or 0) > 0) and 1 or 0),
}
fd.write("""
variables="${variables} lan_ipaddr wan_hostname crans_channels txpower wl0_radio"
NVRAM_lan_ipaddr=%(IP)s
NVRAM_wan_hostname=%(HOST)s
@ -106,14 +107,14 @@ NVRAM_crans_channels=%(CANAL)s
NVRAM_txpower=%(PUISSANCE)d
NVRAM_wl0_radio=%(ON)d
""" % data)
# Dans le description, on peut avoir d'autres variables
# pour cette borne. Elles sont préfixées par <nvram> dans
# la description.
for info in borne.info():
if info.startswith("<nvram>"):
fd.write('variables="${variables} %s"\n' % info[7:].split("=")[0])
fd.write("NVRAM_%s\n" % info[7:])
fd.close()
# Dans le description, on peut avoir d'autres variables
# pour cette borne. Elles sont préfixées par <nvram> dans
# la description.
for info in borne.info():
if info.startswith("<nvram>"):
fd.write('variables="${variables} %s"\n' % info[7:].split("=")[0])
fd.write("NVRAM_%s\n" % info[7:])
fd.close()
# On fait du menage
os.system("find %s -name CVS -type d -exec rm -rf {} \\; 2> /dev/null" % WORK)