From e205f48997725f60719ab480de4b536cbc24e9bf Mon Sep 17 00:00:00 2001 From: mviereck Date: Fri, 6 Nov 2020 10:57:40 +0100 Subject: [PATCH] --xopt: experimental option to add X server options --podman -gpu --alsa: share devices with --volume #293 #255 --- CHANGELOG.md | 4 ++++ x11docker | 44 +++++++++++++++++++++++++++++--------------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2651457..b47d3dea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ Project website: https://github.com/mviereck/x11docker [(x11docker/deepin:#2)](https://github.com/mviereck/dockerfile-x11docker-deepin/issues/2) - `--podman`: Experimental `podman` support. [(#255)](https://github.com/mviereck/x11docker/issues/255) + - `--xopt`: Experimental option to add custom X server options. + [(#296)](https://github.com/mviereck/x11docker/issues/296) ### Changed - `--lang`: Allow multiple times to generate more than one locale. ### Fixed @@ -25,6 +27,8 @@ Project website: https://github.com/mviereck/x11docker [(#254)](https://github.com/mviereck/x11docker/issues/254) - `--xpra`: version check failed in few circumstances. [(#287)](https://github.com/mviereck/x11docker/issues/287) + - `--gpu`: share `/dev/nvmap` and `/dev/nvhost*` if present. + [(#290)](https://github.com/mviereck/x11docker/issues/290) ## [6.6.2](https://github.com/mviereck/x11docker/releases/tag/v6.6.2) - 2022-05-19 ### Added diff --git a/x11docker b/x11docker index 7fd31c37..6201ba00 100755 --- a/x11docker +++ b/x11docker @@ -605,8 +605,8 @@ finish() { # trap EXIT routine to clean up background proce # remove container [ "$Preservecachefiles" = "no" ] && [ "$Containername" ] && { - debugnote "Removing container $Containername" - $Dockerexe rm -f "$Containername" || note "Failed to remove container $Containername" + debugnote "Removing container $Containername + $($Dockerexe rm -f "$Containername" 2>&1)" } # Check if 'docker logs' is still running @@ -2403,7 +2403,7 @@ check_xdepends() { # check dependencies on host for X server option } } || { [ "$Hostdisplay" ] || { - $Message "${1:-} needs a running X server. DISPLAY is empty. Wayland support is experimental only." + $Message "${1:-} needs a running X server. DISPLAY is empty. Wayland support is experimental option." Return=1 } } @@ -2686,8 +2686,11 @@ check_xserver() { # check chosen X server, auto-choose X server return 0 } create_xcommand() { ### create command to start X server and/or Wayland compositor - local Xserveroptions= Xpraoptions= Nxagentoptions= Compositorpid= Weston= Westonoutput= Count= Envvar= + local Xserveroptions_custom= Xpraoptions= Nxagentoptions= Compositorpid= Weston= Westonoutput= Count= Envvar= + Xserveroptions_custom="$Xserveroptions" + Xserveroptions="" + #### General X server options case $Xserver in --nxagent) @@ -3264,6 +3267,10 @@ esac ;; esac + # --xopt + Xcommand="$Xcommand \\ + $Xserveroptions_custom" + case $Xserver in --weston|--kwin|--hostwayland|--hostdisplay|--tty) Xcommand="" ;; esac @@ -4142,9 +4149,13 @@ create_dockercommand() { ### create command to run docker ;; *) case "$(cut -c1-5 <<< "$Line")" in - "/dev/") - Dockercommand="$Dockercommand \\ + "/dev/") + Dockercommand="$Dockercommand \\ --device $(convertpath volume "$Line")" + false && case $Podman in + yes) Dockercommand="$Dockercommand \\ + --volume $(convertpath volume "$Line")" ;; + esac warning "Sharing device file: $Line" ;; *) @@ -6731,7 +6742,8 @@ check_option_interferences() { # check multiple option interferences, change se ;; esac case $Podman in - yes) note "Option --gpu is known to fail with --podman. + yes) note "Option --gpu is known to fail with --podman + and also needs discouraged option --privileged. Please try with Docker instead." ;; esac } @@ -8072,6 +8084,7 @@ declare_variables() { # declare global variables Xpravfb="" # --xpra, --xdummy, --xvfb: vfb for --xpra: Xdummy or Xvfb Xserver="" # X server option to use Xoverip="" # --xoverip: Connect to X over TCP yes/no + Xserveroptions="" # --xopt: Custom X server options Xtest="" # --xtest: Enable extension Xtest yes/no. If empty, yes for --xpra/--xdummy/--xvfb, otherwise no Yaxis="" # Virtual screen height @@ -8287,7 +8300,7 @@ parse_options() { # parse cli options Longoptions="$Longoptions,cleanup,help,launcher,licence,license,version,wmlist" # Special options without starting X or container Longoptions="$Longoptions,install,remove,update,update-master" # Installation # - Longoptions="$Longoptions,iglx,keepcache,no-setup,podman,xcomposite,xorgconf:,runx" # Experimental + Longoptions="$Longoptions,iglx,keepcache,no-setup,podman,xcomposite,xopt:,xorgconf:,runx" # Experimental Longoptions="$Longoptions,dbus-system,homedir:,no-xhost,sharedir:,sharessh,systemd" # Deprecated Longoptions="$Longoptions,cachedir:,no-init,nothing,no-xtest,openrc,ps,runit,silent,starter,stderr,stdout" # Removed Longoptions="$Longoptions,sys-admin,sysvinit,tini,trusted,untrusted,vcxsrv" # Removed @@ -8510,10 +8523,10 @@ ${2:-}" ; shift ;; # Add custo --launcher) Createlauncher="yes" ;; # Create application launcher on desktop and exit #### Experimental options - --iglx) Iglx="yes" ; note "Option --iglx: experimental only." ;; # Indirect rendering; broken since Xorg ~18.2 - --keepcache) Preservecachefiles="yes" ; note "Option --keepcache: experimental only." ;; - --no-setup) Containersetup="no" ; note "Option --no-setup: experimental only." ;; - --podman) Podman="yes" ; note "Option --podman: experimental only. + --iglx) Iglx="yes" ; note "Option --iglx: experimental option." ;; # Indirect rendering; broken since Xorg ~18.2 + --keepcache) Preservecachefiles="yes" ; note "Option --keepcache: experimental option." ;; + --no-setup) Containersetup="no" ; note "Option --no-setup: experimental option." ;; + --podman) Podman="yes" ; note "Option --podman: experimental option. To avoid a prompt for root password, you might have to execute: sysctl -w kernel.unprivileged_userns_clone=1 Please report issues at: https://github.com/mviereck/x11docker/issues/255" ;; @@ -8521,9 +8534,10 @@ ${2:-}" ; shift ;; # Add custo ${2:-}" shift - note "Option --runasuser: experimental only." ;; # Add custom root command in container setup script - --xcomposite) Xcomposite="yes" ; note "Option --xcomposite: experimental only." ;; # Enable X extension COMPOSITE - --xorgconf) Xorgconf="${2:-}" ; note "Option --xorgconf: eperimental only" ; shift ;; # Custom xorg.conf + note "Option --runasuser: experimental option." ;; # Add custom root command in container setup script + --xcomposite) Xcomposite="yes" ; note "Option --xcomposite: experimental option." ;; # Enable X extension COMPOSITE + --xopt) Xserveroptions="${2:-}" ; note "Option --xopt: experimental option." ; shift ;; # Custom X server options + --xorgconf) Xorgconf="${2:-}" ; note "Option --xorgconf: experimental option." ; shift ;; # Custom xorg.conf #### Deprecated options --dbus-system) note "Option --dbus-system is deprecated.