@ -565,8 +565,9 @@ class Distributive(object, SignalInterrupt):
return None
def _mountToDirectory ( self , file , directory , mountopts = " " ):
def _mountToDirectory ( self , file , directory , mountopts = " " ,count = 2 ):
""" Mount squashfs to directory """
NO_SUCH_DEVICE = 2816
if isMount ( directory ) :
raise DistributiveError ( _ ( " Cann ' t mount to directory: %s \n " ) \
% directory + _ ( " Directory already mounted " ) )
@ -577,6 +578,12 @@ class Distributive(object, SignalInterrupt):
if mountProcess . success ( ) :
return True
else :
# 2816 code return by mount if device is absent (update /dev by udev)
# try mount 3 times with interval 0.5 second
if mountProcess . returncode ( ) == NO_SUCH_DEVICE and count :
sleep ( 0.5 )
mountProcess . close ( )
return self . _mountToDirectory ( file , directory , mountopts , count - 1 )
try :
self . _removeDirectory ( directory )
except :