diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..05c47ff --- /dev/null +++ b/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +from Components.Language import language +from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE +import os, gettext +PluginLanguageDomain = 'NeoBoot' +PluginLanguagePath = 'Extensions/NeoBoot/locale' + +def localeInit(): + lang = language.getLanguage()[:2] + os.environ['LANGUAGE'] = lang + print '[NeoBoot] set language to ', lang + gettext.bindtextdomain(PluginLanguageDomain, resolveFilename(SCOPE_PLUGINS, PluginLanguagePath)) + + +def _(txt): + t = gettext.dgettext(PluginLanguageDomain, txt) + if t == txt: + #print '[NeoBoot] fallback to default translation for', txt + t = gettext.dgettext('enigma2', txt) + return t + + +localeInit() +language.addCallback(localeInit) diff --git a/__init__.pyo b/__init__.pyo new file mode 100644 index 0000000..369244a Binary files /dev/null and b/__init__.pyo differ diff --git a/error.mvi b/error.mvi new file mode 100644 index 0000000..9410f03 Binary files /dev/null and b/error.mvi differ diff --git a/ex_init.py b/ex_init.py new file mode 100644 index 0000000..9fce9a4 --- /dev/null +++ b/ex_init.py @@ -0,0 +1,6 @@ + +import sys, extract +if len(sys.argv) < 15: + pass +else: + extract.NEOBootMainEx(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5], sys.argv[6], sys.argv[7], sys.argv[8], sys.argv[9], sys.argv[10], sys.argv[11], sys.argv[12], sys.argv[13], sys.argv[14], sys.argv[15]) \ No newline at end of file diff --git a/extract.py b/extract.py new file mode 100644 index 0000000..035625e --- /dev/null +++ b/extract.py @@ -0,0 +1,1183 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# ver. gutosie +import time, sys, os, struct, shutil + +def getFSTAB2(): + install='UNKNOWN' + if os.path.exists('/etc/fstab'): + with open('/etc/fstab', 'r') as f: + lines = f.read() + f.close() + if lines.find('UUID') != -1: + install='OKinstall' + elif not lines.find('UUID') != -1: + install='NOinstall' + return install + +def getBoxHostName(): + if os.path.exists('/etc/hostname'): + with open('/etc/hostname', 'r') as f: + myboxname = f.readline().strip() + f.close() + return myboxname + +def getCPUSoC(): + chipset='UNKNOWN' + if os.path.exists('/proc/stb/info/chipset'): + with open('/proc/stb/info/chipset', 'r') as f: + chipset = f.readline().strip() + f.close() + if chipset == '7405(with 3D)': + chipset == '7405' + + return chipset + +def getBoxVuModel(): + vumodel='UNKNOWN' + if os.path.exists("/proc/stb/info/vumodel") and not os.path.exists("/proc/stb/info/boxtype"): + with open('/proc/stb/info/vumodel', 'r') as f: + vumodel = f.readline().strip() + f.close() + return vumodel + +def getCPUtype() : + cpu='UNKNOWN' + if os.path.exists('/proc/cpuinfo'): + with open('/proc/cpuinfo', 'r') as f: + lines = f.read() + f.close() + if lines.find('ARMv7') != -1: + cpu='ARMv7' + elif lines.find('mips') != -1: + cpu='MIPS' + return cpu + +def getKernelVersion(): + try: + return open('/proc/version', 'r').read().split(' ', 4)[2].split('-', 2)[0] + except: + return _('unknown') + +def getNeoLocation(): + locatino='UNKNOWN' + if os.path.exists('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/.location'): + with open('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/.location', 'r') as f: + locatino = f.readline().strip() + f.close() + return locatino + +media = getNeoLocation() +mediahome = media + '/ImageBoot/' +extensions_path = '/usr/lib/enigma2/python/Plugins/Extensions/' +dev_null = ' > /dev/null 2>&1' + +def NEOBootMainEx(source, target, stopenigma, CopyFiles, CopyKernel, TvList, Montowanie, LanWlan, Sterowniki, InstallSettings, ZipDelete, RepairFTP, SoftCam, MediaPortal, BlackHole): + media_target = mediahome + target + list_one = ['rm -r ' + media_target + dev_null, 'mkdir ' + media_target + dev_null, 'chmod -R 0777 ' + media_target] + for command in list_one: + os.system(command) + + if stopenigma == 'True': + os.system('echo "All system processes have been stopped,\n please wait, after the installation is completed, E2 will restart..."') + os.system('sync; touch /tmp/init4; init 4') + + rc = NEOBootExtract(source, target, ZipDelete, BlackHole) + if not os.path.exists('%s/ImageBoot/%s/usr/lib/enigma2/python/Plugins/Extensions' % (media, target)): + os.system('mkdir -p %s/ImageBoot/%s/usr/lib/' % (media, target)) + os.system('mkdir -p %s/ImageBoot/%s/usr/lib/enigma2' % (media, target)) + os.system('mkdir -p %s/ImageBoot/%s/usr/lib/enigma2/python' % (media, target)) + os.system('mkdir -p %s/ImageBoot/%s/usr/lib/enigma2/python/Plugins' % (media, target)) + os.system('mkdir -p %s/ImageBoot/%s/usr/lib/enigma2/python/Plugins/Extensions' % (media, target)) + + list_two = ['mkdir -p ' + media_target + '/media' + dev_null, + 'rm ' + media_target + media + dev_null, + 'rmdir ' + media_target + media + dev_null, + 'mkdir -p ' + media_target + media + dev_null, + 'cp /etc/passwd ' + media_target + '/etc/passwd' + dev_null, + 'cp /etc/hostname ' + media_target + '/etc/hostname' + dev_null, + #'cp -rf /etc/init.d/vuplus-platform-util ' + media_target + '/etc/init.d/vuplus-platform-util' + dev_null, + 'cp -rf ' + extensions_path + 'NeoBoot ' + media_target + extensions_path + 'NeoBoot' + dev_null] + for command in list_two: + os.system(command) + + if CopyFiles == 'False': + os.system('echo "No copying of files..."') + os.system('touch ' + getNeoLocation() + 'ImageBoot/.without_copying; sleep 5') + + if CopyKernel == 'True': + #mips + if getBoxHostName() == 'vuultimo' or getCPUSoC() == '7405' and os.path.exists('%s/ImageBoot/%s/etc/vtiversion.info' % (media, target)): + if os.path.exists('%s/ImageBoot/%s/lib/modules' % (media, target)): + cmd = 'rm -r %s/ImageBoot/%s/lib/modules' % (media, target) + rc = os.system(cmd) + cmd = 'mkdir -p %s/ImageBoot/%s/lib/modules > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + cmd = 'cp -r /lib/modules %s/ImageBoot/%s/lib > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + if os.path.exists('%s/ImageBoot/%s/lib/firmware' % (media, target)): + cmd = 'rm -r %s/ImageBoot/%s/lib/firmware' % (media, target) + rc = os.system(cmd) + cmd = 'mkdir -p %s/ImageBoot/%s/lib/firmware > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + cmd = 'cp -r /lib/firmware %s/ImageBoot/%s/lib > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + os.system('echo "Skopiowano sterowniki systemu. Nie skopiowano kernel.bin dla Ultimo HD - NIE ZALECANE DLA TEGO MODELU."') + + elif getBoxHostName() == 'vuultimo' or getCPUSoC() == '7335' or getCPUSoC() == '7325' or getCPUSoC() == '7405' or getCPUSoC() == '7356' or getCPUSoC() == '7424' or getCPUSoC() == '7241' or getCPUSoC() == '7362': + os.system('mv ' + getNeoLocation() + 'ImagesUpload/vuplus/' + getBoxVuModel() + '/kernel_cfe_auto.bin ' + media_target + '/boot/' + getBoxHostName() + '.vmlinux.gz' + dev_null) + os.system('echo "Skopiowano kernel.bin STB-MIPS"') + +#Ultra + elif getBoxHostName() == 'mbultra' or getCPUSoC() == 'bcm7424': + os.system('mv ' + getNeoLocation() + 'ImagesUpload/miraclebox/ultra/kernel.bin ' + media_target + '/boot/' + getBoxHostName() + '.vmlinux.gz' + dev_null) + os.system('echo "Skopiowano kernel.bin MiracleBoxUltra. Typ stb - MIPS"') + +#Edision OS MINI + elif getBoxHostName() == 'osmini' or getCPUSoC() == 'BCM7362': + os.system('mv ' + getNeoLocation() + 'ImagesUpload/osmini/kernel.bin ' + media_target + '/boot/' + getBoxHostName() + '.vmlinux.gz' + dev_null) + os.system('echo "Skopiowano kernel.bin Edision OS MINI. Typ stb - MIPS"') +#arm octagon + elif getCPUSoC() == 'bcm7251' or getBoxHostName() == 'sf4008': + os.system('mv ' + getNeoLocation() + 'ImagesUpload/' + getBoxHostName() + '/kernel.bin ' + media_target + '/boot/zImage.' + getBoxHostName() + '' + dev_null) + os.system('echo "Skopiowano kernel.bin STB-ARM Octagon."') + +#arm Zgemma h7 + elif getCPUSoC() == 'bcm7251s' or getBoxHostName() == 'h7': + os.system('mv ' + getNeoLocation() + 'ImagesUpload/zgemma/' + getBoxHostName() + '/kernel.bin ' + media_target + '/boot/zImage.' + getBoxHostName() + '' + dev_null) + os.system('echo "Skopiowano kernel.bin STB-ARM Zgemma h7."') +#arm gbquad4k + elif getCPUSoC() == 'bcm7252s' or getBoxHostName() == 'gbquad4k': + os.system('mv ' + getNeoLocation() + 'ImagesUpload/gigablue/quad4k' + getBoxHostName() + '/kernel.bin ' + media_target + '/boot/zImage.' + getBoxHostName() + '' + dev_null) + os.system('echo "Skopiowano kernel.bin STB-ARM gbquad4k."') + +#arm vuplus + elif getCPUSoC() == '7444s' or getCPUSoC() == '7278' or getCPUSoC() == '7376' or getCPUSoC() == '7252s' or getCPUSoC() == '72604': + os.system('mv ' + getNeoLocation() + 'ImagesUpload/vuplus/' + getBoxVuModel() + '/kernel_auto.bin ' + media_target + '/boot/zImage.' + getBoxHostName() + '' + dev_null) + os.system('echo "Skopiowano kernel.bin STB-ARM"') + + if not os.path.exists('' + getNeoLocation() + 'ImageBoot/.without_copying'): + if os.path.exists('/usr/sbin/nandwrite'): + cmd = 'cp -r /usr/sbin/nandwrite %s/ImageBoot/%s/usr/sbin/nandwrite > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + if os.path.exists('/usr/bin/fullwget'): + cmd = 'cp -r /usr/bin/fullwget %s/ImageBoot/%s/usr/bin/fullwget > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + if os.path.exists('/etc/init.d/inadyn-mt'): + cmd = 'cp -r /etc/init.d/inadyn-mt %s/ImageBoot/%s/etc/init.d/inadyn-mt > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + if os.path.exists('/usr/bin/inadyn-mt'): + cmd = 'cp -r /usr/bin/inadyn-mt %s/ImageBoot/%s/usr/bin/inadyn-mt > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + if os.path.exists('/etc/inadyn.conf'): + cmd = 'cp -r /etc/inadyn.conf %s/ImageBoot/%s/etc/inadyn.conf > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + if os.path.exists('/usr/lib/enigma2/python/Plugins/SystemPlugins/FanControl'): + cmd = 'cp -r /usr/lib/enigma2/python/Plugins/SystemPlugins/FanControl %s/ImageBoot/%s/usr/lib/enigma2/python/Plugins/SystemPlugins > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + if os.path.exists('/usr/lib/enigma2/python/Plugins/Extensions/EmuManager'): + cmd = 'cp -r /usr/lib/enigma2/python/Plugins/Extensions/EmuManager %s/ImageBoot/%s/usr/lib/enigma2/python/Plugins/Extensions > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + if os.path.exists('/usr/lib/enigma2/python/Plugins/Extensions/CamdMenager'): + cmd = 'cp -r /usr/lib/enigma2/python/Plugins/Extensions/CamdMenager %s/ImageBoot/%s/usr/lib/enigma2/python/Plugins/Extensions > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + if os.path.exists('/usr/lib/enigma2/python/Plugins/Extensions/IPTVPlayer'): + cmd = 'cp -r /usr/lib/enigma2/python/Plugins/Extensions/IPTVPlayer %s/ImageBoot/%s/usr/lib/enigma2/python/Plugins/Extensions > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + cmd = 'cp /usr/lib/python*.*/htmlentitydefs.pyo %s/ImageBoot/%s/usr/lib/python*.* > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + if os.path.exists('/usr/lib/enigma2/python/Plugins/Extensions/FeedExtra'): + cmd = 'cp -r /usr/lib/enigma2/python/Plugins/Extensions/FeedExtra %s/ImageBoot/%s/usr/lib/enigma2/python/Plugins/Extensions > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + if os.path.exists('/usr/lib/enigma2/python/Plugins/Extensions/MyUpdater'): + cmd = 'cp -r /usr/lib/enigma2/python/Plugins/Extensions/MyUpdater %s/ImageBoot/%s/usr/lib/enigma2/python/Plugins/Extensions > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + if not os.path.exists('%s/ImageBoot/%s/usr/lib/enigma2/python/boxbranding.so' % (media, target)): + cmd = 'cp -r /usr/lib/enigma2/python/boxbranding.so %s/ImageBoot/%s/usr/lib/enigma2/python/boxbranding.so > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + os.system('echo "Skopiowano wtyczki."') + + if TvList == 'True': + if not os.path.exists('%s/ImageBoot/%s/etc/enigma2' % (media, target)): + cmd = 'mkdir -p %s/ImageBoot/%s/etc/enigma2' % (media, target) + rc = os.system(cmd) + cmd = 'cp /etc/enigma2/*.tv %s/ImageBoot/%s/etc/enigma2' % (media, target) + rc = os.system(cmd) + cmd = 'cp /etc/enigma2/*.radio %s/ImageBoot/%s/etc/enigma2' % (media, target) + rc = os.system(cmd) + cmd = 'cp /etc/enigma2/*.tv %s/ImageBoot/%s/etc/enigma2' % (media, target) + rc = os.system(cmd) + cmd = 'cp /etc/enigma2/lamedb %s/ImageBoot/%s/etc/enigma2' % (media, target) + rc = os.system(cmd) + os.system('echo "Skopiowano list\xc4\x99 tv."') + + if Montowanie == 'True': + if os.path.exists('%s/ImageBoot/%s/etc/fstab' % (media, target)): + cmd = 'mv %s/ImageBoot/%s/etc/fstab %s/ImageBoot/%s/etc/fstab.org' % (media, + target, + media, + target) + rc = os.system(cmd) + if os.path.exists('%s/ImageBoot/%s/etc/init.d/volatile-media.sh' % (media, target)): + cmd = 'mv %s/ImageBoot/%s/etc/init.d/volatile-media.sh %s/ImageBoot/%s/etc/init.d/volatile-media.sh.org' % (media, + target, + media, + target) + rc = os.system(cmd) + cmd = 'cp -r /etc/fstab %s/ImageBoot/%s/etc/fstab' % (media, target) + rc = os.system(cmd) + cmd = 'cp -r /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/S50fat.sh %s/ImageBoot/%s/etc/rcS.d' % (media, target) + rc = os.system(cmd) + + if LanWlan == 'True': + if os.path.exists('%s/ImageBoot/%s/etc/vtiversion.info' % (media, target)): + os.system('echo "Nie skopiowano LAN-WLAN, nie zalecane dla tego image."') + elif os.path.exists('/etc/vtiversion.info') and os.path.exists('%s/usr/lib/enigma2/python/Plugins/PLi' % (media, target)): + os.system('echo "Nie skopiowano LAN-WLAN, nie zalecane dla tego image."') + elif os.path.exists('/etc/bhversion') and os.path.exists('%s/usr/lib/enigma2/python/Plugins/PLi' % (media, target)): + os.system('echo "Nie skopiowano LAN-WLAN, nie zalecane dla tego image."') + else: + if os.path.exists('/etc/wpa_supplicant.wlan0.conf'): + cmd = 'cp -Rpf /etc/wpa_supplicant.wlan0.conf %s/ImageBoot/%s/etc/wpa_supplicant.wlan0.conf > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + if os.path.exists('/etc/network/interfaces'): + cmd = 'cp -r /etc/network/interfaces %s/ImageBoot/%s/etc/network/interfaces > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + if os.path.exists('/etc/wpa_supplicant.conf'): + cmd = 'cp -Rpf /etc/wpa_supplicant.conf %s/ImageBoot/%s/etc/wpa_supplicant.conf > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + if os.path.exists('/etc/resolv.conf'): + cmd = 'cp -Rpf /etc/resolv.conf %s/ImageBoot/%s/etc/resolv.conf > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + if os.path.exists('/etc/wl.conf.wlan3'): + cmd = 'cp -r /etc/wl.conf.wlan3 %s/ImageBoot/%s/etc/wl.conf.wlan3 > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + + if Sterowniki == 'True': + if os.path.exists('%s/ImageBoot/%s/lib/modules' % (media, target)): + cmd = 'rm -r %s/ImageBoot/%s/lib/modules' % (media, target) + rc = os.system(cmd) + cmd = 'mkdir -p %s/ImageBoot/%s/lib/modules > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + cmd = 'cp -r /lib/modules %s/ImageBoot/%s/lib > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + if os.path.exists('%s/ImageBoot/%s/lib/firmware' % (media, target)): + cmd = 'rm -r %s/ImageBoot/%s/lib/firmware' % (media, target) + rc = os.system(cmd) + cmd = 'mkdir -p %s/ImageBoot/%s/lib/firmware > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + cmd = 'cp -r /lib/firmware %s/ImageBoot/%s/lib > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + os.system('echo "Skopiowano sterowniki systemu."') + + if InstallSettings == 'True': + if not os.path.exists('%s/ImageBoot/%s/etc/enigma2' % (media, target)): + cmd = 'mkdir -p %s/ImageBoot/%s/etc/enigma2' % (media, target) + rc = os.system(cmd) + cmd = 'cp /etc/enigma2/settings %s/ImageBoot/%s/etc/enigma2' % (media, target) + rc = os.system(cmd) + if not os.path.exists('%s/ImageBoot/%s/etc/tuxbox/config' % (media, target)): + cmd = 'mkdir -p /etc/tuxbox/config %s/ImageBoot/%s/etc/tuxbox/config' % (media, target) + rc = os.system(cmd) + cmd = 'mkdir -p /etc/tuxbox/scce %s/ImageBoot/%s/etc/tuxbox/scce' % (media, target) + rc = os.system(cmd) + cmd = 'cp -a /etc/tuxbox/* %s/ImageBoot/%s/etc/tuxbox' % (media, target) + rc = os.system(cmd) + os.system('echo "Skopiowano ustawienia systemu."') + + if RepairFTP == 'True': + if os.path.exists('%s/ImageBoot/%s/etc/vsftpd.conf' % (media, target)): + filename = media + '/ImageBoot/' + target + '/etc/vsftpd.conf' + if os.path.exists(filename): + filename2 = filename + '.tmp' + out = open(filename2, 'w') + f = open(filename, 'r') + for line in f.readlines(): + if line.find('listen=NO') != -1: + line = 'listen=YES\n' + elif line.find('listen_ipv6=YES') != -1: + line = 'listen_ipv6=NO\n' + out.write(line) + + f.close() + out.close() + os.rename(filename2, filename) + os.system('echo "Naprawa ftp."') + + if SoftCam == 'True': + if os.path.exists('/etc/CCcam.cfg'): + cmd = 'cp -r -f /etc/CCcam.cfg %s/ImageBoot/%s/etc > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + if os.path.exists('/etc/tuxbox/config'): + cmd = 'cp -r -f /etc/tuxbox/config %s/ImageBoot/%s/etc/tuxbox > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + if os.path.exists('/etc/init.d/softcam.oscam'): + cmd = 'cp -r -f -p /etc/init.d/softcam.osca* %s/ImageBoot/%s/etc/init.d > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + if os.path.exists('/etc/init.d/softcam.None'): + cmd = 'cp -r -f -p /etc/init.d/softcam.None %s/ImageBoot/%s/etc/init.d > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + if os.path.exists('/etc/init.d/softcam.CCcam'): + cmd = 'cp -r -f -p /etc/init.d/softcam.softcam.CCcam %s/ImageBoot/%s/etc/init.d > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + + if MediaPortal == 'True': + if os.path.exists('/usr/lib/enigma2/python/Plugins/Extensions/MediaPortal'): + cmd = 'cp -r /usr/lib/enigma2/python/Plugins/Extensions/MediaPortal %s/ImageBoot/%s/usr/lib/enigma2/python/Plugins/Extensions > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + cmd = 'cp -r /usr/lib/enigma2/python/Plugins/Extensions/mpgz %s/ImageBoot/%s/usr/lib/enigma2/python/Plugins/Extensions > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + cmd = 'cp -r /usr/lib/python2.7/argparse.pyo %s/ImageBoot/%s/usr/lib/python2.7 > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + cmd = 'cp -r /usr/lib/python2.7/robotparser.pyo %s/ImageBoot/%s/usr/lib/python2.7 > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + cmd = 'cp -r /usr/lib/python2.7/site-packages/Crypto %s/ImageBoot/%s/usr/lib/python2.7/site-packages > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + cmd = 'cp -r /usr/lib/python2.7/site-packages/mechanize %s/ImageBoot/%s/usr/lib/python2.7/site-packages > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + cmd = 'cp -r /usr/lib/python2.7/site-packages/requests %s/ImageBoot/%s/usr/lib/python2.7/site-packages > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + cmd = 'cp -r /usr/lib/python2.7/site-packages/requests-2.11.1-py2.7.egg-info %s/ImageBoot/%s/usr/lib/python2.7/site-packages > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + + if not os.path.exists('%s/ImageBoot/%s/etc/enigma2' % (media, target)): + cmd = 'mkdir -p %s/ImageBoot/%s/etc/enigma2' % (media, target) + rc = os.system(cmd) + cmd = 'cp /etc/enigma2/settings %s/ImageBoot/%s/etc/enigma2' % (media, target) + rc = os.system(cmd) + os.system('echo "Skopiowano MediaPortal z ustawieniami systemowymi."') + elif not os.path.exists('/usr/lib/enigma2/python/Plugins/Extensions/MediaPortal'): + os.system('echo "MediaPortal not found."') + + if not os.path.exists('' + getNeoLocation() + 'ImageBoot/.without_copying'): + #if os.path.exists('' + getNeoLocation() + 'ImageBoot'): + + + +# if getFSTAB2() == 'OKinstall': + + # os.system(' echo ' + fstablines + ' >> %s/ImageBoot/%s/etc/fstab' % (media, target)) + + + + + namefile = media + '/ImageBoot/' + target + '/etc/fstab' + namefile2 = namefile + '.tmp' + out = open(namefile2, 'w') + f = open(namefile, 'r') + for line in f.readlines(): + + if line.find('/dev/mmcblk0p1') != -1: + line = '#' + line + elif line.find('/dev/mmcblk0p2') != -1: + line = '#' + line + elif line.find('/dev/mmcblk0p3') != -1: + line = '#' + line + elif line.find('/dev/mmcblk0p4') != -1: + line = '#' + line + elif line.find('/dev/mmcblk0p5') != -1: + line = '#' + line + elif line.find('/dev/mmcblk0p6') != -1: + line = '#' + line + elif line.find('/dev/mmcblk0p7') != -1: + line = '#' + line + elif line.find('/dev/mmcblk0p8') != -1: + line = '#' + line + elif line.find('/dev/mmcblk0p9') != -1: + line = '#' + line + elif line.find('/dev/root') != -1: + line = '#' + line + elif line.find('/dev/mtdblock1') != -1: + line = '#' + line + elif line.find('/dev/mtdblock2') != -1: + line = '#' + line + elif line.find('/dev/mtdblock3') != -1: + line = '#' + line + elif line.find('/dev/mtdblock4') != -1: + line = '#' + line + elif line.find('/dev/mtdblock5') != -1: + line = '#' + line + elif line.find('/dev/mtdblock6') != -1: + line = '#' + line + elif line.find('/dev/mtdblock7') != -1: + line = '#' + line + elif line.find('/dev/mtdblock8') != -1: + line = '#' + line + elif line.find('/dev/mtdblock9') != -1: + line = '#' + line + elif line.find('/dev/root') != -1: + line = '#' + line + out.write(line) + + f.close() + out.close() + os.rename(namefile2, namefile) + + tpmd = media + '/ImageBoot/' + target + '/etc/init.d/tpmd' + if os.path.exists(tpmd): + os.system('rm ' + tpmd) + + fname = media + '/ImageBoot/' + target + '/usr/lib/enigma2/python/Components/config.py' + if os.path.exists(fname): + fname2 = fname + '.tmp' + out = open(fname2, 'w') + f = open(fname, 'r') + for line in f.readlines(): + if line.find('if file(""/proc/stb/info/vumodel")') != -1: + line = '#' + line + out.write(line) + + f.close() + out.close() + os.rename(fname2, fname) + + + targetfile = media + '/ImageBoot/' + target + '/etc/vsftpd.conf' + if os.path.exists(targetfile): + targetfile2 = targetfile + '.tmp' + out = open(targetfile2, 'w') + f = open(targetfile, 'r') + for line in f.readlines(): + if not line.startswith('nopriv_user'): + out.write(line) + + f.close() + out.close() + os.rename(targetfile2, targetfile) + + + mypath = media + '/ImageBoot/' + target + '/usr/lib/opkg/info/' + cmd = 'mkdir -p %s/ImageBoot/%s/var/lib/opkg/info > /dev/null 2>&1' % (media, target) + rc = os.system(cmd) + if not os.path.exists(mypath): + mypath = media + '/ImageBoot/' + target + '/var/lib/opkg/info/' + for fn in os.listdir(mypath): + if fn.find('kernel-image') != -1 and fn.find('postinst') != -1: + filename = mypath + fn + filename2 = filename + '.tmp' + out = open(filename2, 'w') + f = open(filename, 'r') + for line in f.readlines(): + if line.find('/boot') != -1: + line = line.replace('/boot', '/boot > /dev/null 2>\\&1; exit 0') + out.write(line) + + if f.close(): + out.close() + os.rename(filename2, filename) + cmd = 'chmod -R 0755 %s' % filename + rc = os.system(cmd) + if fn.find('-bootlogo.postinst') != -1: + filename = mypath + fn + filename2 = filename + '.tmp' + out = open(filename2, 'w') + f = open(filename, 'r') + for line in f.readlines(): + if line.find('/boot') != -1: + line = line.replace('/boot', '/boot > /dev/null 2>\\&1; exit 0') + out.write(line) + + f.close() + out.close() + os.rename(filename2, filename) + cmd = 'chmod -R 0755 %s' % filename + rc = os.system(cmd) + if fn.find('-bootlogo.postrm') != -1: + filename = mypath + fn + filename2 = filename + '.tmp' + out = open(filename2, 'w') + f = open(filename, 'r') + for line in f.readlines(): + if line.find('/boot') != -1: + line = line.replace('/boot', '/boot > /dev/null 2>\\&1; exit 0') + out.write(line) + + f.close() + out.close() + os.rename(filename2, filename) + cmd = 'chmod -R 0755 %s' % filename + rc = os.system(cmd) + if fn.find('-bootlogo.preinst') != -1: + filename = mypath + fn + filename2 = filename + '.tmp' + out = open(filename2, 'w') + f = open(filename, 'r') + for line in f.readlines(): + if line.find('/boot') != -1: + line = line.replace('/boot', '/boot > /dev/null 2>\\&1; exit 0') + out.write(line) + + f.close() + out.close() + os.rename(filename2, filename) + cmd = 'chmod -R 0755 %s' % filename + rc = os.system(cmd) + if fn.find('-bootlogo.prerm') != -1: + filename = mypath + fn + filename2 = filename + '.tmp' + out = open(filename2, 'w') + f = open(filename, 'r') + for line in f.readlines(): + if line.find('/boot') != -1: + line = line.replace('/boot', '/boot > /dev/null 2>\\&1; exit 0') + out.write(line) + + f.close() + out.close() + os.rename(filename2, filename) + cmd = 'chmod -R 0755 %s' % filename + rc = os.system(cmd) + + os.system('mkdir -p ' + media_target + '/media/hdd' + dev_null) + os.system('mkdir -p ' + media_target + '/media/usb' + dev_null) + + os.system('mkdir -p ' + media_target + '/var/lib/opkg/info/' + dev_null) + os.system('touch ' + getNeoLocation() + 'ImageBoot/.data; echo "Data instalacji image" > ' + getNeoLocation() + 'ImageBoot/.data; echo " "; date > ' + getNeoLocation() + 'ImageBoot/.data') + os.system('mv -f ' + getNeoLocation() + 'ImageBoot/.data ' + getNeoLocation() + 'ImageBoot/%s/.data' % target) + cmd = 'touch /tmp/.init_reboot' + rc = os.system(cmd) + out = open(mediahome + '.neonextboot', 'w') + out.write(target) + out.close() + os.system('cp ' + getNeoLocation() + 'ImageBoot/.neonextboot ' + getNeoLocation() + 'ImageBoot/%s/.multinfo' % target) + out = open(mediahome + '.neonextboot', 'w') + out.write('Flash') + out.close() + os.system('echo "Zako\xc5\x84czono instalacj\xc4\x99 nowego systemu. EXIT "') + os.system('echo "End of installation:"; date +%T') + if '.tar.xz' not in source and not os.path.exists('' + getNeoLocation() + '/ImageBoot/%s/etc/issue' % target): + os.system('echo ""; echo "Nie zainstalowano systemu ! Powodem b\xc5\x82\xc4\x99du instalacji mo\xc5\xbce by\xc4\x87 \xc5\xbale spakowany plik image w zip lub nie jest to sytem dla Twojego modelu ."') + os.system('echo "Instalowany system może sieę nie uruchomić poprawnie! Sprawdż poprawność kataogow w instalwoanym image!!!"') + os.system('rm -r ' + getNeoLocation() + '/ImageBoot/%s' % target ) + + if os.path.exists('' + getNeoLocation() + 'ubi'): + os.system('rm -rf ' + getNeoLocation() + 'ubi') + if os.path.exists('' + getNeoLocation() + 'image_cache/'): + os.system('rm ' + getNeoLocation() + 'image_cache') + if os.path.exists('' + getNeoLocation() + 'ImageBoot/.without_copying'): + os.system('rm ' + getNeoLocation() + 'ImageBoot/.without_copying') + rc = os.system('sync') + rc = RemoveUnpackDirs() + if os.path.exists('/tmp/init4'): + os.system('rm -f /tmp/init4; init 3') + + +def RemoveUnpackDirs(): + os.chdir(media + '/ImagesUpload') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus'): + rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/vuplus') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/sf4008'): + rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/sf4008') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/octagon/sf8008'): + rc = os.system('mv ' + getNeoLocation() + 'ImagesUpload/usb_update.bin ' + getNeoLocation() + 'ImagesUpload/octagon; rm -r ' + getNeoLocation() + 'ImagesUpload/octagon') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/hd60'): + rc = os.system('mv ' + getNeoLocation() + 'ImagesUpload/bootargs.bin ' + getNeoLocation() + 'ImagesUpload/hd60; mv ' + getNeoLocation() + 'ImagesUpload/fastboot.bin ' + getNeoLocation() + 'ImagesUpload/hd60; rm -r ' + getNeoLocation() + 'ImagesUpload/hd60') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/osmio4k'): + rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/osmio4k') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/dm900'): + rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/dm900') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/hd51'): + rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/hd51') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/gigablue'): + rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/gigablue') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/miraclebox'): + rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/miraclebox') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/e4hd'): + rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/e4hd') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/update'): + rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/update') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/rootfs.tar.xz'): + rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/rootfs.tar.xz') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/*.nfi'): + rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/*.nfi') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/zgemma'): + rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/zgemma') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/h7'): + rc = os.system('mv ' + getNeoLocation() + 'ImagesUpload/bootargs.bin ' + getNeoLocation() + 'ImagesUpload/h7; mv ' + getNeoLocation() + 'ImagesUpload/fastboot.bin ' + getNeoLocation() + 'ImagesUpload/h7') + rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/h7') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/h9'): + rc = os.system('mv ' + getNeoLocation() + 'ImagesUpload/bootargs.bin ' + getNeoLocation() + 'ImagesUpload/h9; mv ' + getNeoLocation() + 'ImagesUpload/fastboot.bin ' + getNeoLocation() + 'ImagesUpload/h9') + rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/h9') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/uclan'): + rc = os.system('mv ' + getNeoLocation() + 'ImagesUpload/usb_update.bin ' + getNeoLocation() + 'ImagesUpload/uclan') + rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/uclan') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/formuler1'): + rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/formuler1') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/formuler3'): + rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/formuler3') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/formuler4turbo'): + rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/formuler4turbo') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/et*'): + rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/et*') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/xpeedl*'): + rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/xpeedl*') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/osmini'): + rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/osmini') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/xp1000 '): + rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/xp1000 ') + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/dinobot '): + rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/dinobot ') + + os.system('echo "Remove Unpack Dirs..."') + + +def NEOBootExtract(source, target, ZipDelete, BlackHole): + os.system('echo "Start of installation:"; date +%T') + RemoveUnpackDirs() + + if os.path.exists('' + getNeoLocation() + 'ImageBoot/.without_copying'): + os.system('rm ' + getNeoLocation() + 'ImageBoot/.without_copying') + if os.path.exists('' + getNeoLocation() + 'image_cache'): + os.system('rm -rf ' + getNeoLocation() + 'image_cache') + + sourcefile = media + '/ImagesUpload/%s.zip' % source + sourcefile2 = media + '/ImagesUpload/%s.nfi' % source + + os.system('echo "This may take a few minutes to complete...."') + + #Instalacja *.nfi + if os.path.exists(sourcefile2) is True: + if sourcefile2.endswith('.nfi'): + os.system('echo "Instalacja systemu skapowanego w plik nfi..."') + to = '' + getNeoLocation() + 'ImageBoot/' + target + cmd = 'mkdir %s > /dev/null 2<&1' % to + rc = os.system(cmd) + to = '' + getNeoLocation() + 'ImageBoot/' + target + cmd = 'chmod -R 0777 %s' % to + rc = os.system(cmd) + cmd = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/nfidump ' + sourcefile2 + ' ' + getNeoLocation() + 'ImageBoot/' + target + rc = os.system(cmd) + if ZipDelete == 'True': + rc = os.system('rm -rf ' + sourcefile2) + else: + os.system('echo "NeoBoot keep the file: %s for reinstallation."' % sourcefile2) + #Instalacja *.zip + elif os.path.exists(sourcefile) is True: + os.system('unzip ' + sourcefile) + if ZipDelete == 'True': + os.system('rm -rf ' + sourcefile) + os.system('echo "Rozpakowywanie pliku instalacyjnego..."') + + #Instalacja MIPS + if getCPUtype() == 'MIPS': + if os.path.exists('' + getNeoLocation() + 'ubi') is False: + rc = os.system('mkdir ' + getNeoLocation() + 'ubi') + to = '' + getNeoLocation() + 'ImageBoot/' + target + cmd = 'mkdir %s > /dev/null 2<&1' % to + rc = os.system(cmd) + to = '' + getNeoLocation() + 'ImageBoot/' + target + cmd = 'chmod -R 0777 %s' % to + rc = os.system(cmd) + rootfname = 'rootfs.bin' + brand = '' + #NANDSIM + if os.path.exists('/lib/modules/%s/kernel/drivers/mtd/nand/nandsim.ko' % getKernelVersion()): + for i in range(0, 20): + mtdfile = '/dev/mtd' + str(i) + if os.path.exists(mtdfile) is False: + break + + mtd = str(i) + os.chdir(media + '/ImagesUpload') + #zgemma + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/zgemma'): + os.chdir('zgemma') + brand = 'zgemma' + rootfname = 'rootfs.bin' + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/zgemma/sh1'): + os.chdir('sh1') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/zgemma/sh2'): + os.chdir('sh2') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/zgemma/h2'): + os.chdir('h2') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/zgemma/h3'): + os.chdir('h3') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/zgemma/h5'): + os.chdir('h5') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/zgemma/h7'): + os.chdir('h7') + + #miraclebox + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/miraclebox'): + os.chdir('miraclebox') + brand = 'miraclebox' + rootfname = 'rootfs.bin' + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/miraclebox/mini'): + os.chdir('mini') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/miraclebox/miniplus'): + os.chdir('miniplus') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/miraclebox/minihybrid'): + os.chdir('minihybrid') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/miraclebox/twin'): + os.chdir('twin') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/miraclebox/ultra'): + os.chdir('ultra') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/miraclebox/micro'): + os.chdir('micro') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/miraclebox/twinplus'): + os.chdir('twinplus') + #atemio + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/atemio'): + os.chdir('atemio') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/atemio/5x00'): + os.chdir('5x00') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/atemio/6000'): + os.chdir('6000') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/atemio/6100'): + os.chdir('6100') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/atemio/6200'): + os.chdir('6200') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/atemio/8x00'): + os.chdir('8x00') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/atemio/8x00'): + os.chdir('8x00') + #Xtrend + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/et10000'): + os.chdir('et10000') + brand = 'et10000' + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/et9x00'): + os.chdir('et9x00') + brand = 'et9x00' + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/et8500'): + os.chdir('et8500') + brand = 'et8500' + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/et8000'): + os.chdir('et8000') + brand = 'et8000' + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/et7x00'): + os.chdir('et7x00') + brand = 'et7x00' + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/et6x00'): + os.chdir('et6x00') + brand = 'et6x00' + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/et5x00'): + os.chdir('et5x00') + brand = 'et5x00' + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/et4x00'): + os.chdir('et4x00') + brand = 'et4x00' + #formuler + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/formuler1'): + os.chdir('formuler1') + brand = 'formuler1' + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/formuler2'): + os.chdir('formuler2') + brand = 'formuler2' + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/formuler3'): + os.chdir('formuler3') + brand = 'formuler3' + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/formuler4turbo'): + os.chdir('formuler4turbo') + brand = 'formuler4turbo' + #inne + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/sf3038'): + os.chdir('sf3038') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/xpeedlx'): + os.chdir('xpeedlx') + brand = 'xpeedlx' + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/xpeedlx3'): + os.chdir('xpeedlx3') + brand = 'xpeedlx3' + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/xp1000'): + os.chdir('xp1000') + brand = 'xp1000' + #VuPlus + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus'): + os.chdir('vuplus') + brand = 'vuplus' + rootfname = 'root_cfe_auto.jffs2' + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/uno'): + os.chdir('uno') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/duo'): + os.chdir('duo') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/ultimo'): + os.chdir('ultimo') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/solo'): + os.chdir('solo') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/duo2'): + os.chdir('duo2') + rootfname = 'root_cfe_auto.bin' + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/solo2'): + os.chdir('solo2') + rootfname = 'root_cfe_auto.bin' + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/solose'): + os.chdir('solose') + rootfname = 'root_cfe_auto.bin' + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/zero'): + os.chdir('zero') + rootfname = 'root_cfe_auto.bin' + + #osmini + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/osmini'): + os.chdir('osmini') + brand = 'osmini' + + + #Instalacja image nandsim + os.system('echo "Instalacja - nandsim w toku..."') + rc = os.system('insmod /lib/modules/%s/kernel/drivers/mtd/nand/nandsim.ko cache_file=' + getNeoLocation() + 'image_cache first_id_byte=0x20 second_id_byte=0xaa third_id_byte=0x00 fourth_id_byte=0x15;sleep 5' % getKernelVersion()) + cmd = 'dd if=%s of=/dev/mtdblock%s bs=2048' % (rootfname, mtd) + rc = os.system(cmd) + cmd = 'ubiattach /dev/ubi_ctrl -m %s -O 2048' % mtd + rc = os.system(cmd) + rc = os.system('mount -t ubifs ubi1_0 ' + getNeoLocation() + 'ubi') + os.chdir('/home/root') + cmd = 'cp -r ' + getNeoLocation() + 'ubi/* ' + getNeoLocation() + 'ImageBoot/' + target + rc = os.system(cmd) + rc = os.system('umount ' + getNeoLocation() + 'ubi') + cmd = 'ubidetach -m %s' % mtd + rc = os.system(cmd) + rc = os.system('rmmod nandsim') + rc = os.system('rm ' + getNeoLocation() + 'image_cache') + + if '.tar.xz' not in source and not os.path.exists('%s/ImageBoot/%s/etc/issue' % (media, target)): + rc = os.system('sync') + os.system("echo 3 > /proc/sys/vm/drop_caches") + + os.system('echo ""; echo "Nie zainstalowano systemu ! Powodem b\xc5\x82\xc4\x99du instalacji mo\xc5\xbce by\xc4\x87 kernel-module-nandsim."') + os.system('echo "By uzyc innego narzedzia do rozpakowania image, ponow instalacje image jeszcze raz po restarcie tunera."') + os.system('echo "RESTART ZA 15 sekund..."') + + rc = os.system('rm -rf /lib/modules/%s/kernel/drivers/mtd/nand/nandsim.ko ' % getKernelVersion()) + + os.system('rm -r %s/ImageBoot/%s' % (media, target)) + os.system('sleep 5; sync; init 4; sleep 5; init 3 ') + + #UBI_READER + elif os.path.exists('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/ubi_reader/ubi_extract_files.py'): + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/venton-hdx'): + os.chdir('venton-hdx') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/hde'): + os.chdir('hde') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/hdx'): + os.chdir('hdx') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/hdp'): + os.chdir('hdp') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/miraclebox'): + os.chdir('miraclebox') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/miraclebox/mini'): + os.chdir('mini') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/miraclebox/miniplus'): + os.chdir('miniplus') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/miraclebox/minihybrid'): + os.chdir('minihybrid') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/miraclebox/twin'): + os.chdir('twin') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/miraclebox/ultra'): + os.chdir('ultra') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/miraclebox/micro'): + os.chdir('micro') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/miraclebox/microv2'): + os.chdir('microv2') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/miraclebox/twinplus'): + os.chdir('twinplus') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/miraclebox/mini4k'): + os.chdir('mini4k') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/miraclebox/ultra4k'): + os.chdir('ultra4k') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/atemio'): + os.chdir('atemio') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/atemio/5x00'): + os.chdir('5x00') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/atemio/6000'): + os.chdir('6000') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/atemio/6100'): + os.chdir('6100') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/atemio/6200'): + os.chdir('6200') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/atemio/8x00'): + os.chdir('8x00') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/xpeedlx'): + os.chdir('xpeedlx') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/xpeedlx3'): + os.chdir('xpeedlx3') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/bwidowx'): + os.chdir('bwidowx') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/bwidowx2'): + os.chdir('bwidowx2') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/beyonwiz'): + os.chdir('beyonwiz') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/beyonwiz/hdx'): + os.chdir('hdx') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/beyonwiz/hdp'): + os.chdir('hdp') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/beyonwiz/hde2'): + os.chdir('hde2') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus'): + os.chdir('vuplus') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/duo'): + os.chdir('duo') + os.system('mv root_cfe_auto.jffs2 rootfs.bin') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/solo'): + os.chdir('solo') + os.system('mv -f root_cfe_auto.jffs2 rootfs.bin') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/solose'): + os.chdir('solose') + os.system('mv -f root_cfe_auto.jffs2 rootfs.bin') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/ultimo'): + os.chdir('ultimo') + os.system('mv -f root_cfe_auto.jffs2 rootfs.bin') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/uno'): + os.chdir('uno') + os.system('mv -f root_cfe_auto.jffs2 rootfs.bin') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/solo2'): + os.chdir('solo2') + os.system('mv -f root_cfe_auto.bin rootfs.bin') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/duo2'): + os.chdir('duo2') + os.system('mv -f root_cfe_auto.bin rootfs.bin') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/zero'): + os.chdir('zero') + os.system('mv -f root_cfe_auto.bin rootfs.bin') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/solo4k'): + os.chdir('solo4k') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/uno4k'): + os.chdir('uno4k') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/ultimo4k'): + os.chdir('ultimo4k') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/duo4k'): + os.chdir('duo4k') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/zero4k'): + os.chdir('zero4k') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/uno4kse'): + os.chdir('uno4kse') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/et10000'): + os.chdir('et10000') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/et9x00'): + os.chdir('et9x00') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/et8500'): + os.chdir('et8500') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/et8000'): + os.chdir('et8000') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/et7x00'): + os.chdir('et7x00') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/et6x00'): + os.chdir('et6x00') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/et5x00'): + os.chdir('et5x00') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/et4x00'): + os.chdir('et4x00') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/sf8'): + os.chdir('sf') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/sf98'): + os.chdir('sf98') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/sf108'): + os.chdir('sf108') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/sf128'): + os.chdir('sf128') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/sf138'): + os.chdir('sf138') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/sf208'): + os.chdir('sf208') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/sf228'): + os.chdir('sf228') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/sf3038'): + os.chdir('sf3038') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/sf4008'): + os.chdir('sf4008') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/octagon/sf8008'): + os.chdir('sf8008') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/gigablue'): + os.chdir('gigablue') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/gigablue/quad'): + os.chdir('quad') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/hd2400'): + os.chdir('hd2400') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/hd51'): + os.chdir('hd51') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/zgemma'): + os.chdir('zgemma') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/zgemma/h3'): + os.chdir('h3') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/zgemma/h5'): + os.chdir('h5') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/zgemma/h7'): + os.chdir('h7') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/dm900'): + os.chdir('dm900') + #osmini + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/osmini'): + os.chdir('osmini') + #xp1000 + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/xp1000'): + os.chdir('xp1000') + + #Instalacja image ubi_reader + os.system('echo "Instalacja - ubi_reader w toku..."') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/root_cfe_auto.*'): + os.system('mv -f root_cfe_auto.* rootfs.bin') + cmd = 'chmod 777 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/ubi_reader/ubi_extract_files.py' + rc = os.system(cmd) + cmd = 'python /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/ubi_reader/ubi_extract_files.py rootfs.bin -o' + getNeoLocation() + 'ubi' + rc = os.system(cmd) + os.chdir('/home/root') + os.system('mv ' + getNeoLocation() + 'ubi/rootfs/* ' + getNeoLocation() + 'ImageBoot/%s/' % target) + cmd = 'chmod -R +x ' + getNeoLocation() + 'ImageBoot/' + target + rc = os.system(cmd) + + else: + os.system('echo "NeoBoot wykrył błąd !!! Prawdopodobnie brak ubi_reader lub nandsim."') + +#ARM + elif getCPUtype() == 'ARMv7': + os.chdir('' + getNeoLocation() + 'ImagesUpload') + if os.path.exists('' + getNeoLocation() + 'ImagesUpload/h9/rootfs.ubi'): + os.chdir('h9') + os.system('mv -f rootfs.ubi rootfs.bin') + os.system('echo "Instalacja - ubi_reader w toku..."') + print '[NeoBoot] Extracting UBIFS image and moving extracted image to our target' + cmd = 'chmod 777 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/ubi_reader/ubi_extract_files.py' + rc = os.system(cmd) + cmd = 'python /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/ubi_reader/ubi_extract_files.py rootfs.bin -o ' + getNeoLocation() + 'ubi' + rc = os.system(cmd) + os.chdir('/home/root') + cmd = 'cp -r -p ' + getNeoLocation() + 'ubi/rootfs/* ' + getNeoLocation() + 'ImageBoot/' + target + rc = os.system(cmd) + cmd = 'chmod -R +x ' + getNeoLocation() + 'ImageBoot/' + target + rc = os.system(cmd) + cmd = 'rm -rf ' + getNeoLocation() + 'ubi' + rc = os.system(cmd) + + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/sf4008'): + os.system('echo "Instalacja systemu Octagon SF4008."') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/sf4008/rootfs.tar.bz2; tar -jxvf ' + getNeoLocation() + 'ImagesUpload/sf4008/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/octagon/sf8008'): + os.system('echo "Instalacja systemu Octagon SF8008."') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/octagon/sf8008/rootfs.tar.bz2; tar -jxvf ' + getNeoLocation() + 'ImagesUpload/octagon/sf8008/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/osmio4k'): + os.system('echo "Instalacja systemu EDISION osmio4k"') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/osmio4k/rootfs.tar.bz2; tar -jxvf ' + getNeoLocation() + 'ImagesUpload/osmio4k/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/dm900'): + os.system('echo "Instalacja systemu Dreambox DM900."') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/dm900/rootfs.tar.bz2; tar -jxvf ' + getNeoLocation() + 'ImagesUpload/dm900/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/%s.tar.xz' % source): + os.system('echo "Instalacja systemu spakowanego w plik tar.xz w toku..."') + os.system('cp -r ' + getNeoLocation() + 'ImagesUpload/%s.tar.xz ' + getNeoLocation() + 'ImagesUpload/rootfs.tar.xz' % source) + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/rootfs.tar.xz; tar -jJxvf ' + getNeoLocation() + 'ImagesUpload/rootfs.tar.xz -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/hd51/rootfs.tar.bz2'): + os.system('echo "Instalacja systemu HD51 "') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/hd51/rootfs.tar.bz2; tar -jxvf ' + getNeoLocation() + 'ImagesUpload/hd51/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/hd60'): + os.system('echo "Instalacja systemu AX HD60 4K"') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/hd60/rootfs.tar.bz2; tar -jxvf ' + getNeoLocation() + 'ImagesUpload/hd60/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/gigablue/quad4k'): + os.system('echo "Instalacja systemu GigaBlue quad4k"') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/gigablue/quad4k/rootfs.tar.bz2; tar -jxvf ' + getNeoLocation() + 'ImagesUpload/gigablue/quad4k/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/gigablue/ue4k'): + os.system('echo "Instalacja systemu GigaBlue ue4k."') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/gigablue/ue4k/rootfs.tar.bz2; tar -jxvf ' + getNeoLocation() + 'ImagesUpload/gigablue/ue4k/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/solo4k'): + os.system('echo "Instalacja systemu VuPlus Solo4K."') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/vuplus/solo4k/rootfs.tar.bz2; tar -jxvf ' + getNeoLocation() + 'ImagesUpload/vuplus/solo4k/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/uno4k'): + os.system('echo "Instalacja systemu dla modelu VuPlus Uno4K."') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/vuplus/uno4k/rootfs.tar.bz2; tar -jxvf ' + getNeoLocation() + 'ImagesUpload/vuplus/uno4k/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/uno4kse'): + os.system('echo "Instalacja systemu VuPlus Uno4kse."') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/vuplus/uno4kse/rootfs.tar.bz2; tar -jxvf ' + getNeoLocation() + 'ImagesUpload/vuplus/uno4kse/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/zero4k'): + os.system('echo "Instalacja systemu VuPlus zero4K."') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/vuplus/zero4k/rootfs.tar.bz2; tar -jxvf ' + getNeoLocation() + 'ImagesUpload/vuplus/zero4k/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/ultimo4k'): + os.system('echo "Instalacja systemu VuPlus Ultimo4K."') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/vuplus/ultimo4k/rootfs.tar.bz2; tar -jxvf ' + getNeoLocation() + 'ImagesUpload/vuplus/ultimo4k/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/vuplus/duo4k'): + os.system('echo "Instalacja systemu VuPlus Duo4k."') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/vuplus/duo4k/rootfs.tar.bz2; tar -jxvf ' + getNeoLocation() + 'ImagesUpload/vuplus/duo4k/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/update/revo4k'): + os.system('echo "Instalacja systemu Revo4k."') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/update/revo4k/rootfs.tar.bz2; tar -jxvf ' + getNeoLocation() + 'ImagesUpload/update/revo4k/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/update/galaxy4k'): + os.system('echo "Instalacja systemu Galaxy4k."') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/update/galaxy4k/rootfs.tar.bz2; tar -jxvf ' + getNeoLocation() + 'ImagesUpload/update/galaxy4k/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/zgemma/h7/rootfs.tar.bz2'): + os.system('echo "Instalacja systemu Zgemma H7."') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/zgemma/h7/rootfs.tar.bz2; tar -jxf ' + getNeoLocation() + 'ImagesUpload/zgemma/h7/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/zgemma/h9/rootfs.tar.bz2'): + os.system('echo "Instalacja systemu Zgemma H9S ."') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/zgemma/h9/rootfs.tar.bz2; tar -jxf ' + getNeoLocation() + 'ImagesUpload/zgemma/h9/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/miraclebox/mini4k'): + os.system('echo "Instalacja systemu Miraclebox mini4k."') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/miraclebox/mini4k/rootfs.tar.bz2; tar -jxvf ' + getNeoLocation() + 'ImagesUpload/miraclebox/mini4k/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/miraclebox/ultra4k'): + os.system('echo "Instalacja systemu Miraclebox ultra4k."') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/miraclebox/ultra4k/rootfs.tar.bz2; tar -jxvf ' + getNeoLocation() + 'ImagesUpload/miraclebox/ultra4k/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/e4hd'): + os.system('echo "Instalacja systemu Axas E4HD 4K Ultra w toku..."') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/e4hd/rootfs.tar.bz2; tar -jxvf ' + getNeoLocation() + 'ImagesUpload/e4hd/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/update/lunix3-4k'): + os.system('echo "Instalacja systemu Qviart lunix3-4k w toku..."') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/update/lunix3-4k; tar -jxvf ' + getNeoLocation() + 'ImagesUpload/update/lunix3-4k/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/dinobot/u5'): + os.system('echo "Instalacja systemu dinobot w toku..."') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/dinobot/u5; tar -jxvf ' + getNeoLocation() + 'ImagesUpload/dinobot/u5/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/uclan/ustym4kpro'): + os.system('echo "Instalacja systemu ustym4kpro w toku..."') + cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/uclan/ustym4kpro; tar -jxvf ' + getNeoLocation() + 'ImagesUpload/uclan/ustym4kpro/rootfs.tar.bz2 -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' + rc = os.system(cmd) + + else: + os.system('echo "NeoBoot wykrył dłąd!!! Prawdopodobnie brak pliku instalacyjnego."') + + + if BlackHole == 'True': + if 'BlackHole' in source and os.path.exists('%s/ImageBoot/%s/usr/lib/enigma2/python/Blackhole' % (media, target)): + ver = source.replace('BlackHole-', '') + try: + text = ver.split('-')[0] + except: + text = '' + + cmd = 'mkdir ' + getNeoLocation() + 'ImageBoot/%s/boot/blackhole' % target + rc = os.system(cmd) + cmd = 'cp -f /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/version ' + getNeoLocation() + 'ImageBoot/%s/boot/blackhole' % target + rc = os.system(cmd) + cmd = 'mv ' + getNeoLocation() + 'ImageBoot/%s/usr/lib/enigma2/python/Blackhole/BhUtils.pyo ' + getNeoLocation() + 'ImageBoot/%s/usr/lib/enigma2/python/Blackhole/BhUtils.pyo.org' % (target, target) + rc = os.system(cmd) + cmd = 'cp -rf /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/utilsbh ' + getNeoLocation() + 'ImageBoot/%s/usr/lib/enigma2/python/Blackhole/BhUtils.py' % target + rc = os.system(cmd) + localfile = '' + getNeoLocation() + 'ImageBoot/%s/boot/blackhole/version' % target + temp_file = open(localfile, 'w') + temp_file.write(text) + temp_file.close() + cmd = 'mv ' + getNeoLocation() + 'ImageBoot/%s/usr/bin/enigma2 ' + getNeoLocation() + 'ImageBoot/%s/usr/bin/enigma2-or' % (target, target) + rc = os.system(cmd) + fail = '' + getNeoLocation() + 'ImageBoot/%s/usr/bin/enigma2-or' % target + f = open(fail, 'r') + content = f.read() + f.close() + localfile2 = '' + getNeoLocation() + 'ImageBoot/%s/usr/bin/enigma2' % target + temp_file2 = open(localfile2, 'w') + temp_file2.write(content.replace('/proc/blackhole/version', '/boot/blackhole/version')) + temp_file2.close() + cmd = 'chmod -R 0755 %s' % localfile2 + rc = os.system(cmd) + cmd = 'rm -r ' + getNeoLocation() + 'ImageBoot/%s/usr/bin/enigma2-or' % target + rc = os.system(cmd) + + return 0 +#END diff --git a/neoinstal.mvi b/neoinstal.mvi new file mode 100644 index 0000000..fc4e353 Binary files /dev/null and b/neoinstal.mvi differ diff --git a/neologo.mvi b/neologo.mvi new file mode 100644 index 0000000..773c5cd Binary files /dev/null and b/neologo.mvi differ diff --git a/neowait.mvi b/neowait.mvi new file mode 100644 index 0000000..dc4d38c Binary files /dev/null and b/neowait.mvi differ diff --git a/plugin.py b/plugin.py new file mode 100644 index 0000000..cdba888 --- /dev/null +++ b/plugin.py @@ -0,0 +1,1559 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +####################### _(-_-)_ gutosie _(-_-)_ ####################### + +#neoboot modules +from __init__ import _ +from Plugins.Extensions.NeoBoot.files.stbbranding import getLabelDisck, getINSTALLNeo, getNeoLocation, getNeoMount, getNeoMount2, getFSTAB, getFSTAB2, getKernelVersionString, getKernelImageVersion, getCPUtype, getCPUSoC, getImageNeoBoot, getBoxVuModel, getBoxHostName, getTunerModel +from Plugins.Extensions.NeoBoot.files import Harddisk +from Components.About import about +from enigma import getDesktop +from enigma import eTimer +from Screens.Screen import Screen +from Screens.Console import Console +from Screens.MessageBox import MessageBox +from Screens.ChoiceBox import ChoiceBox +from Screens.VirtualKeyBoard import VirtualKeyBoard +from Screens.Standby import TryQuitMainloop +from Components.About import about +from Components.Sources.List import List +from Components.Button import Button +from Components.ActionMap import ActionMap, NumberActionMap +from Components.GUIComponent import * +from Components.MenuList import MenuList +from Components.Input import Input +from Components.Label import Label +from Components.ProgressBar import ProgressBar +from Components.ScrollLabel import ScrollLabel +from Components.Pixmap import Pixmap, MultiPixmap +from Components.config import * +from Components.ConfigList import ConfigListScreen +from Tools.LoadPixmap import LoadPixmap +from Tools.Directories import fileExists, pathExists, createDir, resolveFilename, SCOPE_PLUGINS +from os import system, listdir, mkdir, chdir, getcwd, rename as os_rename, remove as os_remove, popen +from os.path import dirname, isdir, isdir as os_isdir +import os +import time +# Copyright (c) , gutosie license +# +# Redystrybucja wersji programu i dokonywania modyfikacji JEST DOZWOLONE, pod warunkiem zachowania niniejszej informacji o prawach autorskich. +# Autor NIE ponosi JAKIEJKOLWIEK odpowiedzialności za skutki użtkowania tego programu oraz za wykorzystanie zawartych tu informacji. +# Modyfikacje przeprowadzasz na wlasne ryzyko!!! +# O wszelkich zmianach prosze poinformować na http://all-forum.cba.pl w temacie pod nazwa -#[NEOBOOT]#- + +# This text/program is free document/software. Redistribution and use in +# source and binary forms, with or without modification, ARE PERMITTED provided +# save this copyright notice. This document/program is distributed WITHOUT any +# warranty, use at YOUR own risk. + +PLUGINVERSION = '1.00' +UPDATEVERSION = '1.01' + +def Freespace(dev): + statdev = os.statvfs(dev) + space = statdev.f_bavail * statdev.f_frsize / 1024 + print '[NeoBoot] Free space on %s = %i kilobytes' % (dev, space) + return space + + +#def Log(param = '') + + +class MyUpgrade(Screen): + screenwidth = getDesktop(0).size().width() + if screenwidth and screenwidth == 1920: + skin = """ + + + \ + {"template": [MultiContentEntryText(pos = (90, 1), size = (920, 66), flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 0), + MultiContentEntryPixmapAlphaTest(pos = (8, 4), size = (66, 66), png = 1), + ], + "fonts": [gFont("Regular", 40)], + "itemHeight": 66 + } + + + + + """ + else: + skin = """ + + + + {"template": [MultiContentEntryText(pos = (90, 1), size = (920, 66), flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 0), + MultiContentEntryPixmapAlphaTest(pos = (8, 4), size = (66, 66), png = 1), + ], + "fonts": [gFont("Regular", 40)], + "itemHeight": 66 + } + + + + + """ + __module__ = __name__ + + def __init__(self, session): + Screen.__init__(self, session) + self.list = [] + self['list'] = List(self.list) + self.wybierz() + self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'ok': self.KeyOk, + 'back': self.changever}) + + def changever(self): + + ImageChoose = self.session.open(NeoBootImageChoose) + if fileExists('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/.location'): + out = open('%sImageBoot/.version' % getNeoLocation(), 'w') + out.write(PLUGINVERSION) + out.close() + self.close() + else: + self.close(self.session.open(MessageBox, _('No file location NeoBot, do re-install the plugin.'), MessageBox.TYPE_INFO, 10)) + self.close() + return ImageChoose + + def wybierz(self): + self.list = [] + mypath = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot' + if not fileExists(mypath + 'icons'): + mypixmap = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/ok.png' + png = LoadPixmap(mypixmap) + res = (_('Update neoboot in all images ?'), png, 0) + self.list.append(res) + self['list'].list = self.list + + def KeyOk(self): + + self.sel = self['list'].getCurrent() + if self.sel: + self.sel = self.sel[2] + if self.sel == 0 and self.session.open(MyUpgrade2): + pass + self.close() + + +class MyUpgrade2(Screen): + screenwidth = getDesktop(0).size().width() + if screenwidth and screenwidth == 1920: + skin = '' + else: + skin = '' + + def __init__(self, session): + Screen.__init__(self, session) + self['lab1'] = Label(_('NeoBoot: Upgrading in progress\nPlease wait...')) + self.activityTimer = eTimer() + self.activityTimer.timeout.get().append(self.updateInfo) + self.onShow.append(self.startShow) + + def startShow(self): + self.activityTimer.start(10) + + def updateInfo(self): + self.activityTimer.stop() + f2 = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'r') + mypath2 = f2.readline().strip() + f2.close() + if fileExists('/.multinfo'): + self.myClose(_('Sorry, NeoBoot can installed or upgraded only when booted from Flash.')) + self.close() + elif mypath2 != 'Flash': + self.myClose(_('Sorry, NeoBoot can installed or upgraded only when booted from Flash.')) + self.close() + else: + for fn in listdir('%sImageBoot' % getNeoLocation() ): + dirfile = '%sImageBoot/ ' % getNeoLocation() + fn + if isdir(dirfile): + target = dirfile + '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot' + cmd = 'rm -r ' + target + ' > /dev/null 2>&1' + system(cmd) + cmd = 'cp -r /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot ' + target + system(cmd) + + out = open('%sImageBoot/.version' % getNeoLocation(), 'w') + out.write(PLUGINVERSION) + out.close() + self.myClose(_('NeoBoot successfully updated. You can restart the plugin now.\nHave fun !!!')) + + + def myClose(self, message): + ImageChoose = self.session.open(NeoBootImageChoose) + self.session.open(MessageBox, message, MessageBox.TYPE_INFO) + self.close(ImageChoose) + + +class MyHelp(Screen): + screenwidth = getDesktop(0).size().width() + if screenwidth and screenwidth == 1920: + skin = """ + + + """ + else: + skin = """ + + """ + __module__ = __name__ + + def __init__(self, session): + + Screen.__init__(self, session) + self['lab1'] = ScrollLabel('') + self['actions'] = ActionMap(['WizardActions', 'ColorActions', 'DirectionActions'], {'back': self.close, + 'ok': self.close, + 'up': self['lab1'].pageUp, + 'left': self['lab1'].pageUp, + 'down': self['lab1'].pageDown, + 'right': self['lab1'].pageDown}) + self['lab1'].hide() + self.updatetext() + + def updatetext(self): + + message = _('NeoBoot Ver. ' + PLUGINVERSION + ' Enigma2\n\nDuring the entire installation process does not restart the receiver !!!\n\n') + message += _('NeoBoot Ver. updates ' + UPDATEVERSION + ' \n\n') + message = _('For proper operation NeoBota type device is required USB stick or HDD, formatted on your system files Linux ext3 or ext4..\n\n') + message += _('1. If you do not have a media formatted with the ext3 or ext4 is open to the Device Manager , select the drive and format it.\n\n') + message += _('2. Go to the device manager and install correctly hdd and usb ...\n\n') + message += _('3. Install NeoBota on the selected device.\n\n') + message += _('4. Install the needed packages...\n\n') + message += _('5. For proper installation XenoBota receiver must be connected to the Internet.\n\n') + message += _('6. In the event of a problem with the installation cancel and inform the author of the plug of a problem.\n\n') + message += _('Have fun !!!') + self['lab1'].show() + self['lab1'].setText(message) + + +class Opis(Screen): + screenwidth = getDesktop(0).size().width() + if screenwidth and screenwidth == 1920: + skin = """ + + + + + + + + + """ + else: + skin = """ + + + + + + + + + """ + __module__ = __name__ + + def __init__(self, session): + Screen.__init__(self, session) + self['key_red'] = Label(_('Remove NeoBoot of STB')) + self['lab1'] = ScrollLabel('') + self['actions'] = ActionMap(['WizardActions', 'ColorActions', 'DirectionActions'], {'back': self.close, + 'red': self.delete, + 'ok': self.close, + 'up': self['lab1'].pageUp, + 'left': self['lab1'].pageUp, + 'down': self['lab1'].pageDown, + 'right': self['lab1'].pageDown}) + self['lab1'].hide() + self.updatetext() + + def updatetext(self): + message = _('NeoBoot Ver. ' + PLUGINVERSION + '\n\n') + message += _('NeoBoot Ver. updates ' + UPDATEVERSION + '\n\n') + message += _('1. Requirements: For proper operation of the device NeoBota are required USB stick or HDD.\n\n') + message += _('2. NeoBot is fully automated\n\n') + message += _('3. To install a new image in MultiBocie should be sent by FTP software file compressed in ZIP or NIF to the folder: \n%sImagesUpload and remote control plugin NeoBoot use the green button \n\n') + message += _('4. For proper installation and operation of additional image multiboot, use only the image intended for your receiver. !!!\n\n') + message += _('5. By installing the multiboot images of a different type than for your model STB DOING THIS AT YOUR OWN RISK !!!\n\n') + message += _('6. The installed to multiboot images, it is not indicated update to a newer version.\n\n') + message += _('The authors plug NeoBot not liable for damage a receiver, NeoBoota incorrect use or installation of unauthorized additions or images.!!!\n\n') + message += _('Have fun !!!') + message += _('\nCompletely uninstall NeoBota: \nIf you think NeoBot not you need it, you can uninstall it.\nTo uninstall now press the red button on the remote control.\n\n') + self['lab1'].show() + self['lab1'].setText(message) + + def delete(self): + message = _('Are you sure you want to completely remove NeoBoota of your image?\n\nIf you choose so all directories NeoBoota will be removed.\nA restore the original image settings Flash.') + ybox = self.session.openWithCallback(self.mbdelete, MessageBox, message, MessageBox.TYPE_YESNO) + ybox.setTitle(_('Removed successfully.')) + + def mbdelete(self, answer): + if answer is True: + cmd = "echo -e '\n\n%s '" % _('Recovering setting....\n') + cmd1 = 'rm -R /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot; rm -R %sImageBoot/.Flash; rm -R %sImageBoot/.neonextboot; rm -R %sImageBoot/.version' + cmd2 = 'rm -R /sbin/neoinit*' + cmd3 = 'ln -sfn /sbin/init.sysvinit /sbin/init' + cmd4 = 'opkg install volatile-media; sleep 2; killall -9 enigma2' + self.session.open(Console, _('NeoBot was removed !!! \nThe changes will be visible only after complete restart of the receiver.'), [cmd, + cmd1, + cmd2, + cmd3, + cmd4,]) + self.close() + + +class NeoBootInstallation(Screen): + screenwidth = getDesktop(0).size().width() + if screenwidth and screenwidth == 1920: + skin = """ + + + + + + + + + + + + + + + + """ + else: + skin = """ + + + \n + + + \n + \n + \n + \n + \n + \n + \n + \n + """ + + def __init__(self, session): + Screen.__init__(self, session) + self.list = [] + self['config'] = MenuList(self.list) + self['key_red'] = Label(_('Instruction')) + self['key_green'] = Label(_('Installation')) + self['key_yellow'] = Label(_('Info disc')) + self['key_blue'] = Label(_('Device Manager')) + self['label1'] = Label(_('Welcome to NeoBoot %s Plugin installation.') % PLUGINVERSION) + self['label3'] = Label(_('WARNING !!! First, mount the device.')) + self['label2'] = Label(_('Here is the list of mounted devices in Your STB\nPlease choose a device where You would like to install NeoBoot')) + self['actions'] = ActionMap(['WizardActions', 'ColorActions', 'DirectionActions'], {'red': self.Instrukcja, + 'green': self.install, + 'yellow': self.datadrive, + 'blue': self.devices, + 'back': self.close}) + self.updateList() + + def Instrukcja(self): + self.session.open(MyHelp) + + def datadrive(self): + try: + message = "echo -e '\n" + message += _('NeoBot checks the connected media.\nWAIT ...\n\nDISCS:') + message += "'" + os.system(" 'mount | sed '/sd/!d' | cut -d" " -f1,2,3,4,5' ") + cmd = '/sbin/blkid ' + system(cmd) + print '[MULTI-BOOT]: ', cmd + self.session.open(Console, _(' NeoBot - Available media:'), [message, cmd]) + except: + pass + + def updateList(self): + if fileExists('/proc/mounts'): + with open('/proc/mounts', 'r') as f: + for line in f.readlines(): + if line.startswith('/dev/sd') and line.find('/media/neoboot') == -1 and (line.find('ext4') != -1 or line.find('ext3') != -1): + try: self.list.append(line.split(' ')[1] + '/') + except Exception: pass # nie powinno sie zdarzyc, ale w razie czego + if len(self.list) == 0: + self['label2'].setText(_('Sorry it seems that there are not Linux formatted devices mounted on your STB. To install NeoBoot you need a Linux formatted part1 device. Click on the blue button to open Devices Panel')) + self['config'].setList(self.list) + + def checkReadWriteDir(self, configele): + from Plugins.Extensions.NeoBoot.files import Harddisk + import os.path + import Plugins.Extensions.NeoBoot.files.Harddisk + supported_filesystems = frozenset(('ext4', 'ext3', 'ext2', 'ntfs', 'nfs', )) + candidates = [] + mounts = Harddisk.getProcMounts() + for partition in Harddisk.harddiskmanager.getMountedPartitions(False, mounts): + if partition.filesystem(mounts) in supported_filesystems: + candidates.append((partition.description, partition.mountpoint)) + + if candidates: + locations = [] + for validdevice in candidates: + locations.append(validdevice[1]) + + if Harddisk.findMountPoint(os.path.realpath(configele)) + '/' in locations or Harddisk.findMountPoint(os.path.realpath(configele)) in locations: + if fileExists(configele, 'w'): + return True + else: + check = False + if check == False: + message = _('The directory %s is not a EXT2, EXT3, EXT4 or NFS partition.\nMake sure you select a valid partition type.') + message += _('Do you want install NeoBoot ?\n') + ybox = self.session.openWithCallback(self.install, MessageBox, message, MessageBox.TYPE_YESNO) + ybox.setTitle(_('Install Manager')) + else: + dir = configele + self.session.open(MessageBox, _('The directory %s is not writable.\nMake sure you select a writable directory instead.') % dir, type=MessageBox.TYPE_ERROR) + return False + else: + check = False + if check == False: + message = _('The directory %s is not a EXT2, EXT3, EXT4 or NFS partition.\nMake sure you select a valid partition type.') + message += _('Do you want install NeoBoot ?\n') + ybox = self.session.openWithCallback(self.install, MessageBox, message, MessageBox.TYPE_YESNO) + ybox.setTitle(_('Install Manager')) + else: + dir = configele + self.session.open(MessageBox, _('The directory %s is not a EXT2, EXT3, EXT4 or NFS partition.\nMake sure you select a valid partition type.') % dir, type=MessageBox.TYPE_ERROR) + return False + else: + + check = False + if check == False: + message = _('The directory %s is not a EXT2, EXT3, EXT4 or NFS partition.\nMake sure you select a valid partition type.') + message += _('Do you want install NeoBoot ?\n') + ybox = self.session.openWithCallback(self.install, MessageBox, message, MessageBox.TYPE_YESNO) + ybox.setTitle(_('Install Manager')) + else: + dir = configele + self.session.open(MessageBox, _('The directory %s is not a EXT2, EXT3, EXT4 or NFS partition.\nMake sure you select a valid partition type.') % dir, type=MessageBox.TYPE_ERROR) + return False + + + def devices(self): + check = False + if check == False: + message = _('After selecting OK start Mounting Manager, option Mount - green\n') + message += _('Do you want to run the manager to mount the drives correctly ?\n') + ybox = self.session.openWithCallback(self.device2, MessageBox, message, MessageBox.TYPE_YESNO) + ybox.setTitle(_('Device Manager')) + + def device2(self, yesno): + if yesno: + if fileExists('/usr/lib/enigma2/python/Plugins/SystemPlugins/DeviceManager*/devicemanager.cfg'): + system('rm -f /usr/lib/enigma2/python/Plugins/SystemPlugins/DeviceManager*/devicemanager.cfg; touch /usr/lib/enigma2/python/Plugins/SystemPlugins/DeviceManager*/devicemanager.cfg') + if fileExists('/etc/devicemanager.cfg'): + system(' rm -f /etc/devicemanager.cfg; touch /etc/devicemanager.cfg ') + from Plugins.Extensions.NeoBoot.files.devices import ManagerDevice + self.session.open(ManagerDevice) + else: + self.close() + + def install(self): + #if getFSTAB2() != 'OKinstall': + #self.session.open(MessageBox, _('NeoBot - First use the Device Manager and mount the drives correctly !!!'), MessageBox.TYPE_INFO, 7) + #self.close() + #else: + self.first_installation() + + def first_installation(self): + check = False + if fileExists('/proc/mounts'): + with open('/proc/mounts', 'r') as f: + for line in f.readlines(): + if line.startswith('/dev/sd') and line.find('/media/neoboot') == -1 and (line.find('ext4') != -1 or line.find('ext3') != -1): + check = True + break + + if check == False: + self.session.open(MessageBox, _('Sorry, there is not any connected devices in your STB.\nPlease connect HDD or USB to install NeoBoot!'), MessageBox.TYPE_INFO) + else: + #if getFSTAB2() != 'OKinstall': + #self.session.open(MessageBox, _('Device Manager encountered an error, disk drives not installed correctly !!!'), MessageBox.TYPE_INFO) + #self.close() + self.mysel = self['config'].getCurrent() + if self.checkReadWriteDir(self.mysel): + message = _('Do You really want to install NeoBoot in:\n ') + self.mysel + '?' + ybox = self.session.openWithCallback(self.install2, MessageBox, message, MessageBox.TYPE_YESNO) + ybox.setTitle(_('Install Confirmation')) + else: + self.close() +################# Next Install ################# + + def install2(self, yesno): + print 'yesno:', yesno + if yesno: + self.first_installationNeoBoot() + else: + self.myclose2(_('NeoBoot has not been installed ! :(' )) + + def first_installationNeoBoot(self): + self.mysel = self['config'].getCurrent() + system('cd /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/; chmod 0755 ./bin/neoini*; chmod 0755 ./ex_init.py; chmod 0755 ./target/*.sh; chmod 0755 ./files/NeoBoot.sh; chmod 0755 ./files/S50fat.sh; cp -rf /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/neoini* /sbin cd;') + cmd1 = 'mkdir ' + self.mysel + 'ImageBoot;mkdir ' + self.mysel + 'ImagesUpload' + system(cmd1) + cmd2 = 'mkdir ' + self.mysel + 'ImageBoot;mkdir ' + self.mysel + 'ImagesUpload/.kernel' + system(cmd2) + + if os.path.isfile('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/.location'): + os.system('rm -f /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/.location' ) + + if fileExists('/proc/mounts'): + fileExists('/proc/mounts') + f = open('/proc/mounts', 'r') + for line in f.readlines(): + if line.find(self.mysel): + mntdev = line.split(' ')[0] + f.close() + mntid = os.system('blkid -s UUID -o value ' + mntdev + '>/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/install') + os.system('blkid -s UUID -o value ' + mntdev + '>/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/install') + + if getFSTAB() != 'OKinstall': + os.system('blkid -c /dev/null ' + mntdev + ' > /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/install') + if getFSTAB() != 'OKinstall': + os.system('blkid -c /dev/null /dev/sd* > /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/install') + if getFSTAB() != 'OKinstall': + os.system('blkid -c /dev/null /dev/sd* > /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/install') + f2 = open('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/install', 'r') + for line2 in f2.readlines(): + if line2.find(self.mysel): + mntdev2 = line2.split(' ')[0][0:-1] + f2.close() + os.system(' echo ' + mntdev2 + ' > /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/install') + + out = open('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/.location', 'w') + out.write(self.mysel) + out.close() + + os.system('sleep 2') + + if os.path.isfile('%sImageBoot/.neonextboot' % getNeoLocation()): + os.system('rm -f /etc/neoimage; rm -f /etc/imageboot; rm -f %sImageBoot/.neonextboot; rm -f %sImageBoot/.version; rm -f %sImageBoot/.Flash; ' % (getNeoLocation(), getNeoLocation(), getNeoLocation()) ) + if os.path.isfile('%sImagesUpload/.kernel/zImage*.ipk or %sImagesUpload/.kernel/zImage*.bin' % ( getNeoLocation(),getNeoLocation()) ): + os.system('rm -f %sImagesUpload/.kernel/zImage*.ipk; rm -f %sImagesUpload/.kernel/zImage*.bin' % ( getNeoLocation(),getNeoLocation()) ) + + if fileExists('/etc/issue.net'): + try: + lines = open('/etc/hostname', 'r').readlines() + imagename = lines[0][:-1] + image = imagename + open('%sImageBoot/.Flash' % getNeoLocation(), 'w').write(image) + except: + False + + out1 = open('%sImageBoot/.version' % getNeoLocation(), 'w') + out1.write(PLUGINVERSION) + out1.close() + + out2 = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'w') + out2.write('Flash ') + out2.close() + + out3 = open('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/.neo_info', 'w') + out3.write('Kernel\n') + out3.write('Kernel-Version: ' + about.getKernelVersionString() + '\n') + out3.write('NeoBoot\n') + out3.write('NeoBoot-Version: ' + PLUGINVERSION + '\n') + out3.close() + +# os.system('echo "mount -a" >> /etc/init.d/mdev') + + + system('opkg update; chmod 755 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/install; blkid -c /dev/null /dev/sd* > /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/installblkid; chmod 755 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/installblkid ') + + if os.system('opkg list-installed | grep python-subprocess') != 0: + os.system('opkg install python-subprocess') + if os.system('opkg list-installed | grep python-argparse') != 0: + os.system('opkg install python-argparse') + if os.system('opkg list-installed | grep curl') != 0: + os.system('opkg install curl') + if os.system('opkg list-installed | grep packagegroup-base-nfs') != 0: + os.system('opkg install packagegroup-base-nfs') + if os.system('opkg list-installed | grep ofgwrite') != 0: + os.system('opkg install ofgwrite') + if os.system('opkg list-installed | grep bzip2') != 0: + os.system('opkg install bzip2') + if os.system('opkg list-installed | grep mtd-utils') != 0: + os.system('opkg install mtd-utils') + if os.system('opkg list-installed | grep mtd-utils-ubifs') != 0: + os.system('opkg install mtd-utils-ubifs') + if os.system('opkg list-installed | grep mtd-utils-jffs2') != 0: + os.system('opkg install mtd-utils-jffs2') + if os.system('opkg list-installed | grep kernel-module-nandsim') != 0: + os.system('opkg install kernel-module-nandsim') + if os.system('opkg list-installed | grep lzo') != 0: + os.system('opkg install lzo') + if os.system('opkg list-installed | grep python-setuptools') != 0: + os.system('opkg install python-setuptools') + if os.system('opkg list-installed | grep util-linux-sfdisk') != 0: + os.system('opkg install util-linux-sfdisk') + + + # ARM - OctagonSF4008 - DM900 - Zgemma h7S - Octagon sf 8008 - AX HD60 4K #gbquad4k arm , #osmio4k arm, #Zgemma h9 arm, #Zgemma h7S arm , #Octagon SF4008 + if getBoxHostName() == 'ustym4kpro' or getTunerModel() == 'ustym4kpro' or getCPUSoC() == 'bcm7251' or getBoxHostName() == 'sf4008' or getCPUSoC() == 'bcm7251s' or getBoxHostName() == 'h7' or getCPUSoC() == 'bcm7252s' or getBoxHostName() == 'gbquad4k' or getBoxHostName == 'osmio4k' or getBoxHostName() == 'zgemmah9s' or getBoxHostName() == 'ax60' or getBoxHostName() == 'sf8008' or getCPUSoC() == 'bcm7251' or getCPUSoC() == 'BCM97252SSFF' or getBoxHostName() == 'dm900': + os.system('cp -f /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/neoinitarm /sbin/neoinitarm; chmod 0755 /sbin/neoinitarm; ln -sfn /sbin/neoinitarm /sbin/init; mv /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/target/arm_run.py /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/run.py; cd') + + + #VUPLUS ARM + elif getCPUtype() == 'ARMv7' and getBoxHostName() != 'ustym4kpro': + if getCPUSoC() == '7278' or getBoxHostName() == 'vuduo4k': + os.system('cd /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/' ) + os.system('cp -Rf /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/neoinitarm /sbin/neoinitarm; cp -Rf /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/neoinitarmvu /sbin/neoinitarmvu; mv /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/target/duo4k_run.py /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/run.py; cd') + os.system('chmod 755 /sbin/neoinitarm; chmod 755 /sbin/neoinitarmvu') + os.system('dd if=/dev/mmcblk0p6 of=%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName())) + os.system('mv /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/target/vuDuo4Kmmcblk0p6.sh /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh; cd') + + elif getCPUSoC() == '72604' or getBoxHostName() == 'vuzero4k': + os.system('cd /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/' ) + os.system('cp -Rf /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/neoinitarm /sbin/neoinitarm; cp -Rf /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/neoinitarmvu /sbin/neoinitarmvu; cd') + os.system('chmod 755 /sbin/neoinitarm; chmod 755 /sbin/neoinitarmvu') + os.system('dd if=/dev/mmcblk0p4 of=%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName())) + os.system('mv /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/target/vuUno4Kmmcblk0p6.sh /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh; mv /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/target/zero4k_run.py /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/run.py; cd') + + #Zgemma h7S arm + elif getCPUSoC() == 'bcm7251s' or getBoxHostName() == 'h7': + os.system('cd /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/' ) + os.system('cp -Rf /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/neoinitarm /sbin/neoinitarm; cd') + os.system('chmod 755 /sbin/neoinitarm; chmod 755 /sbin/neoinitarm') + os.system('python /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/target/findkerneldevice.py; dd if=/dev/kernel of=%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName()) ) + os.system('mv /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/target/h7s_kernel.sh /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh;mv /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/target/h7s_run.py /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/run.py; cd') + + elif getCPUSoC() or getBoxHostName() == ['7444s', + '7252s', + '7376', + 'vuultimo4k', + 'vuuno4k', + 'vusolo4k', + 'vuuno4kse'] : + os.system('cd /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/' ) + os.system('cp -Rf /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/neoinitarm /sbin/neoinitarm; cp -Rf /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/neoinitarmvu /sbin/neoinitarmvu; cd') + os.system('chmod 755 /sbin/neoinitarm; chmod 755 /sbin/neoinitarmvu') + os.system('dd if=/dev/mmcblk0p1 of=%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName()) ) + os.system('mv /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/target/vu_mmcblk0p1.sh /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh;mv /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/target/vu4k_run.py /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/run.py; cd') + + # MIPS + elif getCPUtype() == 'MIPS': + if getCPUSoC() or getBoxHostName() or getTunerModel() == ['7335', + '7413', + '7325', + '7356', + 'bcm7356', + '7429', + '7424', + '7241', + '7405', + '7405(with 3D)', + '7362', + 'bcm7362', + 'BCM7362', + 'bcm7358', + 'bcm7424', + 'bm750', + 'vuduo', + 'vusolo', + 'vuuno', + 'vuultimo', + 'vusolo2', + 'vuduo2', + 'vusolose', + 'vuzero', + 'mbmini', + 'mbultra', + 'osmini', + 'h3', + 'ini-1000sv', + 'ini-8000sv']: + #vuplus stb mtd1 + if getBoxHostName() == 'bm750' or getBoxHostName() == 'vuduo' or getBoxHostName() == 'vusolo' or getBoxHostName() == 'vuuno' or getBoxHostName() == 'vuultimo': + if fileExists ('/usr/sbin/nanddump'): + os.system('cd ' + getNeoLocation() + 'ImagesUpload/.kernel/; /usr/sbin/nanddump /dev/mtd1 > vmlinux.gz; mv ./vmlinux.gz ./' + getBoxHostName() + '.vmlinux.gz' ) + elif not fileExists ('/usr/sbin/nanddump'): + os.system('cd ' + getNeoLocation() + 'ImagesUpload/.kernel/; /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/nanddump_mips /dev/mtd1 > vmlinux.gz; mv ./vmlinux.gz ./' + getBoxHostName() + '.vmlinux.gz' ) + os.system('cd /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/; rm ./bin/neobm; rm ./bin/fontforneoboot.ttf; rm ./bin/libpngneo; mv /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/target/vu_dev_mtd1.sh /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh;mv /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/target/vu_mtd1_run.py /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/run.py; cd') + + + #vuplus stb mtd2 + elif getBoxHostName() == 'vusolo2' or getBoxHostName() == 'vuduo2' or getBoxHostName() == 'vusolose' or getBoxHostName() == 'vuzero': + if fileExists ('/usr/sbin/nanddump'): + os.system('cd ' + getNeoLocation() + 'ImagesUpload/.kernel/; /usr/sbin/nanddump /dev/mtd2 > vmlinux.gz; mv ./vmlinux.gz ./' + getBoxHostName() + '.vmlinux.gz' ) + elif not fileExists ('/usr/sbin/nanddump'): + os.system('cd ' + getNeoLocation() + 'ImagesUpload/.kernel/; /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/nanddump_mips /dev/mtd2 > vmlinux.gz; mv ./vmlinux.gz ./' + getBoxHostName() + '.vmlinux.gz' ) + os.system('cd /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/; rm ./bin/neobm; rm ./bin/fontforneoboot.ttf; rm ./bin/libpngneo; mv /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/target/vu_dev_mtd2.sh /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh;mv /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/target/vu_mtd2_run.py /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/run.py; cd') + + # mbultra + elif getCPUSoC() == 'bcm7424' or getBoxHostName == 'mbultra' or getTunerModel() == 'ini-8000sv': + os.system('cd; cd /media/neoboot/ImagesUpload/.kernel; /usr/sbin/nanddump /dev/mtd2 -o > vmlinux.gz; mv /home/root/vmlinux.gz /media/neoboot/ImagesUpload/.kernel/') + os.system('cd /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/; rm ./bin/neobm; rm ./bin/fontforneoboot.ttf; rm ./bin/libpngneo; mv /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/target/vu_dev_mtd2.sh /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh; mv /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/target/vu_mtd2_run.py /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/run.py; cd') + + #inne stb + elif getCPUSoC() == 'bcm7358' or getCPUSoC() == 'bcm7362' or getCPUSoC() == 'BCM7362' or getCPUSoC() == 'bcm7356' or getCPUSoC() == 'bcm7241' or getCPUSoC() == 'bcm7362' or getBoxHostName() == 'mbmini' or getBoxHostName() == 'osmini' or getTunerModel() == 'ini-1000sv' or getTunerModel() == 'h3': + os.system('cd /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/; mv ./bin/fontforneoboot.ttf /usr/share/fonts; mv ./bin/libpngneo /usr/lib; cp -f ./bin/neoinitmips /sbin/neoinitmips; cp -f ./bin/neoinitmipsvu /sbin/neoinitmipsvu; chmod 0755 /sbin/neoinit*; chmod 0755 ./bin/neobm; chmod 0755 /usr/lib/libpngneo; cd; chmod 0755 /sbin/neoinitmips; ln -sf /media/neoboot/ImageBoot/.neonextboot /etc/neoimage; mv /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/target/mips_run.py /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/run.py; cd') + + + os.system('cp -Rf /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/neoinitmips /sbin/neoinitmips; cp -Rf /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/neoinitmipsvu /sbin/neoinitmipsvu') + os.system('chmod 755 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/nfidump; chmod 0755 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/nanddump_mips; rm -r /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/neoinitar*; cd') + os.system('chmod 755 /sbin/neoinitmips; chmod 0755 /sbin/neoinitmipsvu; cd /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/;mv ./bin/fontforneoboot.ttf /usr/share/fonts;mv ./bin/libpngneo /usr/lib; cp -f ./bin/neoinitmips /sbin/neoinitmips; chmod 0755 ./bin/neobm;chmod 0755 /usr/lib/libpngneo; cd; chmod 0755 /sbin/neoinitmips ') + + if fileExists('/home/root/vmlinux.gz'): + os.system('mv -f /home/root/vmlinux.gz %sImagesUpload/.kernel/%s.vmlinux.gz' % (getNeoLocation(), getBoxHostName()) ) + + if getCPUtype() == 'ARMv7': + os.system('cd /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/; mv ./bin/fbcleararm ./bin/fbclear; rm -f ./bin/fbclearmips; mv ./ubi_reader_arm ./ubi_reader; rm -r ./ubi_reader_mips; rm ./bin/neoinitmips; rm ./bin/neoinitmipsvu; rm -r ./bin/nanddump_mips; rm ./bin/nfidump; rm ./bin/neobm; rm ./bin/fontforneoboot.ttf; rm ./bin/libpngneo; cd') + elif getCPUtype() == 'MIPS': + os.system('cd /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/; mv ./bin/fbclearmips ./bin/fbclear; rm -f ./bin/fbcleararm; mv ./ubi_reader_mips ./ubi_reader; rm -r ./ubi_reader_arm; rm -f /bin/neoinitarm; rm -f /bin/neoinitarmvu; rm -r ./bin/nanddump_arm') + + os.system(' ln -sfn ' + getNeoLocation() + 'ImageBoot/.neonextboot /etc/neoimage; chmod 644 ' + getNeoLocation() + 'ImagesUpload/.kernel/*; ln -sfn ' + getNeoLocation() + 'ImageBoot /etc/imageboot; rm -r /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/target; chmod 0755 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh ') + + os.system('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/neo_location; sleep 2; chmod 0755 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/neom') + + if os.path.isfile('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/.location'): + if getLabelDisck() != 'LABEL=': + cmd = "echo -e '\n\n%s '" % _('NeoBoot has been installed succesfully !') + cmd1 = "echo -e '\n\n%s '" % _('NeoBoot wykrył że dyski nie mają nadanej nazwy Label.\n') + elif getLabelDisck() == 'LABEL=': + cmd = "echo -e '\n\n%s '" % _('NeoBoot has been installed succesfully !') + cmd1 = "echo -e '\n\n%s '" % _('NeoBoot wykrył że dyski mają nadane nazwy Label.\n') + else: + self.myclose2(_('NeoBoot has not been installed ! :(' )) + + + self.session.open(Console, _('NeoBoot Install....'), [cmd, cmd1]) + self.close() + + if fileExists('/media/usb/ImageBoot/') and fileExists('/media/hdd/ImageBoot/'): + self.messagebox = self.session.open(MessageBox, _('[NeoBoot] \nError, you have neoboot installed on usb and hdd, \nUninstall one directories from one drive !!!\n'), MessageBox.TYPE_INFO, 8) + self.close() + else: + self.close() + + + def myclose2(self, message): + self.session.open(MessageBox, message, MessageBox.TYPE_INFO) + self.close() + +class NeoBootImageChoose(Screen): + screenwidth = getDesktop(0).size().width() + if screenwidth and screenwidth == 1920: + + skin = """ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + """ + else: + skin = """ + \n\t\t\t\t\t\t\t + \n\t\t\t\t\t\t\t + \n\t\t\t\t\t\t\t + \n\t\t\t\t\t\t\t + \n\t\t\t\t\t\t\t + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Format:%A %e %B %Y + +\t\t\t""" + + + def __init__(self, session): + + Screen.__init__(self, session) + + if not fileExists('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/mountpoint.sh'): + os.system('touch /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/mountpoint.sh; echo "#!/bin/sh\n#DESCRIPTION=This script by gutosie\n" >> /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/mountpoint.sh; chmod 0755 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/mountpoint.sh') + if getNeoMount() == 'hdd_install_/dev/sda1': + os.system('echo "umount /media/hdd\nmkdir -p /media/hdd\n/bin/mount /dev/sda1 /media/hdd" >> /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/mountpoint.sh') + elif getNeoMount() == 'hdd_install_/dev/sdb1': + os.system('echo "umount /media/hdd\nmkdir -p /media/hdd\n/bin/mount /dev/sdb1 /media/hdd" >> /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/mountpoint.sh') + elif getNeoMount() == 'hdd_install_/dev/sda2': + os.system('echo "umount /media/hdd\nmkdir -p /media/hdd\n/bin/mount /dev/sda2 /media/hdd" >> /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/mountpoint.sh') + elif getNeoMount() == 'hdd_install_/dev/sdb2': + os.system('echo "umount /media/hdd\nmkdir -p /media/hdd\n/bin/mount /dev/sdb2 /media/hdd" >> /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/mountpoint.sh') + + if getNeoMount2() == 'usb_install_/dev/sdb1': + os.system('echo "umount /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sdb1 /media/usb" >> /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/mountpoint.sh') + elif getNeoMount2() == 'usb_install_/dev/sda1': + os.system('echo "umount /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sda1 /media/usb" >> /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/mountpoint.sh') + elif getNeoMount2() == 'usb_install_/dev/sdb2': + os.system('echo "umount /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sdb2 /media/usb" >> /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/mountpoint.sh') + elif getNeoMount2() == 'usb_install_/dev/sdc1': + os.system('echo "umount /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sdc1 /media/usb" >> /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/mountpoint.sh') + elif getNeoMount2() == 'usb_install_/dev/sdd1': + os.system('echo "umount /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sdd1 /media/usb" >> /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/mountpoint.sh') + elif getNeoMount2() == 'usb_install_/dev/sde1': + os.system('echo "umount /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sde1 /media/usb" >> /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/mountpoint.sh') + elif getNeoMount2() == 'usb_install_/dev/sdf1': + os.system('echo "umount /media/usb\nmkdir -p /media/usb\n/bin/mount /dev/sdf1 /media/usb" >> /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/mountpoint.sh') + + if not fileExists('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/neo.sh'): + if getINSTALLNeo() == '/dev/sda1': + out = open('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/neo.sh', 'w') + out.write('#!/bin/sh\n#DESCRIPTION=This script by gutosie\n\n/bin/mount /dev/sda1 ' + getNeoLocation() + ' \n') + out.close() + elif getINSTALLNeo() == '/dev/sdb1': + out = open('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/neo.sh', 'w') + out.write('#!/bin/sh\n#DESCRIPTION=This script by gutosie\n\n/bin/mount /dev/sdb1 ' + getNeoLocation() + ' \n') + out.close() + elif getINSTALLNeo() == '/dev/sda2': + out = open('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/neo.sh', 'w') + out.write('#!/bin/sh\n#DESCRIPTION=This script by gutosie\n\n/bin/mount /dev/sda2 ' + getNeoLocation() + ' \n') + out.close() + elif getINSTALLNeo() == '/dev/sdb2': + out = open('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/neo.sh', 'w') + out.write('#!/bin/sh\n#DESCRIPTION=This script by gutosie\n\n/bin/mount /dev/sdb2 ' + getNeoLocation() + ' \n') + out.close() + elif getINSTALLNeo() == '/dev/sdc1': + out = open('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/neo.sh', 'w') + out.write('#!/bin/sh\n#DESCRIPTION=This script by gutosie\n\n/bin/mount /dev/sdc1 ' + getNeoLocation() + ' \n') + out.close() + elif getINSTALLNeo() == '/dev/sdd1': + out = open('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/neo.sh', 'w') + out.write('#!/bin/sh\n#DESCRIPTION=This script by gutosie\n\n/bin/mount /dev/sdd1 ' + getNeoLocation() + ' \n') + out.close() + elif getINSTALLNeo() == '/dev/sde1': + out = open('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/neo.sh', 'w') + out.write('#!/bin/sh\n#DESCRIPTION=This script by gutosie\n\n/bin/mount /dev/sde1 ' + getNeoLocation() + ' \n') + out.close() + elif getINSTALLNeo() == '/dev/sdf1': + out = open('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/neo.sh', 'w') + out.write('#!/bin/sh\n#DESCRIPTION=This script by gutosie\n\n/bin/mount /dev/sdf1 ' + getNeoLocation() + ' \n') + out.close() + system('chmod 755 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/neo.sh') + + if not fileExists('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/neom'): + os.system('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/neo_location; chmod 0755 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/neom') + + + if fileExists('/tmp/.init_reboot'): + system('rm /tmp/.init_reboot') + + if fileExists('/.multinfo'): + if not fileExists('/.control_ok'): + if fileExists('/.control_boot_new_image'): + os.system('rm -f /.control_boot_new_image; echo "Image uruchomione OK\nNie kasuj tego pliku. \n\nImage started OK\nDo not delete this file." > /.control_ok ') + if not fileExists('/.control_boot_new_image'): + os.system('echo "Image uruchomione OK\nNie kasuj tego pliku. \n\nImage started OK\nDo not delete this file." > /.control_ok') + #os.system('touch /.control_ok ') + + if fileExists('/.multinfo') and getCPUtype() == 'ARMv7': + if os.path.exists('/proc/stb/info/boxtype'): + if getCPUSoC() == 'bcm7251' or getBoxHostName == 'sf4008': + os.system('mkdir -p /media/mmc; mount /dev/mmcblk0p4 /media/mmc') + + if fileExists('/.multinfo') and getCPUtype() == 'ARMv7': + if os.path.exists('/proc/stb/info/boxtype'): + if getCPUSoC() == 'bcm7251s' or getBoxHostName() == 'h7': + os.system('mkdir -p /media/mmc; mount /dev/mmcblk0p3 /media/mmc') + + if os.path.exists('/proc/stb/info/boxtype'): + if getBoxHostName() == 'zgemmah9s': + os.system('mkdir -p /media/mmc; mount /dev/mmcblk0p7 /media/mmc') + + if getBoxHostName == 'sf8008': + os.system('mkdir -p /media/mmc; mount /dev/mmcblk0p13 /media/mmc') + + if getBoxHostName == 'ax60': + os.system('mkdir -p /media/mmc; mount /dev/mmcblk0p21 /media/mmc') + + if getBoxHostName() == 'ustym4kpro' or getTunerModel() == 'ustym4kpro': + os.system('mkdir -p /media/mmc; mount /dev/mmcblk0p13 /media/mmc') + + if os.path.exists('/proc/stb/info/model'): + if getTunerModel() == 'dm900' or getCPUSoC() == 'BCM97252SSFF': + os.system('mkdir -p /media/mmc; mount /dev/mmcblk0p2 /media/mmc') + + if getBoxVuModel() == 'uno4kse' or getBoxVuModel() == 'uno4k' or getBoxVuModel() == 'ultimo4k' or getBoxVuModel() == 'solo4k': + os.system('mkdir -p /media/mmc; mount /dev/mmcblk0p4 /media/mmc') + + if getBoxVuModel() == 'zero4k': + os.system('mkdir -p /media/mmc; mount /dev/mmcblk0p7 /media/mmc') + + if getBoxVuModel() == 'duo4k': + os.system('mkdir -p /media/mmc; mount /dev/mmcblk0p9 /media/mmc') + + if getCPUSoC() == 'bcm7252s' or getBoxHostName() == 'gbquad4k': + os.system('mkdir -p /media/mmc; mount /dev/mmcblk0p5 /media/mmc') + + #if getBoxHostName == 'osmio4k': + #os.system('mkdir -p /media/mmc; mount /dev/mmcblk0p5 /media/mmc') + + + self.list = [] + self.setTitle(' NeoBoot %s - Menu' % PLUGINVERSION + ' ' + 'Ver. update: %s' % UPDATEVERSION) + self['device_icon'] = Pixmap() + self['progreso'] = ProgressBar() + self['linea'] = ProgressBar() + self['config'] = MenuList(self.list) + self['key_red'] = Label(_('Boot Image')) + self['key_green'] = Label(_('Installation')) + self['key_yellow'] = Label(_('Remove Image ')) + self['key_blue'] = Label(_('Info')) + self['key_menu'] = Label(_('More options')) + self['key_1'] = Label(_('Update NeoBot')) + self['key_2'] = Label(_('Reinstall NeoBoot')) + self['key_3'] = Label(_('Install Kernel')) + self['label1'] = Label(_('Please choose an image to boot')) + self['label2'] = Label(_('NeoBoot is running from:')) + self['label3'] = Label('') + self['label4'] = Label(_('NeoBoot is running image:')) + self['label5'] = Label('') + self['label6'] = Label('') + self['label7'] = Label('') + self['label8'] = Label(_('Number of images installed:')) + self['label19'] = Label('') + self['label9'] = Label('') + self['label10'] = Label('') + self['label11'] = Label('') + self['label12'] = Label('') + self['label13'] = Label(_('Version update: ')) + self['label14'] = Label(_('NeoBoot version: ')) + self['label15'] = Label(_('Memory disc:')) + self['actions'] = ActionMap(['WizardActions', + 'ColorActions', + 'MenuActions', + 'NumberActionMap', + 'SetupActions', + 'number'], {'ok': self.boot, + 'red': self.boot, + 'green': self.ImageInstall, + 'yellow': self.remove, + 'blue': self.pomoc, + 'ok': self.boot, + 'menu': self.mytools, + '1': self.neoboot_update, + '2': self.ReinstallNeoBoot, + '3': self.ReinstallKernel, + 'back': self.close_exit}) + if not fileExists('/etc/name'): + os.system('touch /etc/name') + self.onShow.append(self.updateList) + + def chackkernel(self): + + message = _('NeoBoot wykryl niezgodnos kernela w flash, \nZainstalowac kernel dla flash image ? ?') + ybox = self.session.openWithCallback(self.updatekernel, MessageBox, message, MessageBox.TYPE_YESNO) + ybox.setTitle(_('Updating ... ')) + def pomoc(self): + + if fileExists('/.multinfo'): + mess = _('Information available only when running Flash.') + self.session.open(MessageBox, mess, MessageBox.TYPE_INFO) + else: + self.session.open(Opis) + + def ReinstallNeoBoot(self): + + INSTALLbox = self.session.openWithCallback(self.reinstallboot, MessageBox, _('Wybierz Tak, by przeinstalować neoboota.\n NEOBOOT.'), MessageBox.TYPE_YESNO) + INSTALLbox.setTitle(_('Zainstalować ponownie neoboota ?')) + + def reinstallboot(self, answer): + + if answer is True: + try: + cmd = "echo -e '\n\n%s '" % _('NEOBOOT - Please reinstall NeoBoot....\nPlease wait, done...\nrestart systemu...') + cmd1 = 'cd /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/; rm ./.location; rm ./files/mountpoint.sh; rm ./files/neom; rm ./files/neo.sh; sleep 5; killall -9 enigma2 ' + except: + False + self.session.open(Console, _('NeoBoot ARM....'), [cmd, cmd1]) + self.close() + else: + try: + self.session.open(MessageBox, _('Rezygnacja.'), MessageBox.TYPE_INFO, 4) + self.close() + except: + False + + def close_exit(self): + + system('touch /tmp/.init_reboot') + if not fileExists('/.multinfo'): + out = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'w' ) + out.write('Flash') + out.close() + self.close() + + if fileExists('/.multinfo'): + with open('%sImageBoot/.neonextboot' % getNeoLocation(), 'r' ) as f: + imagefile = f.readline().strip() + f.close() + out = open('%sImageBoot/.neonextboot'% getNeoLocation(), 'w' ) + out.write(imagefile) + out.close() + + else: + system('touch /tmp/.init_reboot') + out = open('%sImageBoot/.neonextboot' % getNeoLocation() , 'w') + out.write('Flash') + out.close() + self.close() + + def ReinstallKernel(self): + + from Plugins.Extensions.NeoBoot.files.tools import ReinstallKernel + self.session.open(ReinstallKernel) + + def neoboot_update(self): + self.messagebox = self.session.open(MessageBox, _('Updated unnecessary, you have the latest version. Please try again later.'), MessageBox.TYPE_INFO, 8) + self.close() + + +##/////NA CZAS TESTU UPDATE ZATRZYMANE\\\\\#################################### + def STOPneoboot_update(self): + + if fileExists('/.multinfo'): + mess = _('Downloading available only from the image Flash.') + self.session.open(MessageBox, mess, MessageBox.TYPE_INFO) + else: + out = open('%sImageBoot/.neonextboot', 'w' % getNeoLocation()) + out.write('Flash') + out.close() + message = _('\n\n\n') + message += _('WARNING !: The update brings with it the risk of errors.\n') + message += _('Before upgrading it is recommended that you make a backup NeoBoot.\n') + message += _('Do you want to run the update now ?\n') + message += _('\n') + ybox = self.session.openWithCallback(self.chackupdate2, MessageBox, message, MessageBox.TYPE_YESNO) + ybox.setTitle(_('The download neoboot update.')) + + def chackupdate2(self, yesno): + + if yesno: + self.chackupdate3() + else: + self.session.open(MessageBox, _('Canceled update.'), MessageBox.TYPE_INFO, 7) + + def chackupdate3(self): + + os.system('cd /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot;curl -O --ftp-ssl https://raw.githubusercontent.com/gutosie/neoboot2/master/ver.txt;sleep 3;cd /') + if not fileExists('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/ver.txt'): + os.system('cd /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot;fullwget --no-check-certificate https://raw.githubusercontent.com/gutosie/neoboot2/master/ver.txt; sleep 3;cd /') + if not fileExists('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/ver.txt'): + self.session.open(MessageBox, _('Unfortunately, at the moment not found an update, try again later.'), MessageBox.TYPE_INFO, 8) + else: + mypath = '' + version = open('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/ver.txt', 'r') + mypath = float(version.read().strip()) + version.close() + if float(UPDATEVERSION) != mypath: + message = _('NeoBoot has detected update.\nDo you want to update NeoBoota now ?') + ybox = self.session.openWithCallback(self.aktualizacjamboot, MessageBox, message, MessageBox.TYPE_YESNO) + ybox.setTitle(_('Updating ... ')) + elif fileExists('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/ver.txt'): + os.system('rm /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/ver.txt') + self.session.open(MessageBox, _('Updated unnecessary, you have the latest version. Please try again later.'), MessageBox.TYPE_INFO) + + def aktualizacjamboot(self, yesno): + + if yesno: + if fileExists('/tmp/*.zip'): + os.system('rm /tmp/*.zip') + os.system('cd /tmp; curl -O --ftp-ssl https://codeload.github.com/gutosie/neoboot2/zip/master; mv /tmp/master /tmp/neoboot.zip; cd /') + if not fileExists('/tmp/neoboot.zip'): + os.system('cd /tmp;fullwget --no-check-certificate https://codeload.github.com/gutosie/neoboot2/zip/master; mv /tmp/master /tmp/neoboot.zip; sleep 3;cd ') + if not fileExists('/tmp/neoboot.zip'): + self.session.open(MessageBox, _('Unfortunately, at the moment not found an update, try again later.'), MessageBox.TYPE_INFO, 8) + else: + os.system('cd /tmp/; unzip -qn ./neoboot.zip; rm -f ./neoboot.zip; cp -rf ./neoboot2-master/NeoBoot /usr/lib/enigma2/python/Plugins/Extensions; rm -rf /tmp/neoboot2-master; rm /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/ver.txt; cd /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/; chmod 0755 ./bin/neoini*; chmod 0755 ./ex_init.py; chmod 0755 ./target/*; chmod 0755 ./files/NeoBoot.sh; chmod 0755 ./files/S50fat.sh; cd') + if getCPUtype() == 'MIPS': + os.system('cd /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/; cp -rf ./bin/neoinitmipsvu /sbin; chmod 755 /sbin/neoinitmipsvu; cp -rf ./bin/neoinitmips /sbin; chmod 755 /sbin/neoinitmips; cd') + #elif getCPUtype() == 'ARMv7': + #os.system('') + + restartbox = self.session.openWithCallback(self.restartGUI, MessageBox, _('Completed update NeoBoot. You need to restart the E2 !!!\nRestart now ?'), MessageBox.TYPE_YESNO) + restartbox.setTitle(_('Restart GUI now ?')) + + else: + os.system('rm -f /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/ver.txt') + self.session.open(MessageBox, _('The update has been canceled.'), MessageBox.TYPE_INFO, 8) + + def restartGUI(self, answer): + + if answer is True: + self.session.open(TryQuitMainloop, 3) + else: + self.close() + + def installMedia(self): + + + images = False + myimages = os.listdir('%sImagesUpload' % getNeoLocation() ) + print myimages + for fil in myimages: + if fil.endswith('.zip'): + images = True + break + if fil.endswith('.tar.xz'): + images = True + break + if fil.endswith('.nfi'): + images = True + break + else: + images = False + + if images == True: + self.ImageInstall() + else: + mess = _('[NeoBoot] The %sImagesUpload directory is EMPTY !!!\nPlease upload the image files in .ZIP or .NFI formats to install. ' % getNeoLocation() ) + self.session.open(MessageBox, mess, MessageBox.TYPE_INFO) + + def MBBackup(self): + + from Plugins.Extensions.NeoBoot.files.tools import MBBackup + self.session.open(MBBackup) + + def MBRestore(self): + + from Plugins.Extensions.NeoBoot.files.tools import MBRestore + self.session.open(MBRestore) + + def updateList(self): + if not fileExists('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/.location'): + self.session.open(NeoBootInstallation) + else: + self.updateListOK() + + def updateListOK(self): + + self.list = [] + pluginpath = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot' + f = open(pluginpath + '/.location', 'r') + mypath = f.readline().strip() + f.close() + icon = 'dev_usb.png' + if 'card' in mypath or 'sd' in mypath: + icon = 'dev_sd.png' + elif 'ntfs' in mypath: + icon = 'dev_sd.png' + elif 'hdd' in mypath: + icon = 'dev_hdd.png' + elif 'cf' in mypath: + icon = 'dev_cf.png' + icon = pluginpath + '/images/' + icon + png = LoadPixmap(icon) + self['device_icon'].instance.setPixmap(png) + linesdevice = open('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/.location', 'r').readlines() + deviceneo = linesdevice[0][0:-1] + device = deviceneo + ustot = usfree = usperc = '' + rc = system('df > /tmp/memoryinfo.tmp') + if fileExists('/tmp/memoryinfo.tmp'): + f = open('/tmp/memoryinfo.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: + ustot = parts[1] + usfree = parts[3] + usperc = parts[4] + else: + ustot = 'N/A ' + usfree = parts[2] + usperc = parts[3] + break + + f.close() + os.remove('/tmp/memoryinfo.tmp') + + perc = int(usperc[0:-1]) + self['progreso'].setValue(perc) + green = '#00389416' + red = '#00ff2525' + yellow = '#00ffe875' + orange = '#00ff7f50' + if perc < 30: + color = green + elif perc < 60: + color = yellow + elif perc < 80: + color = orange + else: + color = red + try: + from skin import parseColor + self['label13'].instance.setForegroundColor(parseColor(color)) + self['label14'].instance.setForegroundColor(parseColor(color)) + self['label15'].instance.setForegroundColor(parseColor(color)) + self['progreso'].instance.setForegroundColor(parseColor(color)) + except: + pass + + self.availablespace = usfree[0:-3] + strview = _('Used: ') + usperc + _(' \n Available: ') + usfree[0:-3] + ' MB' + self['label3'].setText(strview) + try: + f2 = open('%sImageBoot/.neonextboot', 'r' % getNeoLocation()) + mypath2 = f2.readline().strip() + f2.close() + except: + mypath2 = 'Flash' + + if mypath2 == 'Flash': + image = getImageNeoBoot() + if not fileExists('/.multinfo'): + if fileExists('/etc/issue.net'): + try: + obraz = open('/etc/issue.net', 'r').readlines() + imagetype = obraz[0][:-3] + image = imagetype + open('%sImageBoot/.Flash', 'w' % getNeoLocation()).write(image) + except: + False + if fileExists('/.multinfo'): + if fileExists('/media/mmc/etc/issue.net'): + try: + obraz = open('/media/mmc/etc/issue.net', 'r').readlines() + imagetype = obraz[0][:-3] + image = imagetype + open('%sImageBoot/.Flash', 'w' % getNeoLocation()).write(image) + except: + False + elif fileExists('/etc/issue.net'): + try: + obraz = open('/etc/issue.net', 'r').readlines() + imagetype = obraz[0][:-1] + lines = open('/etc/hostname', 'r').readlines() + boxtype = lines[0][:-1] + image = imagetype[0:-2] + ' ' + boxtype + open('%sImageBoot/.Flash', 'w' % getNeoLocation()).write(image) + except: + False + + elif fileExists('%sImageBoot/.Flash' % getNeoLocation()): + f = open('%sImageBoot/.Flash', 'r' % getNeoLocation()) + image = f.readline().strip() + f.close() + image = ' [' + image + ']' + self.list.append('Flash' + image) + self['label5'].setText(mypath) + if fileExists('/.multinfo'): + f2 = open('/.multinfo', 'r') + mypath3 = f2.readline().strip() + f2.close() + self['label6'].setText(mypath3) + else: + f2 = open('%sImageBoot/.neonextboot' % getNeoLocation() , 'r' ) + mypath3 = f2.readline().strip() + f2.close() + self['label6'].setText(mypath3) + mypath = ('%sImageBoot' % getNeoLocation()) + myimages = listdir(mypath) + for fil in myimages: + if os.path.isdir(os.path.join(mypath, fil)): + self.list.append(fil) + + self['label7'].setText(str(len(self.list) - 1)) + self['config'].setList(self.list) + KERNELVERSION = getKernelImageVersion() + strview = PLUGINVERSION + ' ' + 'Kernel %s' % KERNELVERSION + self['label9'].setText(strview) + self['label19'].setText(readline('%sImagesUpload/.kernel/used_flash_kernel' % getNeoLocation() )) + strview = UPDATEVERSION + self['label10'].setText(strview) + + def mytools(self): + from Plugins.Extensions.NeoBoot.files.tools import MBTools + self.session.open(MBTools) + + def remove(self): + + self.mysel = self['config'].getCurrent() + if 'Flash' in self.mysel: + self.mysel = 'Flash' + if self.mysel: + f = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'r') + mypath = f.readline().strip() + f.close() + try: + if fileExists('/.multinfo'): + self.session.open(MessageBox, _('Sorry you can delete only from the image Flash.'), MessageBox.TYPE_INFO, 5) + elif self.mysel == 'Flash': + self.session.open(MessageBox, _('Sorry you cannot delete Flash image'), MessageBox.TYPE_INFO, 5) + elif mypath == self.mysel: + self.session.open(MessageBox, _('Sorry you cannot delete the image currently booted from.'), MessageBox.TYPE_INFO, 5) + else: + out = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'w' ) + out.write('Flash') + out.close() + message = _('Delete the selected image - ') + self.mysel + _('\nDelete ?') + ybox = self.session.openWithCallback(self.remove2, MessageBox, message, MessageBox.TYPE_YESNO) + ybox.setTitle(_('Delete Confirmation')) + except: + print 'no image to remove' + + else: + self.mysel + + def up(self): + self.list = [] + self['config'].setList(self.list) + self.updateList() + + def up2(self): + try: + self.list = [] + self['config'].setList(self.list) + self.updateList() + except: + print ' ' + + def remove2(self, yesno): + if yesno: + cmd = _("echo -e 'Deleting in progress...\n'") + cmd1 = 'rm -r %sImageBoot/' % getNeoLocation() + self.mysel + self.session.openWithCallback(self.up, Console, _('NeoBoot: Deleting Image'), [cmd, cmd1]) + else: + self.session.open(MessageBox, _('Removing canceled!'), MessageBox.TYPE_INFO) + + def ImageInstall(self): + if not fileExists('/.multinfo'): + if getCPUSoC() or getBoxHostName() or getTunerModel() == ['zgemmah9s', + 'osmio4k', + 'bcm7252s', + 'gbquad4k', + 'ax60', + 'sf8008', + 'bcm7251', + 'sf4008', + 'bcm7251s', + '7241', + 'h7', + 'dm900', + 'BCM97252SSFF', + '7444s', + '7252s', + '7376', + '72604', + '7278', + '7335', + '7413', + '7325', + '7356', + 'bcm7356', + '7429', + '7424', + '7362', + 'bcm7362', + 'BCM7362', + 'bcm7358', + '7405', + '7405(with 3D)', + 'bcm7424', + 'vuultimo', + 'mbmini', + 'osmini', + 'mbultra', + 'ustym4kpro' + 'h3']: + self.extractImage() + else: + self.messagebox = self.session.open(MessageBox, _('Nie wykryto odpowiedniego STB do instalacji !!!!'), MessageBox.TYPE_INFO, 8) + self.close() + else: + self.messagebox = self.session.open(MessageBox, _('Instalacja tylko z poziomu systemu flash.'), MessageBox.TYPE_INFO, 8) + self.close() + + def extractImage(self): + images = False + if fileExists('%sImageBoot/.without_copying' % getNeoLocation() ): + system('rm %sImageBoot/.without_copying' % getNeoLocation() ) + + if not os.path.exists('%sImagesUpload' % getNeoLocation()): + system('mkdir %sImagesUpload' % getNeoLocation()) + myimages = listdir('%sImagesUpload' % getNeoLocation()) + print myimages + for fil in myimages: + if fil.endswith('.zip'): + images = True + break + if fil.endswith('.tar.xz'): + images = True + break + if fil.endswith('.nfi'): + images = True + break + else: + images = False + + if images == True: + from Plugins.Extensions.NeoBoot.unpack import InstallImage + self.session.open(InstallImage) + else: + self.ImageSystem() + + def ImageSystem(self): + if fileExists('%sImageBoot/.neonextboot' % getNeoLocation()): + self.messagebox = self.session.open(MessageBox, _('[NeoBoot] The %sImagesUpload directory is EMPTY !!!\nPlease upload the image files in .ZIP or .NFI formats to install.\n' % getNeoLocation() ), MessageBox.TYPE_INFO, 8) + self.close() + else: + self.close() + + def boot(self): + self.mysel = self['config'].getCurrent() + if 'Flash' in self.mysel: + self.mysel = 'Flash' + if self.mysel: + out = open('' + getNeoLocation() + 'ImageBoot/.neonextboot', 'w' ) + out.write(self.mysel) + out.close() + + from Plugins.Extensions.NeoBoot.run import StartImage + self.session.open(StartImage) + + def myClose(self, message): + self.session.open(MessageBox, message, MessageBox.TYPE_INFO) + self.close() + + +def readline(filename, iferror = ''): + if iferror[:3] == 'or:': + data = iferror[3:] + else: + data = iferror + try: + if os.path.exists(filename): + with open(filename) as f: + data = f.readline().strip() + f.close() + except Exception: + PrintException() + return data + +def checkimage(): + mycheck = False + if fileExists('/proc/stb/info'): #vumodel'): ogranicza tylko dla vu+ + mycheck = True + else: + mycheck = False + return mycheck + + +def main(session, **kwargs): + + if not fileExists('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/neo.sh'): + pass + else: + if not fileExists('%sImageBoot/.version' % getNeoLocation()): + os.system('mkdir -p %s; sync; chmod 0755 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/neo.sh; /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/neo.sh -i' % getNeoLocation()) + + version = 0 + if fileExists('%sImageBoot/.version' % getNeoLocation()): + f = open('%sImageBoot/.version' % getNeoLocation()) + version = float(f.read()) + f.close() + if fileExists('%sImageBoot/.neonextboot' % getNeoLocation()): + f2 = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'r' ) + mypath2 = f2.readline().strip() + f2.close() + if mypath2 != 'Flash' or mypath2 == 'Flash' and checkimage(): + if float(PLUGINVERSION) != version: + session.open(MyUpgrade) + else: + session.open(NeoBootImageChoose) + else: + session.open(MessageBox, _('Sorry: Wrong image in flash found. You have to install in flash Vu+ or Octagon-sf4008 Image !!!'), MessageBox.TYPE_INFO, 10) + else: + session.open(NeoBootInstallation) + +def menu(menuid, **kwargs): + if menuid == 'mainmenu': + return [(_('NeoBOOT'), + main, + 'neo_boot', + 1)] + return [] + +from Plugins.Plugin import PluginDescriptor + +def Plugins(**kwargs): + return [PluginDescriptor(name='NeoBootUstym ', description='NeoBoot', where=PluginDescriptor.WHERE_MENU, fnc=menu), PluginDescriptor(name='NeoBoot', description=_('Installing multiple images'), icon='neo.png', where=PluginDescriptor.WHERE_PLUGINMENU, fnc=main)] + +####################### _(-_-)_ gutosie _(-_-)_ ####################### \ No newline at end of file diff --git a/run.py b/run.py new file mode 100644 index 0000000..f084cc9 --- /dev/null +++ b/run.py @@ -0,0 +1,165 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +#echo "Flash " >> '+ getImageNeoBoot() + 'ImagesUpload/.kernel/used_flash_kernel; + +from __init__ import _ +from Plugins.Extensions.NeoBoot.files.stbbranding import getNeoLocation, getKernelVersionString, getKernelImageVersion, getCPUtype, getCPUSoC, getImageNeoBoot, getBoxVuModel, getBoxHostName, getTunerModel +from enigma import getDesktop +from enigma import eTimer +from Screens.Screen import Screen +from Screens.Console import Console +from Screens.MessageBox import MessageBox +from Screens.ChoiceBox import ChoiceBox +from Screens.VirtualKeyBoard import VirtualKeyBoard +from Screens.Standby import TryQuitMainloop +from Components.About import about +from Components.Sources.List import List +from Components.Button import Button +from Components.ActionMap import ActionMap, NumberActionMap +from Components.GUIComponent import * +from Components.MenuList import MenuList +from Components.Input import Input +from Components.Label import Label +from Components.ProgressBar import ProgressBar +from Components.ScrollLabel import ScrollLabel +from Components.Pixmap import Pixmap, MultiPixmap +from Components.config import * +from Components.ConfigList import ConfigListScreen +from Tools.LoadPixmap import LoadPixmap +from Tools.Directories import fileExists, pathExists, createDir, resolveFilename, SCOPE_PLUGINS +from os import system, listdir, mkdir, chdir, getcwd, rename as os_rename, remove as os_remove, popen +from os.path import dirname, isdir, isdir as os_isdir +import os +import time + + +class StartImage(Screen): + screenwidth = getDesktop(0).size().width() + if screenwidth and screenwidth == 1920: + skin = """ + \n\t\t\t + \n\t\t\t\t + \n \t\t{"template": [ + \n \t\t\tMultiContentEntryText(pos = (90, 1), size = (920, 66), flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 0), + \n \t\t\tMultiContentEntryPixmapAlphaTest(pos = (8, 4), size = (66, 66), png = 1), + \n \t\t\t], + \n \t\t\t"fonts": [gFont("Regular", 40)],\n \t\t\t"itemHeight": 66\n \t\t} + \n \t\t\n\t\t + \n + \n\t\t + \n\t\t """ + else: + skin = """ + \n\t\t\t + + \n\t\t\t\t + \n \t\t{"template": [ + \n \t\t\tMultiContentEntryText(pos = (180, 0), size = (520, 36), flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 0), + \n \t\t\tMultiContentEntryPixmapAlphaTest(pos = (4, 2), size = (36, 36), png = 1), + \n \t\t\t],\n \t\t\t"fonts": [gFont("Regular", 22)], + \n \t\t\t"itemHeight": 35\n \t\t}\n \t\t + \n\t\t\n + + \n\t\t """ + + __module__ = __name__ + def __init__(self, session): + Screen.__init__(self, session) + self.list = [] + self['list'] = List(self.list) + self.select() + self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'ok': self.KeyOk, + 'back': self.close}) + self['label1'] = Label(_('Start the chosen system now ?')) + self['label2'] = Label(_('Select OK to run the image.')) + + def select(self): + self.list = [] + mypath = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot' + if not fileExists(mypath + 'icons'): + mypixmap = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/ok.png' + png = LoadPixmap(mypixmap) + res = (_('OK Start image...'), png, 0) + self.list.append(res) + self['list'].list = self.list + + def KeyOk(self): + if getImageNeoBoot() != 'Flash': + if not fileExists('%sImageBoot/%s/.control_ok' % ( getNeoLocation(), getImageNeoBoot())): + cmd = _("echo -e '[NeoBoot] Uwaga!!! po poprawnym starcie wybranego oprogramowania w neoboot,\nnalezy uruchomic NEOBOOTA by potwierdzic prawidlowy start image.\n\nNacisnij OK lub exit na pilocie by kontynuowac...\n\n\n'") + self.session.openWithCallback(self.StartImageInNeoBoot, Console, _('NeoBoot: Start image...'), [cmd]) + else: + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % ( getNeoLocation(), getImageNeoBoot())) + self.StartImageInNeoBoot() + else: + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % ( getNeoLocation(), getImageNeoBoot())) + self.StartImageInNeoBoot() + + def StartImageInNeoBoot(self): + if getImageNeoBoot() != 'Flash': + if fileExists('%sImageBoot/%s/.control_ok' % ( getNeoLocation(), getImageNeoBoot())): + system('touch /tmp/.control_ok ') + else: + system('touch %sImageBoot/%s/.control_boot_new_image ' % ( getNeoLocation(), getImageNeoBoot() )) + + system('chmod 755 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh; /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/neo_location') + self.sel = self['list'].getCurrent() + if self.sel: + self.sel = self.sel[2] + if self.sel == 0: + if fileExists('/media/mmc/etc/init.d/neobootmount.sh'): + os.system('rm -f /media/mmc/etc/init.d/neobootmount.sh;') + +#################_____ARM____########################## + + #VUPLUS ARM ultimo4k, solo4k, uno4k, uno4kse - mmcblk0p1.sh + if getCPUtype() == 'ARMv7' and getCPUSoC() or getBoxHostName() == ['7444s', + '7376', + '7252s', + 'vuultimo4k' + 'vusolo4k', + 'vuuno4k', + 'vuuno4kse'] : + if not fileExists('%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName()) ): + self.myclose2(_('\n\n\nError - w lokalizacji %sImagesUpload/.kernel/ \nnie odnaleziono pliku kernela flash-kernel-%s.bin ' % getNeoLocation(), getBoxHostName() )) + else: + if getImageNeoBoot() == 'Flash': + if fileExists('/.multinfo'): + cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') + cmd1 = 'cd /media/mmc; ln -sf "init.sysvinit" "/media/mmc/sbin/init"; /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh ' + + elif not fileExists('/.multinfo'): + cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') + cmd1 = 'sleep 5; ln -sf "init.sysvinit" "/sbin/init"; reboot -dfhi' + + elif getImageNeoBoot() != 'Flash': + if not fileExists('/.multinfo'): + if not fileExists('%sImageBoot/%s/boot/zImage.%s' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') + cmd1 = 'sleep 5; ln -sfn /sbin/neoinitarm /sbin/init; /etc/init.d/reboot' + + elif fileExists('%sImageBoot/%s/boot/zImage.%s' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') + cmd1 = 'ln -sfn /sbin/neoinitarmvu /sbin/init; /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh ' + + elif fileExists('/.multinfo'): + if not fileExists('%sImageBoot/%s/boot/zImage.%s' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') + cmd1 = 'dd if=' + getNeoLocation() + 'ImagesUpload/.kernel/flash-kernel-' + getBoxHostName() + '.bin of=/dev/mmcblk0p1; cd /media/mmc; ln -sf "neoinitarm" "/media/mmc/sbin/init" ; sleep 2; reboot -dfhi ' + + elif fileExists('%sImageBoot/%s/boot/zImage.%s' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') + cmd1 = 'cd /media/mmc; ln -sf "neoinitarmvu" "/media/mmc/sbin/init"; /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh ' + + self.session.open(Console, _('NeoBoot ARM VU+....'), [cmd, cmd1]) + self.close() + + + else: + os.system('echo "Flash " >> ' + getNeoLocation() + 'ImageBoot/.neonextboot') + self.messagebox = self.session.open(MessageBox, _('Wygląda na to że multiboot nie wspiera tego modelu STB !!! '), MessageBox.TYPE_INFO, 8) + self.close() + + def myclose2(self, message): + self.session.open(MessageBox, message, MessageBox.TYPE_INFO) + self.close() diff --git a/stbinfo b/stbinfo new file mode 100644 index 0000000..0577c70 --- /dev/null +++ b/stbinfo @@ -0,0 +1,59 @@ +#!/bin/sh +#Wspierane tunery satelitarne: +#Machine BCM - getCPUSoC(): + +cat /proc/stb/info/chipset: +cat /proc/stb/info/chipset +cat /etc/hostname +cat /proc/cpuinfo +cat /proc/version +cat /etc/issue +cat /proc/mtd +mtd_debug info /dev/mtd0 +cat /proc/cmdline +cat /proc/partitions +cat /var/lib/opkg/info/kernel-image*.postinst + + + + + +Ultimo4k : 7444s +Solo4k : 7376 +Zero 4K : 72604 +Duo4k : 7278 #BCM7278 +Uno4K : 7252s +Uno4kSE : 7252s +Ultimo : 7405(with 3D) +Uno : 7405(with 3D) +Duo : 7335 +Duo2 : 7424 +Zero : 7362 +Solo : 7325 +Solose : 7241 +Solose-v2 : 7241 +Solo2 : 7356 + +Formuler F1 : bcm7356 +Formuler F3 : 7362 + +Miraclebox MBmini : bcm7358 +Miraclebox Micro : bcm7362 +Miraclebox Ultra : bcm7424 + +Octagon Sf8008 : 3798mv200 +Octagon SF4008 : bcm7251 + +Zgemma h7S : bcm7251s +Zgemma H9S : hi3798mv200 hostname: zgemmah9s; mtd6: 01000000 00020000 "kernel" ; mtd7: 0ea00000 00020000 "rootfs" + +AX HD60 4K : hi3798mv200 # cat /etc/hostname : ax60 + +OSmini : BCM7362 + +atemio6000 : bcm7362 + +gbquad4k : bcm7252s # cat /proc/stb/info/model : gbquad4k # # cat /etc/hostname : gbquad4k # cat /proc/cmdline root=/dev/mmcblk0p5 rootwait rw rootflags=data=journal libata.force=1:3.0G,2:3.0G,3:3.0G coherent_poll=2M vmalloc=525m bmem=529m@491m bmem=608m@2464m + +ustym4kpro: cat /proc/stb/info/chipset 3798mv200 root@ustym4kpro: cat /etc/hostname ustym4kpro + \ No newline at end of file