From 75a2ccd4633c5c0b2e14aacfe3121bad28b5b5b9 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Tue, 8 Feb 2022 03:51:55 +0000 Subject: [PATCH] bin/x2x-privsep: Add (souped-up) version of this handy script. --- Makefile | 1 + bin/x2x-privsep | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100755 bin/x2x-privsep diff --git a/Makefile b/Makefile index be1e688..a9a4ef2 100644 --- a/Makefile +++ b/Makefile @@ -317,6 +317,7 @@ SCRIPTLINKS += xinitcmd lock-screen xshutdown SCRIPTLINKS += un-backslashify-selection SCRIPTLINKS += xpra-start-xdummy SCRIPTLINKS += play-rawk +SCRIPTLINKS += x2x-privsep SCRIPTLINKS += xduplic-terminal DOTCPP += .Xdefaults diff --git a/bin/x2x-privsep b/bin/x2x-privsep new file mode 100755 index 0000000..6d578e8 --- /dev/null +++ b/bin/x2x-privsep @@ -0,0 +1,22 @@ +#! /bin/sh -ex + +dir=west bogus=nil +usage () { echo "usage: $0 [-ensw] HOST:RDPY/LDPY"; } +while getopts "hensw" opt; do + case $opt in + h) usage; exit ;; + e) dir=east ;; + n) dir=north ;; + s) dir=south ;; + w) dir=west ;; + *) bogus=t ;; + esac +done +shift $(( $OPTIND - 1)) +case $bogus,$#,$1 in nil,1,*:*/*) ;; *) usage >&2; exit 2 ;; esac +host=${1%:*} dpy=${1##*:}; rdpy=${dpy%%/*} ldpy=${dpy#*/} +control=ControlPath=~/.ssh/sock-%l/control-%r@%h.x2x +ssh -o$control -L"/tmp/.X11-unix/X$ldpy:/tmp/.X11-unix/X$rdpy" -Nafx "$host" +sleep 1 +trap 'trap - INT QUIT HUP EXIT; ssh -o$control -Oexit "$host"; rm -f "/tmp/.X11-unix/X$ldpy"' INT QUIT HUP EXIT +x2x -$dir -to ":$ldpy" -- 2.11.0