def runBackup(self, result=None): from Tools.Directories import createDir, isMount, pathExists from time import localtime from datetime import date from Screens.Console import Console if result: if isMount("/mnt/usb/"): if (pathExists("/mnt/usb/backup") == False): createDir("/mnt/usb/backup", True) d = localtime() dt = date(d.tm_year, d.tm_mon, d.tm_mday) self.backup_file = "backup/" + str( dt) + "_settings_backup.tar.gz" self.session.open( Console, title="Backup running", cmdlist=[ "tar -czvf " + "/mnt/usb/" + self.backup_file + " /etc/enigma2/ /etc/network/interfaces /etc/wpa_supplicant.conf" ], finishedCallback=self.backup_finished, closeOnSuccess=True) else: self.backup_file = None self.backup_finished(skipped=True)
def __init__(self, url, filename, device=None, mountpoint="/"): Job.__init__(self, _("Download .NFI-files for USB-flasher")) if device: if isMount(mountpoint): UmountTask(self, mountpoint) MountTask(self, device, mountpoint) ImageDownloadTask(self, url, mountpoint+filename) ImageDownloadTask(self, url[:-4]+".nfo", mountpoint+filename[:-4]+".nfo")
def __init__(self, url, filename, device=None, mountpoint="/"): Job.__init__(self, _("Download .NFI-Files for USB-Flasher")) if device: if isMount(mountpoint): UmountTask(self, mountpoint) MountTask(self, device, mountpoint) ImageDownloadTask(self, url, mountpoint+filename) ImageDownloadTask(self, url[:-4]+".nfo", mountpoint+filename[:-4]+".nfo")
def _linkAsHdd(self, path): hdd_dir = '/media/hdd' Log.i("symlink %s %s" % (path, hdd_dir)) if os_path.islink(hdd_dir): if readlink(hdd_dir) != path: remove(hdd_dir) symlink(path, hdd_dir) elif not isMount(hdd_dir): if os_path.isdir(hdd_dir): removeDir(hdd_dir) try: symlink(path, hdd_dir) createDir(hdd_dir + '/movie') except OSError: Log.i("adding symlink failed!")
def _linkAsHdd(self, path): hdd_dir = "/media/hdd" logger.info("symlink %s %s", path, hdd_dir) if os.path.islink(hdd_dir): if os.readlink(hdd_dir) != path: os.remove(hdd_dir) os.symlink(path, hdd_dir) elif not isMount(hdd_dir): if os.path.isdir(hdd_dir): removeDir(hdd_dir) try: os.symlink(path, hdd_dir) createDir(hdd_dir + "/movie") except OSError: logger.info("adding symlink failed!")
def runBackup(self, result=None): from Tools.Directories import createDir, isMount, pathExists from time import localtime from datetime import date from Screens.Console import Console if result: if isMount("/mnt/usb/"): if (pathExists("/mnt/usb/backup") == False): createDir("/mnt/usb/backup", True) d = localtime() dt = date(d.tm_year, d.tm_mon, d.tm_mday) self.backup_file = "backup/" + str(dt) + "_settings_backup.tar.gz" self.session.open(Console, title = "Backup running", cmdlist = ["tar -czvf " + "/mnt/usb/" + self.backup_file + " /etc/enigma2/ /etc/network/interfaces /etc/wpa_supplicant.conf"], finishedCallback = self.backup_finished, closeOnSuccess = True) else: self.backup_file = None self.backup_finished(skipped=True)
def _unmount(self, mountpoint): if isMount(mountpoint): self._console.ePopen('umount -fl %s' %mountpoint, self._onConsoleFinished)
def _unmount(self, mountpoint): logger.debug("mountpoint: %s", mountpoint) if isMount(mountpoint): self._console.ePopen("umount -fl %s" % mountpoint, self._onConsoleFinished)
def _unmount(self, mountpoint): if isMount(mountpoint): self._console.ePopen('umount -fl %s' % mountpoint, self._onConsoleFinished)