Example #1
0
 def CheckMountPointFinished(self, result, retval, extra_args):
     print("[AutoMount.py] CheckMountPointFinished", result, retval)
     (data, callback) = extra_args
     path = os.path.join('/media/net', data['sharename'])
     if os.path.exists(path):
         if os.path.ismount(path):
             if data['sharename'] in self.automounts:
                 self.automounts[data['sharename']]['isMounted'] = True
                 desc = data['sharename']
                 if self.automounts[data['sharename']][
                         'hdd_replacement'] == 'True':  #hdd replacement hack
                     self.makeHDDlink(path)
                 harddiskmanager.addMountedPartition(path, desc)
         else:
             if data['sharename'] in self.automounts:
                 self.automounts[data['sharename']]['isMounted'] = False
             if os.path.exists(path):
                 if not os.path.ismount(path):
                     try:
                         os.rmdir(path)
                         harddiskmanager.removeMountedPartition(path)
                     except Exception as ex:
                         print("Failed to remove", path, "Error:", ex)
     if self.checkList:
         # Go to next item in list...
         self.CheckMountPoint(self.checkList.pop(), callback)
     if self.MountConsole:
         if len(self.MountConsole.appContainers) == 0:
             if callback is not None:
                 self.callback = callback
                 self.timer.startLongTimer(1)
Example #2
0
 def CheckMountPointFinished(self, extra_args):
     (data, callback,) = extra_args
     if data['hdd_replacement'] == 'True' or data['hdd_replacement'] is True:
         path = os.path.join('/media/hdd')
         sharepath = os.path.join('/media/net', data['sharename'])
     else:
         path = os.path.join('/media/net', data['sharename'])
         sharepath = ''
     if os.path.exists(path):
         if os.path.ismount(path):
             if self.automounts.has_key(data['sharename']):
                 self.automounts[data['sharename']]['isMounted'] = True
                 desc = data['sharename']
                 harddiskmanager.addMountedPartition(path, desc)
         else:
             if self.automounts.has_key(data['sharename']):
                 self.automounts[data['sharename']]['isMounted'] = False
             if os.path.exists(path):
                 if not os.path.ismount(path):
                     try:
                         os.rmdir(path)
                         harddiskmanager.removeMountedPartition(path)
                     except Exception as ex:
                         print 'Failed to remove',
                         print path,
                         print 'Error:',
                         print ex
     if self.checkList:
         self.CheckMountPoint(self.checkList.pop(), callback)
     if self.MountConsole:
         if len(self.MountConsole.appContainers) == 0:
             if callback is not None:
                 self.callback = callback
                 self.timer.startLongTimer(1)
Example #3
0
	def _onSharesApplied(self):
		Log.d()
		for sharename, data in self._mounts.items():
			mountpoint = AutoMount.MOUNT_BASE + sharename
			data['isMounted'] = True
			desc = data['sharename']
			if data['hdd_replacement']: #hdd replacement hack
				self._linkAsHdd(mountpoint)
			harddiskmanager.addMountedPartition(mountpoint, desc)
Example #4
0
 def _onSharesApplied(self):
     logger.debug("...")
     for sharename, data in self._mounts.items():
         mountpoint = AutoMount.MOUNT_BASE + sharename
         data["isMounted"] = Util.findInMtab(dst=mountpoint)
         desc = data["sharename"]
         if data["hdd_replacement"]:  #hdd replacement hack
             self._linkAsHdd(mountpoint)
         harddiskmanager.addMountedPartition(mountpoint, desc)
 def _onSharesApplied(self):
     Log.d()
     for sharename, data in self._mounts.items():
         mountpoint = AutoMount.MOUNT_BASE + sharename
         data['isMounted'] = True
         desc = data['sharename']
         if data['hdd_replacement']:  #hdd replacement hack
             self._linkAsHdd(mountpoint)
         harddiskmanager.addMountedPartition(mountpoint, desc)
Example #6
0
 def CheckMountPointFinished(self, result, retval, extra_args):
     print "[AutoMount.py] CheckMountPointFinished", result, retval
     (data, callback) = extra_args
     path = os.path.join("/media/net", data["sharename"])
     if self.automounts.has_key(data["sharename"]):
         self.automounts[data["sharename"]]["isMounted"] = True
         desc = data["sharename"]
         if self.automounts[data["sharename"]]["hdd_replacement"] == "True":  # hdd replacement hack
             self.makeHDDlink(path)
         harddiskmanager.addMountedPartition(path, desc)
     if self.checkList:
         # Go to next item in list...
         self.CheckMountPoint(self.checkList.pop(), callback)
Example #7
0
    def CheckMountPointFinished(self, extra_args):
        # 		print("[NetworkBrowser] CheckMountPointFinished")
        (data, callback, restart) = extra_args
        hdd_dir = '/media/hdd'
        sharepath = os.path.join('/media/net', data['sharename'])
        if data['mountusing'] == 'autofs':
            sharepath = os.path.join('/media/autofs', data['sharename'])
            path = os.path.join('/media/autofs', data['sharename'])
        elif data['hdd_replacement'] == 'True' or data[
                'hdd_replacement'] is True:
            path = os.path.join('/media/hdd')
        else:
            path = os.path.join('/media/net', data['sharename'])

        if os.path.exists(path):
            if data['mountusing'] == 'autofs':
                if self.automounts.has_key(data['sharename']):
                    self.automounts[data['sharename']]['isMounted'] = True
                    desc = data['sharename']
                    harddiskmanager.addMountedPartition(sharepath, desc)
                if data['hdd_replacement'] == 'True' or data[
                        'hdd_replacement'] is True:
                    if os.path.islink(hdd_dir):
                        if os.readlink(hdd_dir) != path:
                            os.unlink(hdd_dir)
                            os.symlink(path, hdd_dir)
                    elif not os.path.exists(hdd_dir):
                        os.symlink(path, hdd_dir)
            elif os.path.ismount(path):
                if self.automounts.has_key(data['sharename']):
                    self.automounts[data['sharename']]['isMounted'] = True
                    desc = data['sharename']
                    harddiskmanager.addMountedPartition(path, desc)
            else:
                if self.automounts.has_key(data['sharename']):
                    self.automounts[data['sharename']]['isMounted'] = False
                if os.path.exists(path):
                    if not os.path.ismount(path):
                        try:
                            rmtree(path)
                            harddiskmanager.removeMountedPartition(path)
                        except Exception as ex:
                            print("Failed to remove", path, "Error:", ex)
        if self.checkList:
            # Go to next item in list...
            self.CheckMountPoint(self.checkList.pop(), callback, restart)
        if self.MountConsole:
            if len(self.MountConsole.appContainers) == 0:
                if callback is not None:
                    self.callback = callback
                    self.timer.startLongTimer(1)
Example #8
0
 def CheckMountPointFinished(self, result, retval, extra_args):
     print "[AutoMount.py] CheckMountPointFinished", result, retval
     (data, callback) = extra_args
     path = os.path.join('/media/net', data['sharename'])
     if self.automounts.has_key(data['sharename']):
         self.automounts[data['sharename']]['isMounted'] = True
         desc = data['sharename']
         if self.automounts[data['sharename']][
                 'hdd_replacement'] == 'True':  #hdd replacement hack
             self.makeHDDlink(path)
         harddiskmanager.addMountedPartition(path, desc)
     if self.checkList:
         # Go to next item in list...
         self.CheckMountPoint(self.checkList.pop(), callback)
Example #9
0
 def _onSharesApplied(self):
     Log.d()
     for sharename, data in self._mounts.items():
         mountpoint = AutoMount.MOUNT_BASE + sharename
         Log.d("mountpoint: %s" % (mountpoint, ))
         if os_path.exists(mountpoint):
             if os_path.ismount(mountpoint):
                 Log.d("'%s' is mounted" % (mountpoint, ))
                 data['isMounted'] = True
                 desc = data['sharename']
                 if data['hdd_replacement']:  #hdd replacement hack
                     self._linkAsHdd(mountpoint)
                 harddiskmanager.addMountedPartition(mountpoint, desc)
             else:
                 Log.d("'%s' is NOT mounted" % (mountpoint, ))
                 sharename = self._mounts.get(data['sharename'], None)
                 if sharename:
                     data['isMounted'] = False
                 if os_path.exists(mountpoint):
                     if not os_path.ismount(mountpoint):
                         removeDir(mountpoint)
                         harddiskmanager.removeMountedPartition(mountpoint)
Example #10
0
	def _onSharesApplied(self):
		Log.d()
		for sharename, data in self._mounts.items():
			mountpoint = AutoMount.MOUNT_BASE + sharename
			Log.d("mountpoint: %s" %(mountpoint,))
			if os_path.exists(mountpoint):
				if os_path.ismount(mountpoint):
					Log.d("'%s' is mounted" %(mountpoint,))
					data['isMounted'] = True
					desc = data['sharename']
					if data['hdd_replacement']: #hdd replacement hack
						self._linkAsHdd(mountpoint)
					harddiskmanager.addMountedPartition(mountpoint, desc)
				else:
					Log.d("'%s' is NOT mounted" %(mountpoint,))
					sharename = self._mounts.get(data['sharename'], None)
					if sharename:
						data['isMounted'] = False
					if os_path.exists(mountpoint):
						if not os_path.ismount(mountpoint):
							removeDir(mountpoint)
							harddiskmanager.removeMountedPartition(mountpoint)
Example #11
0
 def CheckMountPointFinished(self, extra_args):
     (
         data,
         callback,
     ) = extra_args
     if data['hdd_replacement'] == 'True' or data['hdd_replacement'] is True:
         path = os.path.join('/media/hdd')
         sharepath = os.path.join('/media/net', data['sharename'])
     else:
         path = os.path.join('/media/net', data['sharename'])
         sharepath = ''
     if os.path.exists(path):
         if os.path.ismount(path):
             if self.automounts.has_key(data['sharename']):
                 self.automounts[data['sharename']]['isMounted'] = True
                 desc = data['sharename']
                 harddiskmanager.addMountedPartition(path, desc)
         else:
             if self.automounts.has_key(data['sharename']):
                 self.automounts[data['sharename']]['isMounted'] = False
             if os.path.exists(path):
                 if not os.path.ismount(path):
                     try:
                         os.rmdir(path)
                         harddiskmanager.removeMountedPartition(path)
                     except Exception as ex:
                         print 'Failed to remove',
                         print path,
                         print 'Error:',
                         print ex
     if self.checkList:
         self.CheckMountPoint(self.checkList.pop(), callback)
     if self.MountConsole:
         if len(self.MountConsole.appContainers) == 0:
             if callback is not None:
                 self.callback = callback
                 self.timer.startLongTimer(1)