feat(desktop): add desktop uninstall and legacy LXQt cleanup (#493)

This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-10-10 10:59:32 -04:00
1 parent 79d92111e4
commit 67a9ea2f42
28 files changed
+728 -25

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
import gzip
from pathlib import Path
import unittest
ASSETS = Path(__file__).resolve().parents[2] / 'app/src/main/assets/desktop-removal'
class DesktopRemovalInventoryTest(unittest.TestCase):
def test_legacy_inventory_removes_the_shell_and_retains_gamescope_dependencies(self):
records = gzip.decompress((ASSETS / 'lxqt-r1.tsv.gzip').read_bytes()).decode().splitlines()
paths = {record.split('\t', 3)[3] for record in records}
self.assertIn('usr/bin/lxqt-session', paths)
self.assertIn('usr/bin/labwc', paths)
self.assertIn('usr/local/bin/steamdeck-desktop', paths)
# The runtime pacman database did not protect libseat on the Thor. Removing it
# made gamescope and every Steam/native session exit 127 after desktop cleanup.
self.assertNotIn('usr/lib/libseat.so.1', paths)
self.assertNotIn('usr/lib/libseat.so', paths)
self.assertFalse(any(p.startswith('usr/lib/libSDL2') for p in paths))
self.assertFalse(any(p.startswith(('root/', 'opt/', 'var/')) for p in paths))
if __name__ == '__main__':
unittest.main()
+28 -2
View File
@@ -1,4 +1,5 @@
import importlib.util
import gzip
import io
from pathlib import Path
import subprocess
@@ -22,7 +23,7 @@ class RuntimeInputsTest(unittest.TestCase):
for name in runtime.required():
path = self.root / paths.get(name, 'app/src/main/' + name)
path.parent.mkdir(parents=True, exist_ok=True)
path.write_bytes(b'prepared runtime')
path.write_bytes(gzip.compress(b'inventory') if path.suffix == '.gzip' else b'prepared runtime')
self.source = self.root / 'tools/linuxfs/preload/test.c'
self.source.parent.mkdir(parents=True)
self.source.write_text('current source')
@@ -73,4 +74,29 @@ class RuntimeInputsTest(unittest.TestCase):
def test_complete_current_payload_passes(self):
runtime.record(self.root)
runtime.verify(self.root)
data = runtime.verify(self.root)
apk = self.root / 'current.apk'
with ZipFile(apk, 'w') as package:
for name, output in data['outputs'].items():
package.writestr(name, (self.root / output['path']).read_bytes())
runtime.check_apk(apk, self.root)
def test_android_expanding_or_renaming_a_compressed_inventory_is_rejected(self):
runtime.record(self.root)
data = runtime.verify(self.root)
apk = self.root / 'expanded.apk'
with ZipFile(apk, 'w') as package:
for name, output in data['outputs'].items():
content = (self.root / output['path']).read_bytes()
if name.endswith('.gzip'):
name = name.removesuffix('.gzip')
content = gzip.decompress(content)
package.writestr(name, content)
with self.assertRaisesRegex(ValueError, 'APK missing assets/desktop-removal/'):
runtime.check_apk(apk, self.root)
def test_malformed_removal_inventory_cannot_be_attested(self):
path = self.root / 'app/src/main/assets/desktop-removal/kde-remove.tsv.gzip'
path.write_bytes(b'not a gzip stream')
with self.assertRaisesRegex(ValueError, 'Invalid desktop removal inventory'):
runtime.record(self.root)