Menage dans les fichiers non voulus

darcs-hash:20050904115950-d1718-60a3da6247080bd7fa64260440019514990c7e3e.gz
This commit is contained in:
bernat 2005-09-04 13:59:50 +02:00
parent be681fcb31
commit 61a9102174

View file

@ -78,14 +78,16 @@ class conf_wifi(gen_config) :
for root, dirs, files in os.walk(top, topdown=True):
# On créé les répertoires
for name in dirs:
os.mkdir(os.path.join("%s%s" % (WORK, root[len(top):]),
name))
try:
os.mkdir(os.path.join("%s%s" % (WORK, root[len(top):]),
name))
except OSError, e:
pass
# Et on copie
for name in files:
if name.endswith("~"):
shutil.copy(os.path.join(root, name),
os.path.join("%s%s" % (WORK, root[len(top):]),
name))
shutil.copy(os.path.join(root, name),
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"), "w+")
data = { 'HOST': borne.nom().split('.')[0],
@ -111,6 +113,9 @@ NVRAM_wl0_radio=%(ON)d
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)
os.system("find %s -name *~ -type f -exec rm -f {} \\;" % WORK)
# Ensuite, on créé le tar
os.system("tar zcf %s/%s.tmp.tar.gz -C %s ." % (TARGET, borne.nom(), WORK))
# Et on le renomme (on espère que c'est atomique)