Files
pwn-dojo/demo/desktop-auto-launch/.init
T
2025-03-20 10:52:06 -07:00

29 lines
679 B
Bash

#!/bin/sh
PATH="/run/dojo/bin:$PATH"
USER="hacker"
xfce_env() {
local session_pid
session_pid=$(pgrep -u "$USER" xfce4-session | head -n1)
xargs -0 -a /proc/"$session_pid"/environ
}
xfce_run() {
id
which su
echo "$USER"
setsid runuser "$USER" -c "env - $(xfce_env) $*"
}
# Launch a background process that waits for xfce4-session and then runs the command.
(
while ! pgrep -u "$USER" xfce4-session > /dev/null; do
sleep 1
done
# Consider using `--geometry` to set the window size and position
# Consider using `--fullscreen` to launch the application in fullscreen mode
xfce_run exo-open --launch TerminalEmulator
) &