From cf9639b1e1650fccebc2ddb711f97a632e9bc0c5 Mon Sep 17 00:00:00 2001 From: Michal Ambroz Date: Feb 19 2023 16:59:51 +0000 Subject: allow usage of security-menus outside of the spin --- diff --git a/fsl-maintenance.py b/fsl-maintenance.py index cc55dd3..72c0190 100755 --- a/fsl-maintenance.py +++ b/fsl-maintenance.py @@ -215,10 +215,21 @@ def menus(): file_out = open('security-{}.desktop'.format(pkg['pkg']), 'w') file_out.write('[Desktop Entry]\n') file_out.write('Name={}\n'.format(pkg['name'])) - file_out.write("Exec={} -e \"su -c '{}; bash'\"\n".format( - terminal, pkg['command'])) - file_out.write('TryExec={}\n'.format(pkg['pkg'])) + file_out.write('GenericName={}\n'.format(pkg['category'])) + file_out.write('TryExec={}\n'.format(pkg['command'].split(' ')[0])) file_out.write('Type=Application\n') + file_out.write("Exec=sh -c \"echo '\\\\$ {}' ;{} ; \\\\$SHELL -i\"\n".format( + pkg['command'],pkg['command'])) + + if 'comment' in pkg: + file_out.write('Comment={}\n'.format(pkg['comment'])) + + if 'icon' in pkg: + file_out.write('Icon={}\n'.format(pkg['icon'])) + else: + file_out.write('Icon=utilities-terminal\n') + + file_out.write('Terminal=true\n') file_out.write('Categories=System;Security;X-SecurityLab;' 'X-{};\n'.format(pkg['category'])) file_out.close() @@ -228,7 +239,10 @@ def menus(): dellist = filelist for pkg in pkgslist: if 'command' in pkg: - dellist.remove('security-{}.desktop'.format(pkg['pkg'])) + try: + dellist.remove('security-{}.desktop'.format(pkg['pkg'])) + except: + pass if 'exclude' in pkg: if pkg['exclude'] == 1: dellist.append('security-{}.desktop'.format(pkg['pkg'])) @@ -236,7 +250,15 @@ def menus(): # Remove the .desktop files which are no longer needed if len(dellist) != 0: for file in dellist: - os.remove(file) + try: + os.remove(file) + except: + pass + + # Validate the .desktop files + os.system("desktop-file-validate *.desktop") + + if __name__ == '__main__': cli()