From 7eea3a990a012a2d93c0d97b1a36c0abe1fd073c Mon Sep 17 00:00:00 2001 From: gutosie Date: Sat, 20 Jan 2024 18:32:50 +0200 Subject: [PATCH] Update extract.py --- NeoBoot/extract.py | 85 ++++++---------------------------------------- 1 file changed, 10 insertions(+), 75 deletions(-) diff --git a/NeoBoot/extract.py b/NeoBoot/extract.py index 195ccb5..d8848d4 100644 --- a/NeoBoot/extract.py +++ b/NeoBoot/extract.py @@ -443,87 +443,22 @@ def NEOBootMainEx(source, target, CopyFiles, CopyKernel, TvList, LanWlan, Sterow #rc = os.system(cmd) # for all image: + #copying zerotier identity.secret if os.path.exists('/var/lib/zerotier-one/identity.secret'): cmd = 'mkdir -p ' + getNeoLocation() + 'ImageBoot/%s/var/lib/zerotier-one' % target rc = os.system(cmd) cmd1 = 'cp -af /var/lib/zerotier-one/identity.secret ' + getNeoLocation() + 'ImageBoot/%s/var/lib/zerotier-one/' % target rc = os.system(cmd1) - - if os.path.exists('%s/ImageBoot/%s/etc/rc.local' % (media, target)): - filename = '%s/ImageBoot/%s/etc/rc.local' % (media, target) - if os.path.exists(filename): - filename2 = filename + '.tmp' - out = open(filename2, 'w') - f = open(filename, 'r') - for line in f.readlines(): - if line.find('exit 0') != -1: - line = '\n' - out.write(line) - - f.close() - out.close() - os.rename(filename2, filename) - cmd = 'echo -n "\n\n/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/userscript.sh \n\nexit 0" >> %s/ImageBoot/%s/etc/rc.local' % (media, target) - rc = os.system(cmd) - cmd = 'chmod 0755 %s/ImageBoot/%s/etc/rc.local' % (media, target) - rc = os.system(cmd) - - if os.path.exists('%s/ImageBoot/%s/usr/lib/enigma2/python/Plugins/PLi' % (media, target)) and not os.path.exists('%s/ImageBoot/%s/etc/rcS.local' % (media, target)): - cmd = 'cp -af /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/userscript.sh %sImageBoot/%s/etc/init.d/rcS.local' % (media, target) - rc = os.system(cmd) - cmd1 = 'chmod 0755 %s/ImageBoot/%s/etc/init.d/rcS.local' % (media, target) - rc = os.system(cmd1) - - elif os.path.exists('%s/ImageBoot/%s/usr/lib/enigma2/python/Plugins/PLi' % (media, target)) and os.path.exists('%s/ImageBoot/%s/etc/rcS.local' % (media, target)): - cmd = 'echo -n "\n\n/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/userscript.sh \n\nexit 0" >> %s/ImageBoot/%s/etc/init.d/rcS.local' % (media, target) - rc = os.system(cmd) - cmd = 'chmod 0755 %s/ImageBoot/%s/etc/init.d/rcS.local' % (media, target) - rc = os.system(cmd) - - if os.path.exists('%s/ImageBoot/%s/etc/init.d/rc.local' % (media, target)) and not os.path.exists('%s/ImageBoot/%s/etc/rcS.local' % (media, target)): - filename = '%s/ImageBoot/%s/etc/init.d/rc.local' % (media, target) - if os.path.exists(filename): - filename2 = filename + '.tmp' - out = open(filename2, 'w') - f = open(filename, 'r') - for line in f.readlines(): - if line.find('exit 0') != -1: - line = '\n' - out.write(line) - - f.close() - out.close() - os.rename(filename2, filename) - - cmd = 'echo -n "\n\n/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/userscript.sh \n\nexit 0" >> %s/ImageBoot/%s/etc/init.d/rc.local' % (media, target) - rc = os.system(cmd) - cmd = 'chmod 0755 %s/ImageBoot/%s/etc/init.d/rc.local' % (media, target) - rc = os.system(cmd) - - if not os.path.exists('%s/ImageBoot/%s/etc/init.d/rc.local' % (media, target)) and not os.path.exists('%s/ImageBoot/%s/etc/rc.local' % (media, target)) and not os.path.exists('%s/ImageBoot/%s/etc/rcS.local' % (media, target)): - if os.path.exists('%s/ImageBoot/%s/etc/init.d' % (media, target)): -# cmd = 'ln -s %sImageBoot/%s/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/userscript.sh %sImageBoot/%s/etc/rcS.d/S99neo.local' % (media, -# target, -# media, -# target) - - if os.path.exists('%s/ImageBoot/%s/usr/lib/enigma2/python/Plugins/PLi' % (media, target)): - cmd = 'cp -af /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/userscript.sh %sImageBoot/%s/etc/init.d/rcS.local' % (media, target) - rc = os.system(cmd) - cmd1 = 'chmod 0755 %s/ImageBoot/%s/etc/init.d/rcS.local' % (media, target) - rc = os.system(cmd1) - else: - cmd = 'cp -af /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/userscript.sh %sImageBoot/%s/etc/rcS.d/S99neo.local' % (media, target) - rc = os.system(cmd) - cmd1 = 'chmod 0755 %s/ImageBoot/%s/etc/rcS.d/S99neo.local' % (media, target) - rc = os.system(cmd1) - #cmd = 'cp -af /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/userscript.sh %sImageBoot/%s/etc/init.d/rc.local' % (media, target) - #rc = os.system(cmd) - #cmd1 = 'chmod 0755 %s/ImageBoot/%s/etc/init.d/rc.local' % (media, target) - rc = os.system(cmd1) - elif not os.path.exists('%s/ImageBoot/%s/etc/init.d' % (media, target)): + #copying zerotier script + if os.path.exists('%s/ImageBoot/%s/etc/init.d' % (media, target)): + cmd = 'ln -s %sImageBoot/%s/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/userscript.sh %sImageBoot/%s/etc/rcS.d/S99neo.local' % (media, + target, + media, + target) + + elif not os.path.exists('%s/ImageBoot/%s/etc/init.d' % (media, target)): os.system('echo "/etc/init.d not found."') - os.system('echo "Copied file neo_userscript.sh"') + os.system('echo "Copied file neo_userscript.sh"') if not os.path.exists('' + getNeoLocation() + 'ImageBoot/.without_copying') and not os.path.exists(' /tmp/settings_copied'): for line in open("/etc/hostname"):