-
-
Save dirkakrid/0b3cbb08477ec813f89dce2d8bbc35de to your computer and use it in GitHub Desktop.
systemd-nspawn launcher for Java applications
This file contains hidden or 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
#!/bin/sh | |
set -eu | |
container="$(basename "$0")" | |
program="$1" | |
shift | |
# logname returns the user calling sudo | |
host_user="$(logname)" | |
container_user="$(basename "$program")-user" | |
sudo systemd-nspawn \ | |
--machine="$container" \ | |
--setenv=DISPLAY="$DISPLAY" \ | |
--user="$container_user" \ | |
--bind="/home/$host_user/Desktop:/home/$container_user/Desktop" \ | |
--bind="/home/$host_user/Documents:/home/$container_user/Documents" \ | |
--bind="/home/$host_user/Downloads:/home/$container_user/Downloads" \ | |
--as-pid2 "$program" "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment