initial commit of file from CVS for smeserver-virtualbox on Sat Sep 7 21:14:17 AEST 2024
This commit is contained in:
@@ -0,0 +1 @@
|
||||
enabled
|
1
root/etc/e-smith/db/configuration/defaults/vboxdrv/type
Normal file
1
root/etc/e-smith/db/configuration/defaults/vboxdrv/type
Normal file
@@ -0,0 +1 @@
|
||||
service
|
@@ -0,0 +1 @@
|
||||
18083
|
@@ -0,0 +1 @@
|
||||
localhost
|
@@ -0,0 +1 @@
|
||||
enabled
|
@@ -0,0 +1 @@
|
||||
service
|
@@ -0,0 +1 @@
|
||||
vbox
|
8
root/etc/e-smith/db/configuration/migrate/virtualbox
Normal file
8
root/etc/e-smith/db/configuration/migrate/virtualbox
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
my $rec = $DB->get('vboxweb-service') || $DB->new_record('vboxweb-service', {type => 'service'});
|
||||
if (not exists $rec{'password'}) {
|
||||
my @allowed = ('a'..'z', 'A'..'Z', 0..9);
|
||||
my $pass = join '', map $allowed[rand @allowed], 0..32;
|
||||
my $updateconfig = $rec->set_prop('password', $pass);
|
||||
}
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Add vboxusers default virtualbox user group into our DB to protect it, if it isn't there
|
||||
# Create both the default vboxweb-service runtime user (vbox), if it isn't already there
|
||||
# Set/reset the vbox users password to a random one and store in the configuration database
|
||||
#
|
||||
|
||||
# Add the default vboxusers group to our config DB, if it's not already there (so we can't mess with it)
|
||||
if /sbin/e-smith/db accounts get vboxusers >/dev/null
|
||||
then
|
||||
echo "the vboxusers group already exists - we'll use this"
|
||||
else
|
||||
/sbin/e-smith/db accounts set vboxusers system Description "VBox users"
|
||||
/usr/sbin/usermod -a -G vboxusers admin >/dev/null
|
||||
fi
|
||||
|
||||
# Create the default vboxweb-service runtime user account (vbox), if it doesn't exist and add to vboxusers group
|
||||
if /sbin/e-smith/db accounts get vbox >/dev/null
|
||||
then
|
||||
echo "the vbox user already exists - we'll use this"
|
||||
else
|
||||
/sbin/e-smith/db accounts set vbox system Description "VBoxWeb runtime user" PasswordSet yes
|
||||
/usr/sbin/usermod -a -G vboxusers vbox >/dev/null
|
||||
fi
|
||||
|
||||
# Set/reset the vbox user password to a random one and store in the configuraion database
|
||||
if /sbin/e-smith/db configuration getprop vboxweb-service password >/dev/null
|
||||
then
|
||||
echo "we'll use the existing vbox user password"
|
||||
password="$(/sbin/e-smith/db configuration getprop vboxweb-service password)"
|
||||
else
|
||||
password="$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 32)"
|
||||
/sbin/e-smith/config setprop vboxweb-service password $password
|
||||
fi
|
||||
/usr/bin/echo $password | /usr/bin/passwd --stdin vbox
|
18
root/etc/e-smith/events/actions/vbox_install_extension_pack
Normal file
18
root/etc/e-smith/events/actions/vbox_install_extension_pack
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Download and install the Oracle VM VirtualBox Extension Pack for the currently installed version of virtualbox
|
||||
|
||||
vboxver=$(/usr/bin/vboxmanage --version)
|
||||
vboxver="${vboxver%r*}"
|
||||
extver=$(/usr/bin/vboxmanage list extpacks | grep Version)
|
||||
extver="${extver#*:}"
|
||||
extver="${extver#"${extver%%[![:space:]]*}"}"
|
||||
|
||||
if [ "$extver" == "$vboxver" ]
|
||||
then
|
||||
echo "Version: $extver Extension Pack already installed"
|
||||
else
|
||||
/usr/bin/cd /tmp
|
||||
/usr/bin/wget https://download.virtualbox.org/virtualbox/$vboxver/Oracle_VM_VirtualBox_Extension_Pack-$vboxver.vbox-extpack
|
||||
/usr/bin/vboxmanage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-$vboxver.vbox-extpack --accept-license=56be48f923303c8cababb0bb4c478284b688ed23f16d775d729b89a2e8e5f9eb
|
||||
fi
|
14
root/etc/e-smith/templates/etc/default/virtualbox/virtualbox
Normal file
14
root/etc/e-smith/templates/etc/default/virtualbox/virtualbox
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
$vboxwebuser = (${'vboxweb-service'}{'user'} || 'vbox');
|
||||
$vboxwebaccess = (${'vboxweb-service'}{'access'} || 127.0.0.1);
|
||||
$vboxwebTCPPort = (${'vboxweb-service'}{'TCPPort'} || 18083);
|
||||
|
||||
$OUT .=<<_VBOX
|
||||
VBOXWEB_USER=$vboxwebuser
|
||||
VBOXWEB_HOST=$vboxwebaccess
|
||||
VBOXWEB_PORT=$vboxwebTCPPort
|
||||
VBOXWEB_LOGFILE=/var/log/virtualbox/vboxweb.log
|
||||
INSTALL_DIR=/usr/lib/virtualbox
|
||||
_VBOX
|
||||
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
{
|
||||
$DB->hosts_allow_spec('vboxweb-service');
|
||||
}
|
@@ -0,0 +1,2 @@
|
||||
[Service]
|
||||
ExecStartPre=/usr/lib/virtualbox/fix_vboxdrv_kernel_module.sh
|
@@ -0,0 +1,2 @@
|
||||
[Install]
|
||||
WantedBy=sme-server.target
|
@@ -0,0 +1,2 @@
|
||||
[Install]
|
||||
WantedBy=sme-server.target
|
0
root/usr/lib/systemd/system/vboxdrv.service.d/.gitignore
vendored
Normal file
0
root/usr/lib/systemd/system/vboxdrv.service.d/.gitignore
vendored
Normal file
9
root/usr/lib/virtualbox/fix_vboxdrv_kernel_module.sh
Executable file
9
root/usr/lib/virtualbox/fix_vboxdrv_kernel_module.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
##script to compile vboxdrv kernel module if needed by virtualbox
|
||||
##stephane de Labrusse <stephdl@de-labrusse.fr>
|
||||
rkernel=`uname -r`
|
||||
vmxnet="/lib/modules/`uname -r`/misc/vboxdrv.ko"
|
||||
if [ ! -e $vmxnet ]; then
|
||||
/usr/lib/virtualbox/vboxdrv.sh setup;
|
||||
fi
|
||||
|
Reference in New Issue
Block a user