From 8015cebfbe47d9b8db6474d9929920b23077e84c Mon Sep 17 00:00:00 2001 From: "Gerd v. Egidy" Date: Thu, 16 Mar 2023 22:13:15 +0100 Subject: [PATCH 1/3] remove autoruns= boot commandline option (replaced with ar_suffixes option) --- airootfs/etc/systemd/scripts/sysrescue-autorun | 6 ------ 1 file changed, 6 deletions(-) diff --git a/airootfs/etc/systemd/scripts/sysrescue-autorun b/airootfs/etc/systemd/scripts/sysrescue-autorun index 96dffed..d459097 100755 --- a/airootfs/etc/systemd/scripts/sysrescue-autorun +++ b/airootfs/etc/systemd/scripts/sysrescue-autorun @@ -239,12 +239,6 @@ def build_config(): if not 'exec' in config or not isinstance(config['exec'], dict): config["exec"] = { } - # ---- parse legacy options passed on the boot command line - for curopt in open("/proc/cmdline","r").read().split(): - if re.match('^autoruns=', curopt): # "autoruns" is the legacy name for 'ar_suffixes' - writemsg('WARNING: deprecated option `autoruns=` used, it will be removed soon. Use `ar_suffixes` instead') - config['ar_suffixes'] = curopt.replace('autoruns=','') - # ---- load the config into local variables, allow the keys not to exist # ---- also print the effective configuration writemsg("Showing the effective autorun configuration ...") From 31a301d8c1e94dd3cc6045c043b0199c88ff6bd5 Mon Sep 17 00:00:00 2001 From: "Gerd v. Egidy" Date: Thu, 16 Mar 2023 22:17:48 +0100 Subject: [PATCH 2/3] remove more deprecated autorun features: scripts without shebang, scripts with windows line endings --- .../etc/systemd/scripts/sysrescue-autorun | 34 ------------------- 1 file changed, 34 deletions(-) diff --git a/airootfs/etc/systemd/scripts/sysrescue-autorun b/airootfs/etc/systemd/scripts/sysrescue-autorun index d459097..31841f2 100755 --- a/airootfs/etc/systemd/scripts/sysrescue-autorun +++ b/airootfs/etc/systemd/scripts/sysrescue-autorun @@ -28,18 +28,6 @@ def writemsg(message): print(message) logging.info(message) -# remove all '\r' in that file -def processdostextfiles(curfile): - txt=open(curfile,'rb').read() - origlen=len(txt) - txt=txt.replace(b'\r',b'') - if len(txt) != origlen: - writemsg(f'WARNING: \\r line endings removed from {curfile}.') - writemsg('Relying on automatic line ending sanitizing is deprecated and it will be removed from a future release.') - txtfile=open(curfile, 'wb') - txtfile.write(txt) - txtfile.close() - def is_elf_binary(filename): with open(filename,'rb') as f: content = f.read(4) @@ -50,19 +38,6 @@ def is_elf_binary(filename): else: return False -def ensure_shebang(filename): - # does the file have a shebang? - with open(filename,'r+') as f: - content = f.read() - if len(content) > 2 and content[0] == '#' and content[1] == '!': - # we have a shebang, nothing to do - return - # no shebang, we have to add one - writemsg(f'WARNING: no shebang in {filename}.') - writemsg('This is deprecated and a shebang will be required in future releases.') - f.seek(0, 0) - f.write("#!/bin/sh\n" + content) - def format_title(title, padding): totallen=80 startpos=int(totallen/2)-int(len(title)/2)-1 @@ -569,15 +544,6 @@ def exec_script(entryname, data): # we now have something in path, work it - try: - # only modify files in our tmp dir - if os.path.dirname(path) == autoruntmp and not is_elf_binary(path): - processdostextfiles(path) - # compatibility with old autorun: add #!/bin/sh if no shebang - ensure_shebang(path) - except: - pass - # sanitize parameters if "parameters" in data and isinstance(data['parameters'], (str, int, float, bool)): # we always want a list, even if we just have one parameter From 3412251fe4a96744b9cbec82f8fed2fb9d15aa4f Mon Sep 17 00:00:00 2001 From: "Gerd v. Egidy" Date: Thu, 16 Mar 2023 22:20:58 +0100 Subject: [PATCH 3/3] don't look for autorun scripts in the root of the iso image anymore This has been deprecated for some time and conflicts with the (preferred) "autorun" dir in there --- airootfs/etc/systemd/scripts/sysrescue-autorun | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airootfs/etc/systemd/scripts/sysrescue-autorun b/airootfs/etc/systemd/scripts/sysrescue-autorun index 31841f2..38a9c80 100755 --- a/airootfs/etc/systemd/scripts/sysrescue-autorun +++ b/airootfs/etc/systemd/scripts/sysrescue-autorun @@ -19,7 +19,7 @@ basedir='/var/autorun' autorunlog=basedir+'/log' autorunmnt=basedir+'/mnt' autoruntmp=basedir+'/tmp' -defaultsrc=['/run/archiso/bootmnt/autorun','/run/archiso/bootmnt','/root','/usr/share/sys.autorun'] +defaultsrc=['/run/archiso/bootmnt/autorun','/root','/usr/share/sys.autorun'] effectivecfg="/etc/sysrescue/sysrescue-effective-config.json" config = {}