Skip to content

Commit

Permalink
--weston: use weston-launch if possible/tty interactive #166
Browse files Browse the repository at this point in the history
  • Loading branch information
mviereck committed Aug 7, 2019
1 parent 2621741 commit d83d026
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions x11docker
Original file line number Diff line number Diff line change
Expand Up @@ -2543,7 +2543,7 @@ fi
' >> $Xorgwrapper
}
create_xcommand() { # create command to start X server and/or Wayland compositor
local Xserveroptions= Xephyroptions= Nxagentoptions= Xpraoptions= Compositorpid= Westonoutput= Count=
local Xserveroptions= Xephyroptions= Nxagentoptions= Xpraoptions= Compositorpid= Weston= Westonoutput= Count=

#### General X server options
Xserveroptions="-dpms -s off"
Expand Down Expand Up @@ -2759,6 +2759,7 @@ create_xcommand() { # create command to start X server and/or Waylan
#### Prepare weston.ini: config file for Weston
case $Xserver in
--weston|--weston-xwayland|--xpra-xwayland|--xdummy-xwayland)
command -v weston-launch >/dev/null && [ "$Hosttty" = "yes" ] && [ "$Bashinteractive" = "yes" ] && Weston="weston-launch -v --" || Weston="weston"
echo "
[core]
shell=desktop-shell.so
Expand All @@ -2782,7 +2783,7 @@ startup-animation=fade
[ "$Hosttty" = "yes" ] && {
[ -n "$Screensize" ] || [ "$Scaling" ] || [ -n "$Rotation" ] && {
# short start&stop of Weston to grep name of monitor
unpriv "weston --no-config --backend=drm-backend.so >> $Compositorlogfile 2>&1 & echo \$! >>$Compositorpidfile"
unpriv "$Weston --no-config --backend=drm-backend.so >> $Compositorlogfile 2>&1 & echo \$! >>$Compositorpidfile"
Compositorpid=$(cat $Compositorpidfile)
waitforlogentry weston $Compositorlogfile "connector" || error "Weston startup failed. Can not run $Xserver.
Last lines of weston log:
Expand Down Expand Up @@ -2873,7 +2874,7 @@ $(tail "$Compositorlogfile")"
esac
echo "mode=$Screensize" >> $Westonini
[ -n "$Customwestonini" ] && Westonini="$Customwestonini"
Compositorcommand="weston --socket=$Newwaylandsocket"
Compositorcommand="$Weston --socket=$Newwaylandsocket"
case $Westonoutput in
WL) Compositorcommand="$Compositorcommand --backend=wayland-backend.so" ;;
X) Compositorcommand="$Compositorcommand --backend=x11-backend.so" ;;
Expand All @@ -2896,7 +2897,7 @@ $(tail "$Compositorlogfile")"
--weston|--weston-xwayland)
[ "$Xserver" = "--weston-xwayland" ] && Xcommand="$(command -v Xwayland) :$Newdisplaynumber \\
$Xserveroptions"
Compositorcommand="weston --socket=$Newwaylandsocket"
Compositorcommand="$Weston --socket=$Newwaylandsocket"
[ -n "$Westonoutput" ] && for ((Count=1 ; Count<=$Outputcount ; Count++)) ; do
[ "$Westonoutput" = "WL" ] || [ "$Westonoutput" = "X" ] || {
Count=""
Expand Down Expand Up @@ -4053,7 +4054,7 @@ create_dockerrc() { # create dockerrc: This script runs as root (or
echo "PS4='+ dockerrc: \$(date +%S+%3N) '"
#echo "set -x"
declare -f traperror | sed 's/Command/dockerrc: Command/'
echo "set -Eu"
# echo "set -Eu"
echo "trap 'traperror \$? \$LINENO \$BASH_LINENO \"\$BASH_COMMAND\" \$(printf \"::%s\" \${FUNCNAME[@]})' ERR"
}

Expand Down Expand Up @@ -5524,7 +5525,11 @@ check_host() { # check host environment
XDG_VTNR=${XDG_VTNR:-}

# Check whether x11docker runs in an interactive terminal
tty >/dev/null 2>&1 && Runsinterminal="yes" || Runsinterminal="no"
tty -s && Runsinterminal="yes" || Runsinterminal="no"
case $- in
*i*) Bashinteractive="yes" ;;
*) Bashinteractive="no" ;;
esac

# Check whether ps can watch processes of other users
mount | grep "^proc" | grep -q "hidepid=2" && {
Expand Down Expand Up @@ -6746,6 +6751,7 @@ declare_variables() { # declare global variables
Nvidiadriver="" # option '--gpu': nvidia driver installer for container in [...]local/share/x11docker
Hostcanwatchroot="" # x11docker can watch root processes yes/no
Runsinterminal="" # x11docker runs in a terminal yes/no
Bashinteractive="" # script runs with bash -i yes/no
Usemkfifo="yes" # Not on Windows nor with kata-runtime
HOME="${HOME:-}"
DISPLAY="${DISPLAY:-}"
Expand Down Expand Up @@ -7435,6 +7441,7 @@ main "$@"

#### ToDo notes for development
todo() {
# --debug: set -Eu fails in dockerrc
# handle Hosttty=unknown
# --env: check escapestring in cmd.sh
# improve speed of dockerrc and containerrootrc
Expand Down

0 comments on commit d83d026

Please sign in to comment.