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 _applyShare(self, data, callback): Log.i("activeMounts: %s" %(self._numActive,)) if data['active']: mountpoint = AutoMount.MOUNT_BASE + data['sharename'] if os_path.exists(mountpoint) is False: createDir(mountpoint) tmpsharedir = data['sharedir'].replace(" ", "\\ ").replace("$", "\\$") if data['mounttype'] == 'nfs': opts = self.sanitizeOptions(data['options'].split(',')) remote = '%s:/%s' % (data['ip'], tmpsharedir) harddiskmanager.modifyFstabEntry(remote, mountpoint, mode="add_deactivated", extopts=opts, fstype="nfs") elif data['mounttype'] == 'cifs': opts = self.sanitizeOptions(data['options'].split(','), cifs=True) password = data['password'] username = data['username'].replace(" ", "\\ ") if password: username = data['username'].replace(" ", "\\ ") opts.extend([ 'username=%s' % (data['username']), 'password=%s' % (data['password']), ]) else: opts.extend(['guest']) opts.extend(['sec=ntlmv2']) remote = "//%s/%s" % (data['ip'], tmpsharedir) harddiskmanager.modifyFstabEntry(remote, mountpoint, mode="add_deactivated", extopts=opts, fstype="cifs") else: mountpoint = AutoMount.MOUNT_BASE + data['sharename'] self.removeMount(mountpoint) if callback: callback(True)
def _applyShare(self, data, callback): Log.d() if data['active']: mountpoint = AutoMount.MOUNT_BASE + data['sharename'] Log.i("mountpoint: %s" %(mountpoint,)) createDir(mountpoint) tmpsharedir = data['sharedir'].replace(" ", "\\040") if data['mounttype'] == 'nfs': opts = self.sanitizeOptions(data['options'].split(',')) remote = '%s:%s' % (data['ip'], tmpsharedir) harddiskmanager.modifyFstabEntry(remote, mountpoint, mode="add_deactivated", extopts=opts, fstype="nfs") elif data['mounttype'] == 'cifs': opts = self.sanitizeOptions(data['options'].split(','), cifs=True) if data['password']: opts.extend([ 'username=%s' % (data['username']), 'password=%s' % (data['password']), ]) else: opts.extend(['guest']) remote = "//%s/%s" % (data['ip'], tmpsharedir) harddiskmanager.modifyFstabEntry(remote, mountpoint, mode="add_deactivated", extopts=opts, fstype="cifs") else: mountpoint = AutoMount.MOUNT_BASE + data['sharename'] self.removeMount(mountpoint) if callback: callback(True)
def __init__(self, session): Screen.__init__(self, session) Screen.setTitle(self, _('Mount Manager')) self['key_red'] = Label('Initialization') self['key_green'] = Label(_('Setup Mounts')) self['key_yellow'] = Label(_('Unmount')) self['key_blue'] = Label(_('Mount')) self['lab1'] = Label() self.onChangedEntry = [] self.list = [] self['list'] = List(self.list) self['list'].onSelectionChanged.append(self.selectionChanged) self['actions'] = ActionMap( ['WizardActions', 'ColorActions', 'MenuActions'], { 'back': self.close, 'green': self.SetupMounts, 'red': self.Format, 'yellow': self.Unmount, 'blue': self.Mount }) self.activityTimer = eTimer() self.activityTimer.timeout.get().append(self.updateList2) if not pathExists('/universe'): createDir('/universe') self.updateList() self.onShown.append(self.setWindowTitle)
def gO(self): paths = ["/media/hdd","/media/usb","/media/uSDextra","/media/downloads","/media/music","/media/personal","/media/photo","/media/video"] for path in paths: if not pathExists(path): createDir(path) # hack ! self.activityTimer.start(1)
def __mount(self,dev,mp): if path.exists(mp)==False: createDir(mp,True) cmd = "mount " + dev + " " + mp #print "[FlashExpander]",cmd res = system(cmd) return (res >> 8)
def __mount(self, dev, mp): if path.exists(mp)==False: createDir(mp, True) cmd = "mount " + dev + " " + mp #print("[FlashExpander]",cmd) res = Console().ePopen(cmd) return (res >> 8)
def __mount(self, dev, mp): if path.exists(mp) == False: createDir(mp, True) cmd = "mount " + dev + " " + mp #print "[FlashExpander]",cmd res = system(cmd) return (res >> 8)
def gO(self): paths = ["/media/hdd","/media/usb","/media/downloads","/media/music","/media/personal","/media/photo","/media/video"] for path in paths: if not pathExists(path): createDir(path) # hack ! self.activityTimer.start(1)
def __mountDevice(self): for x in self.mountlist: dev = self.__getPartitionUUID(x) if dev is not None: if os_path.exists("/media/" + dev[1]) == False: createDir("/media/" + dev[1], True) cmd = "mount %s /media/%s" % (dev[0], dev[1]) myExecute(cmd, None)
def __init__(self, session): Screen.__init__(self, session) self.list = [] self['list'] = List(self.list) self.updateList() if not pathExists('/var/uninstall'): createDir('/var/uninstall') self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'ok': self.checkAcceSS, 'back': self.close})
def __init__(self, project): Job.__init__(self, "Data DVD Burn") self.project = project from time import strftime from Tools.Directories import SCOPE_HDD, resolveFilename, createDir new_workspace = resolveFilename(SCOPE_HDD) + "tmp/" + strftime("%Y%m%d%H%M%S") + "/dvd/" createDir(new_workspace, True) self.workspace = new_workspace self.project.workspace = self.workspace self.conduct()
def check_cfg_folder(): """Make config folder if it doesn't exist """ try: createDir(e2m3u2bouquet.CFGPATH) except OSError, e: # race condition guard if e.errno != errno.EEXIST: print >> log, "[e2m3u2b] unable to create config dir:", e if config.plugins.e2m3u2b.debug.value: raise
def gO(self): paths = [ '/media/hdd', '/media/universe', '/media/usb', '/media/downloads', '/media/music', '/media/personal', '/media/photo', '/media/video' ] for path in paths: if not pathExists(path): createDir(path) self.activityTimer.start(1)
def __init__(self, project): Job.__init__(self, "Bludisc Burn") self.project = project new_workspace = resolveFilename(SCOPE_HDD) + "tmp/" + strftime("bludisc_%Y%m%d%H%M/") createDir(new_workspace, True) self.workspace = new_workspace self.project.workspace = self.workspace self.titles = [] for title in self.project.titles: self.titles.append(BludiscTitle(title)) # wrap original DVD-Title into new BludiscTitle objects self.conduct()
def __init__(self, session): Screen.__init__(self, session) self.list = [] self['list'] = List(self.list) self.updateList() if not pathExists('/var/uninstall'): createDir('/var/uninstall') self['actions'] = ActionMap(['WizardActions', 'ColorActions'], { 'ok': self.checkAcceSS, 'back': self.close })
def __init__(self, project, menupreview=False): Job.__init__(self, "DVDBurn Job") self.project = project from time import strftime from Tools.Directories import SCOPE_HDD, resolveFilename, createDir new_workspace = resolveFilename(SCOPE_HDD) + "tmp/" + strftime("%Y%m%d%H%M%S") createDir(new_workspace, True) self.workspace = new_workspace self.project.workspace = self.workspace self.menupreview = menupreview self.conduct()
def gO(self): paths = ['/media/hdd', '/media/usb', '/media/downloads', '/media/music', '/media/personal', '/media/photo', '/media/video'] for path in paths: if not pathExists(path): createDir(path) self.activityTimer.start(1)
def __init__(self, session): Screen.__init__(self, session) self.list = [] self["list"] = List(self.list) self.updateList() if (not pathExists("/var/uninstall")): createDir("/var/uninstall") self["actions"] = ActionMap(["WizardActions", "ColorActions"], { "ok": self.checkAcceSS, "back": self.close, })
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 _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 _updateCache(self): basepath = resolveFilename(SCOPE_CONFIG, self.CACHE_DIR_NAME) if not pathExists(basepath): createDir(basepath) f = resolveFilename(SCOPE_CONFIG, "%s/%s" % (self.CACHE_DIR_NAME, "genres")) data = {} for key, genre in self._genres.iteritems(): data[key] = genre.dict() try: with open(f, 'w') as fdesc: json.dump(data, fdesc) Log.w("Disk cache updated (%s services)!" % (len(self._allServices, ))) except Exception as e: Log.w(e)
def init(self, cmd, dbdir): if not pathExists(dbdir): if not createDir(dbdir): dbdir = "/hdd/crossepg" if cmd == self.CMD_DOWNLOADER: x = "%s/crossepg_downloader -r -d %s" % (self.home_directory, dbdir) elif cmd == self.CMD_CONVERTER: x = "%s/crossepg_dbconverter -r -d %s" % (self.home_directory, dbdir) elif cmd == self.CMD_INFO: x = "%s/crossepg_dbinfo -r -d %s" % (self.home_directory, dbdir) elif cmd == self.CMD_IMPORTER: importdir = "%s/import/" % (dbdir) x = "%s/crossepg_importer -r -i %s -d %s" % (self.home_directory, importdir, dbdir) elif cmd == self.CMD_DEFRAGMENTER: x = "%s/crossepg_defragmenter -r -d %s" % (self.home_directory, dbdir) else: print "[CrossEPG_Wrapper] unknow command on init" return print "[CrossEPG_Wrapper] executing %s" % (x) self.cmd.appClosed.append(self.__cmdFinished) self.cmd.dataAvail.append(self.__cmdData) if self.cmd.execute(x): self.cmdFinished(-1)
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, session): Screen.__init__(self, session) self.list = [] self["list"] = List(self.list) self.updateList() if (not pathExists("/usr/uninstall")): createDir("/usr/uninstall") self["actions"] = ActionMap(["WizardActions", "ColorActions"], { "ok": self.KeyOk, "back": self.close, })
def conduct(self): for directory in [ 'BDMV', 'BDMV/AUXDATA', 'BDMV/BACKUP', 'BDMV/BACKUP/BDJO', 'BDMV/BACKUP/CLIPINF', 'BDMV/BACKUP/JAR', 'BDMV/BACKUP/PLAYLIST', 'BDMV/BDJO', 'BDMV/CLIPINF', 'BDMV/JAR', 'BDMV/META', 'BDMV/META/DL', 'BDMV/PLAYLIST', 'BDMV/STREAM' ]: if not createDir(self.job.workspace + directory): Task.processFinished(self, 1)
def _applyShare(self, data, callback): Log.i("activeMounts: %s" % (self._numActive, )) if data['active']: mountpoint = AutoMount.MOUNT_BASE + data['sharename'] if os_path.exists(mountpoint) is False: createDir(mountpoint) tmpsharedir = data['sharedir'].replace(" ", "\\ ").replace("$", "\\$") if data['mounttype'] == 'nfs': opts = self.sanitizeOptions(data['options'].split(',')) remote = '%s:/%s' % (data['ip'], tmpsharedir) harddiskmanager.modifyFstabEntry(remote, mountpoint, mode="add_deactivated", extopts=opts, fstype="nfs") elif data['mounttype'] == 'cifs': opts = self.sanitizeOptions(data['options'].split(','), cifs=True) password = data['password'] username = data['username'].replace(" ", "\\ ") if password: username = data['username'].replace(" ", "\\ ") opts.extend([ 'username=%s' % (data['username']), 'password=%s' % (data['password']), ]) else: opts.extend(['guest']) opts.extend(['sec=ntlmv2']) remote = "//%s/%s" % (data['ip'], tmpsharedir) harddiskmanager.modifyFstabEntry(remote, mountpoint, mode="add_deactivated", extopts=opts, fstype="cifs") else: mountpoint = AutoMount.MOUNT_BASE + data['sharename'] self.removeMount(mountpoint) if callback: callback(True)
def updateInfo(self): if pathExists('/media/usb/ImageBoot'): neoboot = 'usb' elif pathExists('/media/hdd/ImageBoot'): neoboot = 'hdd' device = '/media/' + neoboot + '' usfree = '0' devicelist = ['cf', 'hdd', 'card', 'usb', 'usb2'] for d in devicelist: test = '/media/' + d + '/ImageBoot/.neonextboot' if fileExists(test): device = '/media/' + d rc = system('df > /tmp/ninfo.tmp') f = open('/proc/mounts', 'r') for line in f.readlines(): if line.find('/hdd') != -1: self.backupdir = '/media/' + neoboot + '/NeoBootImageBackup' device = '/media/' + neoboot + '' f.close() if pathExists(self.backupdir) == 0 and createDir(self.backupdir): pass if fileExists('/tmp/ninfo.tmp'): f = open('/tmp/ninfo.tmp', 'r') for line in f.readlines(): line = line.replace('part1', ' ') parts = line.strip().split() totsp = len(parts) - 1 if parts[totsp] == device: if totsp == 5: usfree = parts[3] else: usfree = parts[2] break f.close() os_remove('/tmp/ninfo.tmp') self.availablespace = usfree[0:-3] strview = _('Masz zainstalowane nas\xc5\xa7\xc4\x99puj\xc4\x85ce obrazy') self['lab1'].setText(strview) strview = _('Masz jeszcze wolne: ') + self.availablespace + ' MB' self['lab2'].setText(strview) imageslist = ['Flash'] for fn in listdir('/media/' + neoboot + '/ImageBoot'): dirfile = '/media/' + neoboot + '/ImageBoot/' + fn if os_isdir(dirfile) and imageslist.append(fn): pass self['list'].list = imageslist
def updateInfo(self): linesdevice = open('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/.location', 'r').readlines() deviceneo = linesdevice[0][0:-1] device = deviceneo usfree = '0' devicelist = ['cf', 'CF', 'hdd', 'card', 'sd', 'SD', 'usb', 'USB', 'usb2'] for d in devicelist: test = '/media/' + d + '/ImageBoot/.neonextboot' if fileExists(test): device = device + d rc = system('df > /tmp/ninfo.tmp') f = open('/proc/mounts', 'r') for line in f.readlines(): if line.find('/hdd') != -1: self.backupdir = '' + getNeoLocation() + 'NeoBootImageBackup' elif line.find('/usb') != -1: self.backupdir = '' + getNeoLocation() + 'NeoBootImageBackup' f.close() if pathExists(self.backupdir) == 0 and createDir(self.backupdir): pass if fileExists('/tmp/ninfo.tmp'): f = open('/tmp/ninfo.tmp', 'r') for line in f.readlines(): line = line.replace('part1', ' ') parts = line.strip().split() totsp = len(parts) - 1 if parts[totsp] == device: if totsp == 5: usfree = parts[3] else: usfree = parts[2] break f.close() os_remove('/tmp/ninfo.tmp') self.availablespace = usfree[0:-3] strview = _('Kopie Zapasowe znajduj\xc4\x85 si\xc4\x99 w katalogu /' + getNeoLocation() + 'NeoBootImageBackup') self['lab1'].setText(strview) strview = _('Ilo\xc5\x9b\xc4\x87 wolnego miejsca w Superbocie: ') + self.availablespace + ' MB' self['lab2'].setText(strview) imageslist = [] for fn in listdir(self.backupdir): imageslist.append(fn) self['list'].list = imageslist
def createDirCallback(self, res): if res: path = os.path.join(self["filelist"].current_directory, res) if not pathExists(path): if not createDir(path): self.session.open( MessageBox, _("Creating directory %s failed.") % path, type=MessageBox.TYPE_ERROR, timeout=5 ) self["filelist"].refresh() else: self.session.open( MessageBox, _("The path %s already exists.") % path, type=MessageBox.TYPE_ERROR, timeout=5 )
def _applyShare(self, data, callback=None): logger.debug("...") if data["active"]: mountpoint = AutoMount.MOUNT_BASE + data["sharename"] logger.info("mountpoint: %s", mountpoint) createDir(mountpoint) tmpsharedir = data["sharedir"].replace(" ", "\\040") if data["mounttype"] == "nfs": opts = self.sanitizeOptions(data["options"].split(",")) remote = "%s:%s" % (data["ip"], tmpsharedir) harddiskmanager.modifyFstabEntry(remote, mountpoint, mode="add_deactivated", extopts=opts, fstype="nfs") elif data["mounttype"] == "cifs": opts = self.sanitizeOptions(data["options"].split(","), cifs=True) if data["password"]: opts.extend([ "username=%s" % (data["username"]), "password=%s" % (data["password"]) ]) else: opts.extend(["guest"]) remote = "//%s/%s" % (data["ip"], tmpsharedir) harddiskmanager.modifyFstabEntry(remote, mountpoint, mode="add_deactivated", extopts=opts, fstype="cifs") else: mountpoint = AutoMount.MOUNT_BASE + data["sharename"] self.deactivateMount(mountpoint) if callback: callback(True)
def __init__(self, session): self.session = session self._updateChecker = InputDeviceUpdateChecker() self._updateChecker.onUpdateAvailable.append(self._onUpdateAvailable) self._updateChecker.check() self._dm = eInputDeviceManager.getInstance() self.__deviceStateChanged_conn = self._dm.deviceStateChanged.connect(self._onDeviceStateChanged) self.__deviceListChanged_conn = None self._batteryStates = {} logdir = "/tmp" if createDir(self.BATTERY_LOG_DIR): logdir = self.BATTERY_LOG_DIR self._batteryLogFile = "%s/battery.dat" %(logdir,) # Wait 10 seconds before looking for connected devices reactor.callLater(10, self._start)
def createDirCallback(self, res): if res: path = os.path.join(self["filelist"].current_directory, res) if not pathExists(path): if not createDir(path): self.session.open(MessageBox, _("Creating directory %s failed.") % path, type=MessageBox.TYPE_ERROR, timeout=5) self["filelist"].refresh() else: self.session.open(MessageBox, _("The path %s already exists.") % path, type=MessageBox.TYPE_ERROR, timeout=5)
def createDirectoryCallback(self, directory): if directory: path = pathjoin(self["filelist"].current_directory, directory) if isdir(path): self.session.open(MessageBox, _("Error: Directory '%s' already exists!") % path, type=MessageBox.TYPE_ERROR, timeout=5) elif createDir(path): self["filelist"].refresh() else: self.session.open( MessageBox, _("Error: Unable to create directory '%s'!") % path, type=MessageBox.TYPE_ERROR, timeout=5)
def jumP(self): path = '/universe/' + self.destination path1 = path + '/etc' path2 = path + '/usr' path3 = path + '/var/lib/opkg' pathspinorig = '/usr/share/spinners/' + self.destination + '/*' pathspindest = path2 + '/share/enigma2/skin_default/spinner/' if self.destination != 'Black Hole': if not pathExists(path): createDir(path) if not pathExists(path1): createDir(path1) cmd = 'cp -r /etc %s' % path system(cmd) if not pathExists(path3): pathtmp = path + '/var' createDir(pathtmp) pathtmp = pathtmp + '/lib' createDir(pathtmp) cmd = 'cp -r /var/lib/opkg %s/var/lib' % path system(cmd) if not pathExists(path2): createDir(path2) pathtmp = path2 + '/share' createDir(pathtmp) pathtmp = pathtmp + '/enigma2' createDir(pathtmp) pathtmp = pathtmp + '/skin_default' createDir(pathtmp) pathtmp = pathtmp + '/spinner' createDir(pathtmp) cmd = 'cp -f %s %s' % (pathspinorig, pathspindest) system(cmd) if fileExists('/bin/bh_parallel_mount'): os_remove('/bin/bh_parallel_mount') if self.destination != 'Black Hole': if self.destination_force_reboot == 'False': out = open('/bin/bh_parallel_mount', 'w') line = 'mount -o bind %s /etc > /tmp/jump.tmp\n' % path1 out.write(line) line = 'mount -o bind %s /var/lib/opkg > /tmp/jump.tmp\n' % path3 out.write(line) line = 'mount -t unionfs -o dirs=%s:/usr=ro none /usr > /tmp/jump.tmp\n' % path2 out.write(line) out.write('exit 0\n\n') out.close() system('chmod 0755 /bin/bh_parallel_mount') out = open('/bin/bh_jump', 'w') out.write('#!/bin/sh\n\n') out.write('telinit 4\n') if self.current_universe != 'Black Hole': out.write('fuser -km /etc > /tmp/jump.tmp\n') out.write('umount -l /etc > /tmp/jump.tmp\n') out.write('umount -l /usr > /tmp/jump.tmp\n') out.write('umount -l /var/lib/opkg > /tmp/jump.tmp\n') if self.destination != 'Black Hole': out.write('sleep 1\n') line = 'mount -o bind %s /etc > /tmp/jump.tmp\n' % path1 out.write(line) line = 'mount -o bind %s /var/lib/opkg > /tmp/jump.tmp\n' % path3 out.write(line) line = 'mount -t unionfs -o dirs=%s:/usr=ro none /usr > /tmp/jump.tmp\n' % path2 out.write(line) out.write('sleep 1\n') out.write('telinit 3\n\n') out.write('exit 0\n\n') out.close() rc = system('chmod 0755 /bin/bh_jump') self.jump_on_close = True configfile.save() self.close()
def jumP(self): # build dirs path = "/universe/" + self.destination path1 = path + "/etc" path2 = path + "/usr" path3 = path + "/var/lib/opkg" pathspinorig = "/usr/share/spinners/" + self.destination + "/*" pathspindest = path2 + "/share/enigma2/skin_default/spinner/" if self.destination != "Black Hole": if not pathExists(path): createDir(path) if not pathExists(path1): createDir(path1) cmd = "cp -r /etc %s" % (path) system(cmd) if not pathExists(path3): pathtmp = path + "/var" createDir(pathtmp) pathtmp = pathtmp + "/lib" createDir(pathtmp) cmd = "cp -r /var/lib/opkg %s/var/lib" % (path) system(cmd) if not pathExists(path2): createDir(path2) pathtmp = path2 + "/share" createDir(pathtmp) pathtmp = pathtmp + "/enigma2" createDir(pathtmp) pathtmp = pathtmp + "/skin_default" createDir(pathtmp) pathtmp = pathtmp + "/spinner" createDir(pathtmp) cmd = "cp -f %s %s" % (pathspinorig, pathspindest) system(cmd) # build bootup file if fileExists("/bin/bh_parallel_mount"): os_remove("/bin/bh_parallel_mount") if self.destination != "Black Hole": if self.destination_force_reboot == "False": out = open("/bin/bh_parallel_mount",'w') line = "mount -o bind %s /etc > /tmp/jump.tmp\n" % (path1) out.write(line) line = "mount -o bind %s /var/lib/opkg > /tmp/jump.tmp\n" % (path3) out.write(line) line = "mount -t unionfs -o dirs=%s:/usr=ro none /usr > /tmp/jump.tmp\n" % (path2) out.write(line) out.write("exit 0\n\n") out.close() system("chmod 0755 /bin/bh_parallel_mount") # build jump file out = open("/bin/bh_jump",'w') out.write("#!/bin/sh\n\n") out.write("telinit 4\n") if self.current_universe != "Black Hole": out.write("fuser -km /etc > /tmp/jump.tmp\n") out.write("umount -l /etc > /tmp/jump.tmp\n") out.write("umount -l /usr > /tmp/jump.tmp\n") out.write("umount -l /var/lib/opkg > /tmp/jump.tmp\n") # out.write("/etc/init.d/avahi-daemon stop\n") # out.write("/etc/init.d/networking stop\n") # out.write("killall -9 udhcpc\n") # out.write("rm /var/run/udhcpc* \n") if self.destination != "Black Hole": out.write("sleep 1\n") # line = "sleep 1\n\nmount -t unionfs -o dirs=%s:/etc=ro none /etc 2>/dev/null \n" % (path1) line = "mount -o bind %s /etc > /tmp/jump.tmp\n" % (path1) out.write(line) line = "mount -o bind %s /var/lib/opkg > /tmp/jump.tmp\n" % (path3) out.write(line) line = "mount -t unionfs -o dirs=%s:/usr=ro none /usr > /tmp/jump.tmp\n" % (path2) out.write(line) out.write("sleep 1\n") # out.write("/etc/init.d/networking start\n") # out.write("/etc/init.d/avahi-daemon start\n") out.write("telinit 3\n\n") out.write("exit 0\n\n") out.close() rc = system("chmod 0755 /bin/bh_jump") # jump.. bye bye self.jump_on_close = True configfile.save() self.close()
def jumP(self): # build dirs path = "/universe/" + self.destination path1 = path + "/etc" path2 = path + "/usr" path3 = path + "/var/lib/opkg" pathspinorig = "/usr/share/spinners/" + self.destination + "/*" pathspindest = path2 + "/share/enigma2/skin_default/spinner/" if self.destination != "Black Hole": if not pathExists(path): createDir(path) if not pathExists(path1): createDir(path1) cmd = "cp -r /etc %s" % (path) system(cmd) if not pathExists(path3): pathtmp = path + "/var" createDir(pathtmp) pathtmp = pathtmp + "/lib" createDir(pathtmp) cmd = "cp -r /var/lib/opkg %s/var/lib" % (path) system(cmd) if not pathExists(path2): createDir(path2) pathtmp = path2 + "/share" createDir(pathtmp) pathtmp = pathtmp + "/enigma2" createDir(pathtmp) pathtmp = pathtmp + "/skin_default" createDir(pathtmp) pathtmp = pathtmp + "/spinner" createDir(pathtmp) cmd = "cp -f %s %s" % (pathspinorig, pathspindest) system(cmd) # build bootup file if fileExists("/bin/bh_parallel_mount"): os_remove("/bin/bh_parallel_mount") if self.destination != "Black Hole": if self.destination_force_reboot == "False": out = open("/bin/bh_parallel_mount", 'w') line = "mount -o bind %s /etc > /tmp/jump.tmp\n" % (path1) out.write(line) line = "mount -o bind %s /var/lib/opkg > /tmp/jump.tmp\n" % ( path3) out.write(line) line = "mount -t unionfs -o dirs=%s:/usr=ro none /usr > /tmp/jump.tmp\n" % ( path2) out.write(line) out.write("exit 0\n\n") out.close() system("chmod 0755 /bin/bh_parallel_mount") # build jump file out = open("/bin/bh_jump", 'w') out.write("#!/bin/sh\n\n") out.write("telinit 4\n") if self.current_universe != "Black Hole": out.write("fuser -km /etc > /tmp/jump.tmp\n") out.write("umount -l /etc > /tmp/jump.tmp\n") out.write("umount -l /usr > /tmp/jump.tmp\n") out.write("umount -l /var/lib/opkg > /tmp/jump.tmp\n") # out.write("/etc/init.d/avahi-daemon stop\n") # out.write("/etc/init.d/networking stop\n") # out.write("killall -9 udhcpc\n") # out.write("rm /var/run/udhcpc* \n") if self.destination != "Black Hole": out.write("sleep 1\n") # line = "sleep 1\n\nmount -t unionfs -o dirs=%s:/etc=ro none /etc 2>/dev/null \n" % (path1) line = "mount -o bind %s /etc > /tmp/jump.tmp\n" % (path1) out.write(line) line = "mount -o bind %s /var/lib/opkg > /tmp/jump.tmp\n" % (path3) out.write(line) line = "mount -t unionfs -o dirs=%s:/usr=ro none /usr > /tmp/jump.tmp\n" % ( path2) out.write(line) out.write("sleep 1\n") # out.write("/etc/init.d/networking start\n") # out.write("/etc/init.d/avahi-daemon start\n") out.write("telinit 3\n\n") out.write("exit 0\n\n") out.close() rc = system("chmod 0755 /bin/bh_jump") # jump.. bye bye self.jump_on_close = True configfile.save() self.close()
def conduct(self): for directory in ['BDMV','BDMV/AUXDATA','BDMV/BACKUP','BDMV/BACKUP/BDJO','BDMV/BACKUP/CLIPINF','BDMV/BACKUP/JAR','BDMV/BACKUP/PLAYLIST','BDMV/BDJO','BDMV/CLIPINF','BDMV/JAR','BDMV/META','BDMV/META/DL','BDMV/PLAYLIST','BDMV/STREAM']: if not createDir(self.job.workspace+directory): Task.processFinished(self, 1)