[udev_update_symlinks] Correction pour tenir compte des aléas de file
This commit is contained in:
parent
a9b7d12314
commit
89c4007c97
1 changed files with 2 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue