From: Thomas Walker Lynch Date: Tue, 8 Mar 2022 15:01:21 +0000 (-0500) Subject: adds ch_subu subu_add subu_del X-Git-Url: https://git.reasoningtechnology.com/style/static/gitweb.css?a=commitdiff_plain;h=4bea468c64fb89ab24e0f8ce315761589ce63a1c;p=subu adds ch_subu subu_add subu_del --- diff --git a/executable/ch_subu b/executable/ch_subu old mode 100644 new mode 100755 index c7298fa..0252a3f --- a/executable/ch_subu +++ b/executable/ch_subu @@ -1,21 +1,48 @@ #!/bin/bash # -# This must be sourced + +# to make audio work will need to do this: +# > sudo dnf install pulseaudio-utils +# > pactl load-module module-native-protocol-tcp + +#set -x subu=$1 + +if [ ! -x "/usr/local/bin/user-stem" ]; then + echo "no /usr/local/bin/user-stem program found (it is in the system repo)" + exit 1 +fi + if [ -z "$subu" ]; then echo "no subuser name supplied" exit 1 fi machine="$(hostname)" -xkey=$(xauth list | grep Turbine | awk '{print $3}') +xkey=$(xauth list | grep "$machine" | head -1 | awk '{print $3}') -if [ -z "$key" ]; then +if [ -z "$xkey" ]; then echo "xauth key not found" exit 1 fi -sudo su "$subu" +stem=$(/usr/local/bin/user-stem) +user_subu="$stem-$subu" +home_subu="/home/$stem/$subu" +bashrc="$home_subu/.bashrc" +xauthority="$home_subu/.Xauthority" + +read -r -d '' script0 <<-EOF + cd "$home_subu" \ + ;export DISPLAY=$DISPLAY \ + ;export NO_AT_BRIDGE=1 \ + ;export PULSE_SERVER=localhost \ + ;touch "$xauthority" \ + ;xauth add "$DISPLAY" . "$xkey" \ + ;gnome-terminal +EOF + +sudo su "$user_subu" -c "$script0" -xauth \ No newline at end of file +#set +x