-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathfirstboot-windowmanager
More file actions
executable file
·70 lines (59 loc) · 2.11 KB
/
firstboot-windowmanager
File metadata and controls
executable file
·70 lines (59 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
# This is the list of supported window manager binaries
WMS=("gnome-kiosk" "metacity" "kwin_x11" "xfwm4" "openbox" "marco")
run_gnome_kiosk()
{
# Apply the anaconda overrides before running gnome-kiosk
if [ -z "$XDG_DATA_DIRS" ] ; then
new_data_dirs="/usr/share/anaconda/window-manager:/usr/share"
else
new_data_dirs="/usr/share/anaconda/window-manager:${XDG_DATA_DIRS}"
fi
XDG_DATA_DIRS="$new_data_dirs" $1 --x11 &
}
run_metacity()
{
# Apply the anaconda overrides before running metacity
if [ -z "$XDG_DATA_DIRS" ] ; then
new_data_dirs="/usr/share/anaconda/window-manager:/usr/share"
else
new_data_dirs="/usr/share/anaconda/window-manager:${XDG_DATA_DIRS}"
fi
XDG_DATA_DIRS="$new_data_dirs" $1 &
}
# Get the application binary to start and remove it from
# the argument list
BINARY=$1
shift
for WM in ${WMS[@]}; do
FILE=$(which $WM 2>/dev/null)
FOUND=$?
if [ $FOUND -eq 0 -a -x "$FILE" ]; then
# start window manager
if [ "$WM" == "gnome-kiosk" ]; then
# if running gnome-kiosk apply the Anaconda/Initial Setup custom overrides
echo "Running gnome-kiosk with custom overrides" | systemd-cat -t initial-setup -p 6
run_gnome_kiosk "$FILE"
elif [ "$WM" == "metacity" ]; then
# if running Metacity apply the Anaconda/Initial Setup custom overrides
echo "Running Metacity with custom overrides" | systemd-cat -t initial-setup -p 6
run_metacity "$FILE"
else
echo "Running window manager ($FILE)" | systemd-cat -t initial-setup -p 6
"$FILE" &
fi
pid=$!
# start the application
echo "Running ($BINARY)" | systemd-cat -t initial-setup -p 6
$BINARY "$@"
res=$?
# stop window manager
echo "Stopping the window manager ($FILE)" | systemd-cat -t initial-setup -p 6
ps -p $pid >/dev/null && kill $pid
# return result
exit $res
fi
done
# No known window manager found
echo "No supported window manager found!" | systemd-cat -t initial-setup -p 3
exit 1