-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
49 lines (42 loc) · 1.06 KB
/
install.sh
File metadata and controls
49 lines (42 loc) · 1.06 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
# scriptlet:_common/package_install.sh
##
# Install Xvfb and (optionally) a daemon helper
#
# Syntax:
# install_xvfb [--no-daemon] [--display <int>] [--service <name>]
#
# Changelog:
# 20260216 - Initial version
#
function install_xvfb() {
local SERVICE_DISPLAY=99
local SERVICE_NAME="xvfb"
local NO_DAEMON=0
while [ $# -ge 1 ]; do
case $1 in
--no-daemon) NO_DAEMON=1;;
--display) shift; SERVICE_DISPLAY="$1";;
--service) shift; SERVICE_NAME="$1";;
esac
shift
done
package_install xvfb
if [ "$NO_DAEMON" -eq 0 ]; then
# Install the daemon helper script
cat > /etc/systemd/system/${SERVICE_NAME}.service <<EOL
[Unit]
Description=Virtual Frame Buffer (Xvfb)
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/Xvfb :${SERVICE_DISPLAY} -screen 0 1024x768x16 -nolisten tcp
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOL
systemctl daemon-reload
systemctl enable ${SERVICE_NAME}.service
systemctl start ${SERVICE_NAME}.service
echo "Xvfb service '${SERVICE_NAME}' installed and started on display :${SERVICE_DISPLAY}."
fi
}