-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/python3 -I | ||
from argparse import ArgumentParser | ||
from asyncio import create_subprocess_exec, get_event_loop, run, wait_for | ||
from asyncio.subprocess import DEVNULL, PIPE | ||
|
||
loop = get_event_loop() | ||
|
||
|
||
async def startup(appimage_path: str, instance_name: str) -> None: | ||
mount_subprocess = await create_subprocess_exec( | ||
'/usr/bin/env', 'appimagetool', '--appimage-mount', appimage_path, | ||
stdin=DEVNULL, stdout=PIPE, | ||
) | ||
|
||
assert mount_subprocess.stdout is not None | ||
|
||
mount_point_bytes: bytes = await wait_for( | ||
mount_subprocess.stdout.readline(), | ||
timeout=1) | ||
|
||
mount_point = mount_point_bytes.decode('utf-8') | ||
|
||
bubblejail_subprocess = await create_subprocess_exec( | ||
'/usr/bin/env', 'BUBBLEJAIL_DEBUG_ROOT_SHARE', mount_point, | ||
'bubblejail', 'run', mount_point + '/AppRun', | ||
) | ||
await bubblejail_subprocess.communicate() | ||
|
||
|
||
def main() -> None: | ||
arg_parser = ArgumentParser() | ||
arg_parser.add_argument('appimage_path') | ||
arg_parser.add_argument('bubblejail_instance') | ||
namespace = arg_parser.parse_args() | ||
run(startup(namespace.appimage_path, namespace.bubblejail_instance)) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |