Skip to main content
Topic: OpenRC script for virtualbox-guest-utils (Read 367 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

OpenRC script for virtualbox-guest-utils

Howdy,

I'm running Artix in VirtualBox, and as such I was looking for virtualbox-guest-utils and virtualbox-guest-utils-openrc. But the latter doesn't exist. So I made the init script by adapting the one from Gentoo. It is not perfect but at least it starts the service and loads the kernel modules.

Code: [Select]
#!/sbin/openrc-run
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

pidfile="/var/run/vboxguest-service.pid"
#command="/usr/sbin/vboxguest-service"
command="/usr/sbin/VBoxService"
command_args="--foreground"
command_background="true"

depend() {
need dbus localmount
before display-manager
}

start_pre() {
einfo "Loading kernel modules"
/sbin/modprobe vboxguest 2>&1
/sbin/modprobe vboxsf 2>&1
/sbin/modprobe vboxvideo 2>&1
}

stop_post() {
einfo "Removing kernel modules"
/sbin/modprobe -r vboxvideo 2>&1
/sbin/modprobe -r vboxsf 2>&1
/sbin/modprobe -r vboxguest 2>&1
}

Hope it helps,
Viliam


Re: OpenRC script for virtualbox-guest-utils

Reply #2
Not bad, but you could list the related virtualbox modules in /etc/modules-load.d/vboxmodules.conf instead.