Artix Linux Forum

Init systems => OpenRC => Topic started by: viliam on 03 February 2024, 11:03:51

Title: OpenRC script for virtualbox-guest-utils
Post by: viliam on 03 February 2024, 11:03:51
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
Title: Re: OpenRC script for virtualbox-guest-utils
Post by: viliam on 03 February 2024, 14:47:07
Gentoo's original OpenRC script https://gitweb.gentoo.org/repo/gentoo.git/tree/app-emulation/virtualbox-guest-additions/files/virtualbox-guest-additions-8.initd-r1 (https://gitweb.gentoo.org/repo/gentoo.git/tree/app-emulation/virtualbox-guest-additions/files/virtualbox-guest-additions-8.initd-r1)
Title: Re: OpenRC script for virtualbox-guest-utils
Post by: nous on 15 February 2024, 00:13:11
Not bad, but you could list the related virtualbox modules in /etc/modules-load.d/vboxmodules.conf instead.