1
0
mirror of https://github.com/mviereck/x11docker.git synced 2021-09-19 22:38:46 +03:00

add serveral missing options

This commit is contained in:
mviereck
2021-06-02 17:51:13 +02:00
parent e1dc8b2e37
commit db12331be6

View File

@@ -157,24 +157,36 @@ Keymapscombo=\"$Hostkeymap\"
Keymapscombo=${Keymapscombo:-\"\"}
for Line in $Keymaps; do Keymapscombo="$Keymapscombo,\"$Line\"" ; done
# --preset
Presetcombo=""
while read Line; do
Presetcombo="$Presetcombo,'$Line'"
done < <(find /etc/x11docker/preset $HOME/.config/x11docker/preset -type f -exec basename {} \; | sort -V | uniq)
Presetcombo="${Presetcombo#,}"
Presetcombo="${Presetcombo:-"''"}"
# Look for icon
[ -e /usr/share/icons/hicolor/64x64/apps/x11docker.png ] && X11docker_icon="/usr/share/icons/hicolor/64x64/apps/x11docker.png"
[ -e /usr/local/share/icons/hicolor/64x64/apps/x11docker.png ] && X11docker_icon="/usr/local/share/icons/hicolor/64x64/apps/x11docker.png"
Kaptain_grammar='#! /usr/bin/kaptain
start "Run GUI applications in docker containers - x11docker '$Version'" -> options previewline buttons;
start "Run GUI applications in containers - x11docker '$Version'" -> options previewline buttons;
options:beside -> frameleft frameright;
frameleft -> choose_image_framed xserver_tabbed;
frameright -> options_tabbed;
choose_image_framed:framed -> choose_image;
choose_image "Choose docker image" -> logo_imageorexe dockerimage;
choose_image "Choose image" -> logo_imageorexe dockerimage backend;
logo_imageorexe:beside -> @icon("'$X11docker_icon'") imageorexe ;
imageorexe -> image | exe | xonly;
image:beside "Run Docker container from image." -> "-- \ " ;
exe "--exe: Run host application instead of docker container." -> "--exe -- ";
xonly "--xonly: Only create new empty X server." -> "--xonly -- ";
dockerimage "Docker image [and command] to run:" -> "--IMG=" @combow('$Imagelist');
image:beside "Run container from image." -> "-- " ;
exe "--exe: Run host application instead of docker container." -> "--exe -- ";
xonly "--xonly: Only create new empty X server." -> "--xonly -- ";
dockerimage "Image [and command] to run:" -> "--IMG=" @combow('$Imagelist');
backend:beside "--backend:" -> backenddocker | backendpodman | backendnerdctl;
backenddocker "docker" -> "" ;
backendpodman "podman" -> "--backend=podman" ;
backendnerdctl "nerdctl" -> "--backend=nerdctl" ;
xserver_tabbed:tabbed -> xserver_choose xserver_appearance;
@@ -205,12 +217,13 @@ start "Run GUI applications in docker containers - x11docker '$Version'" -> o
fullscreen "--fullscreen: Run X server in fullscreen mode." -> "--fullscreen " | ! "" ;
size:beside "--size: Virtual screen size:" -> "--size \"" @combow("320x240","640x480","800x600","1024x768","1280x800","1280x1024","1400x1050","1680x1200","1920x1080")="800x600" "\" "| !"" ;
xserver_appearance " Appearance of new X server" -> scale rotate dpi outputcount keymap xfishtank;
xserver_appearance " Appearance of new X server" -> scale rotate dpi outputcount keymap border xfishtank;
scale:beside "--scale: Zoom factor:" -> "--scale=\"" @combow("0.25","0.5","0.75","0.9","1","1.25","1.5","2","2.5","3")="1.5" "\" " | ! "" ;
rotate:beside "--rotate: Rotation and mirroring:" -> "--rotate=\"" @combo("0","90","180","270","flipped","flipped-90","flipped-180","flipped-270")="180" "\" " | ! "" ;
dpi:beside "--dpi: Dots per inch (influences font size):" -> "--dpi=\"" @combow("36","48","60","72","84","96","120","150","256","300")="96" "\" " | ! "" ;
outputcount:beside "--output-count: Multiple displays:" -> "--output-count=\"" @combow("1","2","3","4")="2" "\" " | ! "" ;
keymap:beside "--keymap: XKB keyboard layout:" -> "--keymap \"" @combow('$Keymapscombo') "\" " | ! "";
border:beside "--border: Draw colored border in xpra windows:" -> "--border=\"" @combow("blue,1","yellow,2","green,1","red,3") "\" " | ! "" ;
xfishtank "--xfishtank: Show a fish tank." -> "--xfishtank " | ! "" ;
@@ -221,13 +234,14 @@ start "Run GUI applications in docker containers - x11docker '$Version'" -> o
options_init_framed:framed -> options_init;
tab_terminal:framed "Terminal" -> options_verbosity options_stdstream options_show;
options_normal "Sound, clipboard, webcam, printer, language" -> clipboard pulseaudio alsa lang webcam printer;
options_normal "Internet, sound, clipboard, webcam, printer, language" -> network clipboard pulseaudio alsa lang webcam printer;
network:beside "--network: Internet access (defaults to none in future)" -> "--network=\"" @combow("","none","host")="" "\" " | ! "";
clipboard "--clipboard: Clipboard sharing. (Picture clips: --xpra or --hostdisplay) \n
(This option also removes security restrictions of --hostdisplay)." -> "--clipboard " | ! "";
pulseaudio "--pulseaudio: Sound with pulseaudio." -> "--pulseaudio " | ! "";
pulseaudio:beside "--pulseaudio: Sound with pulseaudio." -> "--pulseaudio=\"" @combo("","socket","tcp") "\" " | ! "";
alsa:beside "--alsa: Sound with ALSA. Sound card:" -> "--alsa=\"" @combow('$Alsalist')="'$ALSA_CARD'" "\" " | ! "" ;
lang:beside "--lang: Language locale. (Generated if missing):" -> "--lang=\"" @combow('$Langcombo')="'$Hostlangland'" "\" " | ! "" ;
printer "--printer: Share printer through CUPS." -> "--printer " | ! "" ;
printer:beside "--printer: Share printer through CUPS." -> "--printer=\"" @combo("","socket","tcp") "\" " | ! "";
webcam "--webcam: Share webcam device files." -> "--webcam " | ! "" ;
options_hostfolders "Share host files or Docker volumes" -> home sharedir1 sharedir2;
@@ -236,15 +250,15 @@ start "Run GUI applications in docker containers - x11docker '$Version'" -> o
sharedir1 "--share: Share a host file, folder or device, or a Docker volume:" -> "--share=\"" @directory="" "\" " | ! "" ;
sharedir2 "--share: Share a host file, folder or device, or a Docker volume:" -> "--share=\"" @directory="" "\" " | ! "" ;
options_advanced "Advanced options" -> sudouser nointernet noentrypoint shell workdir env1 env2;
options_advanced "Advanced options" -> sudouser noentrypoint shell workdir env1 env2 preset;
sudouser "--sudouser: Allow su and sudo in container. Password: x11docker\n
Severe reduction of container security!" -> "--sudouser " | ! "" ;
noentrypoint "--no-entrypoint: Disable ENTRYPOINT in image." -> "--no-entrypoint " | ! "" ;
nointernet "--no-internet: Disable internet access for container." -> "--no-internet " | ! "" ;
shell:beside "--shell: Set preferred shell" -> "--shell=\"" @combow("bash","dash","fish","ksh","tcsh","sh","zsh")="bash" "\" " | ! "" ;
workdir:beside "--workdir: Working directory: " -> "--workdir=\"" @string="" "\" " | ! "";
env1:beside "--env: Environment variable: " -> "--env=\"" @string="SHELL=/bin/sh" "\" " | ! "" ;
env2:beside "--env: Environment variable: " -> "--env=\"" @string="" "\" " | ! "" ;
preset:beside "--preset: User file with predefined options:" -> "--preset=\"" @combo('$Presetcombo') "\" " | ! "" ;
options_init "Init system and DBus in container" -> dbus hostdbus initsystem sharecgroup;
initsystem:beside "--init: Run init system in container. " -> "--init=" @combo( "tini","systemd","sysvinit","runit","openrc","s6-overlay","none")="systemd" " " | ! "" ;
@@ -261,8 +275,8 @@ start "Run GUI applications in docker containers - x11docker '$Version'" -> o
options_stdstream "Interaction" -> interactive stdin pull pw;
interactive "--interactive: Run with an interactive TTY." -> "--interactive" | ! "" ;
stdin "--stdin: Forward stdin to container stdin." -> "--stdin " | ! "" ;
pull:beside "--pull: Allow or run \"docker pull\"" -> "--pull=" @combo("ask","yes","no","always")="yes" " " | ! "" ;
pw:beside "--pw: Password prompt frontend:" -> "--pw=\"" @combo("su","sudo","gksu","gksudo","lxsu","lxsudo","kdesu","kdesudo","beesu","pkexec","none")="sudo" "\" " | ! "" ;
pull:beside "--pull: Allow or enforce \"docker pull\"" -> "--pull=" @combo("ask","yes","no","always")="yes" " " | ! "" ;
pw:beside "--pw: Password prompt frontend:" -> "--pw=\"" @combo("","su","sudo","gksu","gksudo","lxsu","lxsudo","kdesu","kdesudo","beesu","pkexec","none")="" "\" " | ! "" ;
options_show "Show internals on stdout" -> show_explanation showenv showid showinfofile showpid1;
show_explanation -> @text="Catch output of following options with \"read var < <(x11docker ...)\"" ;
@@ -273,8 +287,8 @@ start "Run GUI applications in docker containers - x11docker '$Version'" -> o
develdialog:dialog "Additional special options" -> developeroptions @execclose("echo develclose")=" close";
developeroptions:beside -> develleft develright;
develleft:framed -> devauth devxconfig devaddcommands devstorage;
develright:framed -> devuser devcaps devrun devmisc ;
develleft:framed -> devauth devxconfig devaddcommands ;
develright:framed -> devstorage devuser devcaps devrun devmisc ;
devuser "User settings" -> user hostuser groupadd;
user:beside "--user: Container user (name or uid): \n
(A gid can be specified with user:gid) \n
@@ -285,32 +299,38 @@ start "Run GUI applications in docker containers - x11docker '$Version'" -> o
devstorage "Storage folders" -> homebasedir cachebasedir ;
homebasedir:beside "--homebasedir: Host storage folder for --home: " -> "--homebasedir=\"" @directory="" "\" " | ! "" ;
cachebasedir:beside "--cachebasedir: Host cache base folder: " -> "--cachebasedir=\"" @directory="" "\" " | ! "" ;
devaddcommands "Additional commands" -> runfromhost runasroot ;
devaddcommands "Additional commands" -> runfromhost runasuser runasroot ;
runfromhost "--runfromhost: Run host command on new X server. Use sh syntax:" -> "--runfromhost=\"" @string="/usr/bin/launchy &" "\" " | ! "" ;
runasuser "--runasuser: Run additional command as user in container. Use sh syntax:" -> "--runasuser=\"" @string="" "\" " | ! "" ;
runasroot "--runasroot: Run command as root in container. Use sh syntax:" -> "--runasroot=\"" @string="" "\" " | ! "" ;
devauth "X authentication" -> noauth xhost cleanxhost;
xhost "--xhost: Custom xhost setting on new X server. See \"man xhost\":" -> "--xhost=\"" @string="+SI:localuser:'$Containeruser'" "\" " | ! "" ;
noauth "--no-auth: Disable access restrictions of new X server. Use with care." -> "--no-auth " | ! "" ;
cleanxhost "--clean-xhost: Disable xhost access policies on host X server." -> "--clean-xhost " | ! "" ;
devxconfig "X and Wayland configuration" -> vt display xoverip xtest westonini;
devxconfig "X and Wayland configuration" -> vt display xoverip iglx composite xtest westonini;
vt :beside "--vt: virtual terminal/tty to use: (--xorg only)" -> "--vt=\"" @string="8" "\" " | ! "";
display :beside "--display: display number to use (X and Wayland): " -> "--display=\"" @string="1000" "\" " | ! "";
xoverip "--xoverip: Connect to X over TCP/IP. (Not all X servers support this.)" -> "--xoverip " | ! "" ;
iglx "--iglx: Indirect rendering. Currently works with NVIDIA only." -> "--iglx " | ! "" ;
composite:beside "--composite: Enable or disable X extension COMPOSITE. \n
Can fix or cause issues in nxagent." -> "--composite=\"" @combo("yes","no")="yes" "\" " | ! "";
xtest:beside "--xtest: Enable or disable X extension XTEST. \n
Can be needed for custom xpra access." -> "--xtest=\"" @combo("yes","no")="yes" "\" " | ! "";
westonini "--westonini: Custom weston.ini (see man weston.ini)" -> "--westonini=\"" @infile="/usr/share/doc/weston/examples/weston.ini" "\" " | ! "";
devrun -> setcapsdialog dockeroptions;
dockeroptions "Custom options for \"docker run\" " -> "--OPT=" @string="" ;
devcaps "Container capabilities and namespaces, runtime" -> name limit runtime @text("The following options severely degrade container isolation!") capdefault ipc net;
devcaps "Container capabilities and namespaces, runtime" -> name limit runtime @text("The following options severely degrade container isolation!") capdefault ipc newprivileges;
name:beside "--name: Container name: " -> "--name=\"" @string="" "\" " | ! "" ;
limit:beside "--limit: Restrict CPU and RAM usage to proportional factor" -> "--limit=\"" @combow("0.1","0.2","0.3","0.4","0.5","0.6","0.7","0.8","0.9","1.0")="0.5" "\" " | ! "";
runtime:beside "--runtime: Enable custom docker runtime:" -> "--runtime=\"" @combow("","runc","crun","kata-runtime","nvidia")="nvidia" "\" " | ! "";
runtime:beside "--runtime: Choose container runtime:" -> "--runtime=\"" @combow("","runc","crun","kata-runtime","nvidia")="nvidia" "\" " | ! "";
capdefault "--cap-default: Allow default container capabilities." -> "--cap-default " | ! "" ;
ipc "--hostipc: Disable IPC namespacing. Allows MIT-SHM extension. \n
Shares host interprocess communication and shared memory. " -> "--hostipc " | ! "" ;
net "--hostnet: Disable network namespacing. Shares host network stack." -> "--hostnet " | ! "" ;
devmisc "Miscellaneous" -> enforcei;
enforcei "--enforce-i: Force bash to run in interactive mode." -> "--enforce-i " | ! "" ;
Shares host interprocess communication and shared memory. " -> "--hostipc " | ! "" ;
newprivileges:beside "--newprivileges: Allow process to gain more capabilities:" -> "--newprivileges=\"" @combo("yes","no")="yes" "\" " | ! "";
devmisc "Miscellaneous" -> fallback nosetup enforcei;
fallback:beside "--fallback: Allow (default) or deny fallbacks:" -> "--fallback=\"" @combo("yes","no")="no" "\" " | ! "";
nosetup "--no-setup: No setup inside of container. Restricts features." -> "--no-setup " | ! "" ;
enforcei "--enforce-i: Force bash to run in interactive mode." -> "--enforce-i " | ! "" ;
setcapsdialog:beside "Add container capabilities:" -> capsdialog ;
capsdialog:dialog "docker capabilities and privileges" -> capsreference capstable @close="close";
@@ -372,10 +392,11 @@ previewline:beside -> previewclipboard previewtext;
previewtext -> @text="";
previewclipboard -> @echo("--CLIPBOARD")="Copy to clipboard:" ;
buttons:horizontal -> run runxterm starter cleanupxterm quit;
buttons:horizontal -> run runxterm starter password cleanupxterm quit;
run -> @echo("--RUN")=" Run";
starter -> @echo("--STARTER")="Create starter on desktop" ;
runxterm -> @echo("--XTERM")="Run in xterm" ;
password -> @echo("--PWD")="Change password" ;
cleanupxterm -> @echo("--CLEANUP")="Clean up and exit";
quit -> @dump("--EXIT")="Exit" ;
'
@@ -532,6 +553,13 @@ $(pstree -p $Pid)"
} || send "runxterm='Please install xterm'"
;;
--PWD) # --PWD: run --password in xterm window
command -v xterm >/dev/null && {
xterm -hold -e "$X11docker_exe --password"
:
} || send "runxterm='Please install xterm'"
;;
--STA) # --STARTER: create desktop starter icon
Runit="runstarter"
Line="refresh"
@@ -561,7 +589,7 @@ $(pstree -p $Pid)"
[ "$Line" ] && {
verbose "Refreshing preview"
Previewline="$X11docker_exe"
for Line in xserver_choose xserver_appearance \
for Line in backend xserver_choose xserver_appearance \
options_normal options_hostfolders \
options_advanced options_init \
options_verbosity options_stdstream options_show \