Skip to content

Commit

Permalink
fix odd output redirection of create_N() functions #388
Browse files Browse the repository at this point in the history
  • Loading branch information
mviereck committed Oct 10, 2021
1 parent 353bbbe commit 9d5a146
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions x11docker
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# Run 'x11docker --help' or scroll down to read usage information.
# More documentation at: https://github.com/mviereck/x11docker

Version="6.10.1-beta-1"
Version="6.10.1-beta-2"

# --enforce-i: Enforce running in interactive mode to allow commands tty and weston-launch in special setups.
grep -q -- "--enforce-i" <<< "$*" && case $- in
Expand Down Expand Up @@ -205,7 +205,7 @@ X and Wayland special configuration:
--westonini=FILE Custom weston.ini for --weston and --weston-xwayland.
--xhost [=STR] Set \"xhost STR\" on new X server (see 'man xhost').
Without STR will set: +SI:localuser:\$USER
(Use with care. '--xhost +' allows access for everyone).
(Use with care. '--xhost=+' allows access for everyone).
--xoverip Connect to X over TCP network. For special setups only.
Only supported by a subset of X server options.
--xtest [=yes|no] Enable or disable X extension XTEST. Default is yes for
Expand Down Expand Up @@ -3638,7 +3638,7 @@ else
exec "$XORG_BIN" "$@"
fi
'
} >> $Xorgwrapper
}
create_xdummyxorgconf() { # options --xdummy, --xpra: create xorg.conf for Xdummy
local Modelinefile
echo '# This xorg configuration file is forked and changed from xpra to start a dummy X11 server.
Expand Down Expand Up @@ -3686,7 +3686,7 @@ Section "ServerLayout"
Identifier "dummy_layout"
Screen "dummy_screen"
EndSection
' >> $Xdummyconf
'
}
create_xinitrc() { # create xinitrc: set up X environment, create cookies
echo "#! /bin/sh"
Expand Down Expand Up @@ -4042,7 +4042,7 @@ create_xinitrc() { # create xinitrc: set up X environment, create c
esac

return 0
} >> $Xinitrc
}

#### docker command setup
check_containerhome() { # options --home, --homedir, --homebasedir: check HOME of container user.
Expand Down Expand Up @@ -5665,7 +5665,7 @@ reload() {
esac
}
return 0
} >> $Containerrootrc
}
create_dockerrc() { ### create dockerrc: This script runs as root (or member of group docker) on host. Also creates containerrc
# create containerrc -> runs as unprivileged user in container
# check and set up cgroup on host for systemd or elogind
Expand Down Expand Up @@ -6327,7 +6327,7 @@ $(rmcr < '$Containerlogfile' | uniq )"'

echo "exit 0"
return 0
} >> $Dockerrc
}
create_xtermrc() { # create xtermrc: Script to prompt for password (if needed) and to run dockerrc
echo "#! /usr/bin/env bash"
echo "# Ask for password if needed."
Expand Down Expand Up @@ -6364,7 +6364,7 @@ create_xtermrc() { # create xtermrc: Script to prompt for password
echo "storeinfo xtermrc=ready"
echo "exit 0"
return 0
} >> $Xtermrc
}

#### final startup routines
start_compositor() { # start Wayland compositor Weston or KWin
Expand Down Expand Up @@ -9154,7 +9154,10 @@ Parsed options: $Parsedoptions_global"
#### Create command to run X server [and/or Wayland compositor]
[ "$Xserver" != "--xorg" ] && [ -n "$Newxvt" ] && note "Option --vt only takes effect with option --xorg."
[ "$Xserver" = "--xorg" ] && [ -z "$Newxvt" ] && check_vt # --vt: find free tty/virtual terminal for Xorg
{ [ "$Xserver" = "--xdummy" ] || [ "$Xpravfb" = "Xdummy" ] ; } && create_xdummyxorgconf && create_xdummywrapper
{ [ "$Xserver" = "--xdummy" ] || [ "$Xpravfb" = "Xdummy" ] ; } && {
create_xdummyxorgconf >> "$Xdummyconf"
create_xdummywrapper >> "$Xorgwrapper"
}
check_newxenv # find free display, create $Newxenv
create_xcommand # set up start command for X server # all X server and Wayland options
[ "$Xcommand" ] && debugnote "X server command:
Expand Down Expand Up @@ -9193,33 +9196,33 @@ Parsed options: $Parsedoptions_global"
setup_capabilities # add linux capabilities if needed for some options. Default: --cap-drop=ALL
[ "$Sharehostdbus" = "yes" ] && setup_hostdbus # --hostdbus
create_dockercommand # create 'docker run' command #time0,631
echo "$Dockercommand" >> $Dockercommandfile
echo "$Dockercommand" >> "$Dockercommandfile"

debugnote "$Containerbackend command:
$Dockercommand"

#### Create helper scripts to set up container
## dockerrc runs as root (or member of group docker) on host.d
# Main jobs: check image, pull image if needed, create script containerrc to run container command
create_dockerrc
create_dockerrc >> "$Dockerrc"
verbose "Generated dockerrc:
$(nl -ba <$Dockerrc)"
## containerrootrc runs as root in container.
# Main jobs: create unprivileged container user, disable possible privilege leaks, set local time.
# Optional jobs: run init system, run DBus daemon, install nvidia driver, create language locale.
[ "$Containersetup" = "yes" ] && {
create_containerrootrc
create_containerrootrc >> "$Containerrootrc"
verbose "Generated containerrootrc:
$(nl -ba <$Containerrootrc)"
}
create_xtermrc # xtermrc to prompt for password if needed.
create_xtermrc >> "$Xtermrc" # xtermrc to prompt for password if needed.
}

#### Create helper script xinitrc to set up X
## xinitrc is started by xinit and does some setup within new X server.
# Main job: create cookie, check xhost, set keyboard layout.
# Optional jobs: run window manager, run xfishtank, run host command, share clipboard, scale/rotate --xorg, create set of screen resolutions.
create_xinitrc
create_xinitrc >> "$Xinitrc"
verbose "Generated xinitrc:
$(nl -ba <$Xinitrc)"
[ -s "$Westonini" ] && verbose "Generated weston.ini:
Expand Down

0 comments on commit 9d5a146

Please sign in to comment.