Commit 89c4007c authored by Pierre-Elliott Bécue's avatar Pierre-Elliott Bécue
Browse files

[udev_update_symlinks] Correction pour tenir compte des aléas de file

parent a9b7d123
......@@ -41,7 +41,7 @@ def make_link(couple):
sym, dev = couple
diskstatus = subprocess.Popen(['file', '-sb', '/dev/' + dev], stdout=subprocess.PIPE)
diskstatus = diskstatus.stdout.readlines()[0]
if not os.path.islink(sym) and diskstatus != 'empty\n':
if not os.path.islink(sym) and 'empty' in diskstatus:
sys.stdout.write("Création du lien /dev/" + sym + " -> /dev/" + dev + " … ")
try:
os.symlink(dev, sym)
......@@ -51,7 +51,7 @@ def make_link(couple):
sys.stdout.write(coul("ECHEC", 'rouge'))
res = False
sys.stdout.write('\n')
elif os.path.islink(sym) and diskstatus == 'empty\n':
elif os.path.islink(sym) and 'empty' in diskstatus:
sys.stdout.write("Destruction du lien /dev/" + sym + " … ")
try:
os.remove(sym)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment