You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
986 B
Kotlin
25 lines
986 B
Kotlin
2 years ago
|
package org.domaindrivenarchitecture.provs.desktop.infrastructure
|
||
3 years ago
|
|
||
2 years ago
|
import org.domaindrivenarchitecture.provs.framework.core.Prov
|
||
|
import org.domaindrivenarchitecture.provs.framework.core.ProvResult
|
||
2 years ago
|
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstall
|
||
|
import org.domaindrivenarchitecture.provs.framework.ubuntu.user.base.whoami
|
||
3 years ago
|
|
||
|
fun Prov.installVirtualBoxGuestAdditions() = def {
|
||
|
// if running in a VirtualBox vm
|
||
|
if (!chk("lspci | grep VirtualBox")) {
|
||
|
return@def ProvResult(true, "Not running in a VirtualBox")
|
||
|
}
|
||
|
|
||
|
if (chk("VBoxService --version")) {
|
||
|
return@def ProvResult(true, "VBoxService already installed")
|
||
|
}
|
||
|
|
||
|
// install guest additions
|
||
|
cmd("sudo add-apt-repository multiverse")
|
||
|
aptInstall("virtualbox-guest-x11") // virtualbox-guest-dkms")
|
||
|
// and add user to group vboxsf e.g. to be able to use shared folders
|
||
|
whoami()?.let { cmd("sudo usermod -G vboxsf -a " + it) }
|
||
|
?: ProvResult(true)
|
||
|
}
|