149 lines
8.1 KiB
Diff
149 lines
8.1 KiB
Diff
|
diff -urN smeserver-virtualbox-5.2.old/createlinks smeserver-virtualbox-5.2/createlinks
|
||
|
--- smeserver-virtualbox-5.2.old/createlinks 2023-03-10 11:15:53.798426000 +1100
|
||
|
+++ smeserver-virtualbox-5.2/createlinks 2023-03-10 11:19:38.356649000 +1100
|
||
|
@@ -9,13 +9,20 @@
|
||
|
#see the /etc/systemd/system-preset/49-koozali.preset should be present for systemd integration on all you yum update event
|
||
|
|
||
|
foreach my $file (qw(
|
||
|
- /etc/dar/DailyBackup.dcf
|
||
|
- /etc/systemd/system-preset/49-koozali.preset
|
||
|
- /usr/lib/systemd/system/vboxdrv.service.d/50koozali.conf
|
||
|
+ /etc/default/virtualbox
|
||
|
+ /etc/dar/DailyBackup.dcf
|
||
|
+ /etc/systemd/system-preset/49-koozali.preset
|
||
|
+ /usr/lib/systemd/system/vboxdrv.service.d/50koozali.conf
|
||
|
+ /usr/lib/systemd/system/vboxweb-service.service.d/50koozali.conf
|
||
|
))
|
||
|
{
|
||
|
templates2events( $file, $event );
|
||
|
};
|
||
|
+#create vboxweb runtime user (vbox) and set/reset password
|
||
|
+#create default vboxusers group, if it doesn't exist
|
||
|
+event_link('vbox_create_vboxweb_runtime_user', $event, '04');
|
||
|
+#install/re-install extension pack on any update
|
||
|
+event_link('vbox_install_extension_pack', $event, '04');
|
||
|
#action needed in case we have a systemd unit
|
||
|
event_link('systemd-default', $event, '10');
|
||
|
event_link('systemd-reload', $event, '50');
|
||
|
diff -urN smeserver-virtualbox-5.2.old/README.md smeserver-virtualbox-5.2/README.md
|
||
|
--- smeserver-virtualbox-5.2.old/README.md 2015-08-27 07:29:14.000000000 +1000
|
||
|
+++ smeserver-virtualbox-5.2/README.md 2023-02-27 11:23:34.000000000 +1100
|
||
|
@@ -1,2 +1,3 @@
|
||
|
smeserver-virtualbox
|
||
|
====================
|
||
|
+smserver wrapper rpm to install and run VirtualBox-5.2
|
||
|
\ No newline at end of file
|
||
|
diff -urN smeserver-virtualbox-5.2.old/root/etc/default/virtualbox smeserver-virtualbox-5.2/root/etc/default/virtualbox
|
||
|
--- smeserver-virtualbox-5.2.old/root/etc/default/virtualbox 2023-03-10 11:15:53.798426000 +1100
|
||
|
+++ smeserver-virtualbox-5.2/root/etc/default/virtualbox 1970-01-01 10:00:00.000000000 +1000
|
||
|
@@ -1,5 +0,0 @@
|
||
|
-VBOXWEB_USER='vbox'
|
||
|
-VBOXWEB_HOST=127.0.0.1
|
||
|
-VBOXWEB_PORT=18083
|
||
|
-VBOXWEB_LOGFILE=/home/vbox/vboxweb.log
|
||
|
-INSTALL_DIR=/usr/lib/virtualbox
|
||
|
diff -urN smeserver-virtualbox-5.2.old/root/etc/e-smith/db/configuration/defaults/vboxweb-service/user smeserver-virtualbox-5.2/root/etc/e-smith/db/configuration/defaults/vboxweb-service/user
|
||
|
--- smeserver-virtualbox-5.2.old/root/etc/e-smith/db/configuration/defaults/vboxweb-service/user 1970-01-01 10:00:00.000000000 +1000
|
||
|
+++ smeserver-virtualbox-5.2/root/etc/e-smith/db/configuration/defaults/vboxweb-service/user 2023-02-27 11:23:34.000000000 +1100
|
||
|
@@ -0,0 +1 @@
|
||
|
+vbox
|
||
|
\ No newline at end of file
|
||
|
diff -urN smeserver-virtualbox-5.2.old/root/etc/e-smith/db/configuration/migrate/virtualbox smeserver-virtualbox-5.2/root/etc/e-smith/db/configuration/migrate/virtualbox
|
||
|
--- smeserver-virtualbox-5.2.old/root/etc/e-smith/db/configuration/migrate/virtualbox 1970-01-01 10:00:00.000000000 +1000
|
||
|
+++ smeserver-virtualbox-5.2/root/etc/e-smith/db/configuration/migrate/virtualbox 2023-03-01 16:15:14.000000000 +1100
|
||
|
@@ -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);
|
||
|
+ }
|
||
|
+}
|
||
|
\ No newline at end of file
|
||
|
diff -urN smeserver-virtualbox-5.2.old/root/etc/e-smith/events/actions/vbox_create_vboxweb_runtime_user smeserver-virtualbox-5.2/root/etc/e-smith/events/actions/vbox_create_vboxweb_runtime_user
|
||
|
--- smeserver-virtualbox-5.2.old/root/etc/e-smith/events/actions/vbox_create_vboxweb_runtime_user 1970-01-01 10:00:00.000000000 +1000
|
||
|
+++ smeserver-virtualbox-5.2/root/etc/e-smith/events/actions/vbox_create_vboxweb_runtime_user 2023-03-06 11:37:07.000000000 +1100
|
||
|
@@ -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
|
||
|
diff -urN smeserver-virtualbox-5.2.old/root/etc/e-smith/events/actions/vbox_install_extension_pack smeserver-virtualbox-5.2/root/etc/e-smith/events/actions/vbox_install_extension_pack
|
||
|
--- smeserver-virtualbox-5.2.old/root/etc/e-smith/events/actions/vbox_install_extension_pack 1970-01-01 10:00:00.000000000 +1000
|
||
|
+++ smeserver-virtualbox-5.2/root/etc/e-smith/events/actions/vbox_install_extension_pack 2023-02-28 17:04:34.000000000 +1100
|
||
|
@@ -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
|
||
|
diff -urN smeserver-virtualbox-5.2.old/root/etc/e-smith/templates/etc/default/virtualbox/virtualbox smeserver-virtualbox-5.2/root/etc/e-smith/templates/etc/default/virtualbox/virtualbox
|
||
|
--- smeserver-virtualbox-5.2.old/root/etc/e-smith/templates/etc/default/virtualbox/virtualbox 1970-01-01 10:00:00.000000000 +1000
|
||
|
+++ smeserver-virtualbox-5.2/root/etc/e-smith/templates/etc/default/virtualbox/virtualbox 2023-03-07 12:34:02.000000000 +1100
|
||
|
@@ -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
|
||
|
+
|
||
|
+}
|
||
|
diff -urN smeserver-virtualbox-5.2.old/root/etc/e-smith/templates/usr/lib/systemd/system/vboxweb-service.service.d/50koozali.conf smeserver-virtualbox-5.2/root/etc/e-smith/templates/usr/lib/systemd/system/vboxweb-service.service.d/50koozali.conf
|
||
|
--- smeserver-virtualbox-5.2.old/root/etc/e-smith/templates/usr/lib/systemd/system/vboxweb-service.service.d/50koozali.conf 1970-01-01 10:00:00.000000000 +1000
|
||
|
+++ smeserver-virtualbox-5.2/root/etc/e-smith/templates/usr/lib/systemd/system/vboxweb-service.service.d/50koozali.conf 2023-03-10 11:18:24.874926503 +1100
|
||
|
@@ -0,0 +1,2 @@
|
||
|
+[Install]
|
||
|
+WantedBy=sme-server.target
|