initial commit of file from CVS for smeserver-virtualbox on Sat Sep 7 21:14:17 AEST 2024

This commit is contained in:
Trevor Batley
2024-09-07 21:14:17 +10:00
parent b69cbf6dc9
commit d2de291fe3
26 changed files with 973 additions and 2 deletions

View File

@@ -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

View 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