1 |
trevorb |
1.1 |
diff -urN smeserver-virtualbox-5.2.old/createlinks smeserver-virtualbox-5.2/createlinks |
2 |
|
|
--- smeserver-virtualbox-5.2.old/createlinks 2023-03-10 11:15:53.798426000 +1100 |
3 |
|
|
+++ smeserver-virtualbox-5.2/createlinks 2023-03-10 11:19:38.356649000 +1100 |
4 |
|
|
@@ -9,13 +9,20 @@ |
5 |
|
|
#see the /etc/systemd/system-preset/49-koozali.preset should be present for systemd integration on all you yum update event |
6 |
|
|
|
7 |
|
|
foreach my $file (qw( |
8 |
|
|
- /etc/dar/DailyBackup.dcf |
9 |
|
|
- /etc/systemd/system-preset/49-koozali.preset |
10 |
|
|
- /usr/lib/systemd/system/vboxdrv.service.d/50koozali.conf |
11 |
|
|
+ /etc/default/virtualbox |
12 |
|
|
+ /etc/dar/DailyBackup.dcf |
13 |
|
|
+ /etc/systemd/system-preset/49-koozali.preset |
14 |
|
|
+ /usr/lib/systemd/system/vboxdrv.service.d/50koozali.conf |
15 |
|
|
+ /usr/lib/systemd/system/vboxweb-service.service.d/50koozali.conf |
16 |
|
|
)) |
17 |
|
|
{ |
18 |
|
|
templates2events( $file, $event ); |
19 |
|
|
}; |
20 |
|
|
+#create vboxweb runtime user (vbox) and set/reset password |
21 |
|
|
+#create default vboxusers group, if it doesn't exist |
22 |
|
|
+event_link('vbox_create_vboxweb_runtime_user', $event, '04'); |
23 |
|
|
+#install/re-install extension pack on any update |
24 |
|
|
+event_link('vbox_install_extension_pack', $event, '04'); |
25 |
|
|
#action needed in case we have a systemd unit |
26 |
|
|
event_link('systemd-default', $event, '10'); |
27 |
|
|
event_link('systemd-reload', $event, '50'); |
28 |
|
|
diff -urN smeserver-virtualbox-5.2.old/README.md smeserver-virtualbox-5.2/README.md |
29 |
|
|
--- smeserver-virtualbox-5.2.old/README.md 2015-08-27 07:29:14.000000000 +1000 |
30 |
|
|
+++ smeserver-virtualbox-5.2/README.md 2023-02-27 11:23:34.000000000 +1100 |
31 |
|
|
@@ -1,2 +1,3 @@ |
32 |
|
|
smeserver-virtualbox |
33 |
|
|
==================== |
34 |
|
|
+smserver wrapper rpm to install and run VirtualBox-5.2 |
35 |
|
|
\ No newline at end of file |
36 |
|
|
diff -urN smeserver-virtualbox-5.2.old/root/etc/default/virtualbox smeserver-virtualbox-5.2/root/etc/default/virtualbox |
37 |
|
|
--- smeserver-virtualbox-5.2.old/root/etc/default/virtualbox 2023-03-10 11:15:53.798426000 +1100 |
38 |
|
|
+++ smeserver-virtualbox-5.2/root/etc/default/virtualbox 1970-01-01 10:00:00.000000000 +1000 |
39 |
|
|
@@ -1,5 +0,0 @@ |
40 |
|
|
-VBOXWEB_USER='vbox' |
41 |
|
|
-VBOXWEB_HOST=127.0.0.1 |
42 |
|
|
-VBOXWEB_PORT=18083 |
43 |
|
|
-VBOXWEB_LOGFILE=/home/vbox/vboxweb.log |
44 |
|
|
-INSTALL_DIR=/usr/lib/virtualbox |
45 |
|
|
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 |
46 |
|
|
--- smeserver-virtualbox-5.2.old/root/etc/e-smith/db/configuration/defaults/vboxweb-service/user 1970-01-01 10:00:00.000000000 +1000 |
47 |
|
|
+++ smeserver-virtualbox-5.2/root/etc/e-smith/db/configuration/defaults/vboxweb-service/user 2023-02-27 11:23:34.000000000 +1100 |
48 |
|
|
@@ -0,0 +1 @@ |
49 |
|
|
+vbox |
50 |
|
|
\ No newline at end of file |
51 |
|
|
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 |
52 |
|
|
--- smeserver-virtualbox-5.2.old/root/etc/e-smith/db/configuration/migrate/virtualbox 1970-01-01 10:00:00.000000000 +1000 |
53 |
|
|
+++ smeserver-virtualbox-5.2/root/etc/e-smith/db/configuration/migrate/virtualbox 2023-03-01 16:15:14.000000000 +1100 |
54 |
|
|
@@ -0,0 +1,8 @@ |
55 |
|
|
+{ |
56 |
|
|
+ my $rec = $DB->get('vboxweb-service') || $DB->new_record('vboxweb-service', {type => 'service'}); |
57 |
|
|
+ if (not exists $rec{'password'}) { |
58 |
|
|
+ my @allowed = ('a'..'z', 'A'..'Z', 0..9); |
59 |
|
|
+ my $pass = join '', map $allowed[rand @allowed], 0..32; |
60 |
|
|
+ my $updateconfig = $rec->set_prop('password', $pass); |
61 |
|
|
+ } |
62 |
|
|
+} |
63 |
|
|
\ No newline at end of file |
64 |
|
|
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 |
65 |
|
|
--- smeserver-virtualbox-5.2.old/root/etc/e-smith/events/actions/vbox_create_vboxweb_runtime_user 1970-01-01 10:00:00.000000000 +1000 |
66 |
|
|
+++ smeserver-virtualbox-5.2/root/etc/e-smith/events/actions/vbox_create_vboxweb_runtime_user 2023-03-06 11:37:07.000000000 +1100 |
67 |
|
|
@@ -0,0 +1,35 @@ |
68 |
|
|
+#!/bin/bash |
69 |
|
|
+# |
70 |
|
|
+# Add vboxusers default virtualbox user group into our DB to protect it, if it isn't there |
71 |
|
|
+# Create both the default vboxweb-service runtime user (vbox), if it isn't already there |
72 |
|
|
+# Set/reset the vbox users password to a random one and store in the configuration database |
73 |
|
|
+# |
74 |
|
|
+ |
75 |
|
|
+ # Add the default vboxusers group to our config DB, if it's not already there (so we can't mess with it) |
76 |
|
|
+ if /sbin/e-smith/db accounts get vboxusers >/dev/null |
77 |
|
|
+ then |
78 |
|
|
+ echo "the vboxusers group already exists - we'll use this" |
79 |
|
|
+ else |
80 |
|
|
+ /sbin/e-smith/db accounts set vboxusers system Description "VBox users" |
81 |
|
|
+ /usr/sbin/usermod -a -G vboxusers admin >/dev/null |
82 |
|
|
+ fi |
83 |
|
|
+ |
84 |
|
|
+ # Create the default vboxweb-service runtime user account (vbox), if it doesn't exist and add to vboxusers group |
85 |
|
|
+ if /sbin/e-smith/db accounts get vbox >/dev/null |
86 |
|
|
+ then |
87 |
|
|
+ echo "the vbox user already exists - we'll use this" |
88 |
|
|
+ else |
89 |
|
|
+ /sbin/e-smith/db accounts set vbox system Description "VBoxWeb runtime user" PasswordSet yes |
90 |
|
|
+ /usr/sbin/usermod -a -G vboxusers vbox >/dev/null |
91 |
|
|
+ fi |
92 |
|
|
+ |
93 |
|
|
+ # Set/reset the vbox user password to a random one and store in the configuraion database |
94 |
|
|
+ if /sbin/e-smith/db configuration getprop vboxweb-service password >/dev/null |
95 |
|
|
+ then |
96 |
|
|
+ echo "we'll use the existing vbox user password" |
97 |
|
|
+ password="$(/sbin/e-smith/db configuration getprop vboxweb-service password)" |
98 |
|
|
+ else |
99 |
|
|
+ password="$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 32)" |
100 |
|
|
+ /sbin/e-smith/config setprop vboxweb-service password $password |
101 |
|
|
+ fi |
102 |
|
|
+ /usr/bin/echo $password | /usr/bin/passwd --stdin vbox |
103 |
|
|
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 |
104 |
|
|
--- smeserver-virtualbox-5.2.old/root/etc/e-smith/events/actions/vbox_install_extension_pack 1970-01-01 10:00:00.000000000 +1000 |
105 |
|
|
+++ smeserver-virtualbox-5.2/root/etc/e-smith/events/actions/vbox_install_extension_pack 2023-02-28 17:04:34.000000000 +1100 |
106 |
|
|
@@ -0,0 +1,18 @@ |
107 |
|
|
+#!/usr/bin/bash |
108 |
|
|
+ |
109 |
|
|
+# Download and install the Oracle VM VirtualBox Extension Pack for the currently installed version of virtualbox |
110 |
|
|
+ |
111 |
|
|
+vboxver=$(/usr/bin/vboxmanage --version) |
112 |
|
|
+vboxver="${vboxver%r*}" |
113 |
|
|
+extver=$(/usr/bin/vboxmanage list extpacks | grep Version) |
114 |
|
|
+extver="${extver#*:}" |
115 |
|
|
+extver="${extver#"${extver%%[![:space:]]*}"}" |
116 |
|
|
+ |
117 |
|
|
+if [ "$extver" == "$vboxver" ] |
118 |
|
|
+then |
119 |
|
|
+ echo "Version: $extver Extension Pack already installed" |
120 |
|
|
+else |
121 |
|
|
+ /usr/bin/cd /tmp |
122 |
|
|
+ /usr/bin/wget https://download.virtualbox.org/virtualbox/$vboxver/Oracle_VM_VirtualBox_Extension_Pack-$vboxver.vbox-extpack |
123 |
|
|
+ /usr/bin/vboxmanage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-$vboxver.vbox-extpack --accept-license=56be48f923303c8cababb0bb4c478284b688ed23f16d775d729b89a2e8e5f9eb |
124 |
|
|
+fi |
125 |
|
|
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 |
126 |
|
|
--- smeserver-virtualbox-5.2.old/root/etc/e-smith/templates/etc/default/virtualbox/virtualbox 1970-01-01 10:00:00.000000000 +1000 |
127 |
|
|
+++ smeserver-virtualbox-5.2/root/etc/e-smith/templates/etc/default/virtualbox/virtualbox 2023-03-07 12:34:02.000000000 +1100 |
128 |
|
|
@@ -0,0 +1,14 @@ |
129 |
|
|
+{ |
130 |
|
|
+ $vboxwebuser = (${'vboxweb-service'}{'user'} || 'vbox'); |
131 |
|
|
+ $vboxwebaccess = (${'vboxweb-service'}{'access'} || 127.0.0.1); |
132 |
|
|
+ $vboxwebTCPPort = (${'vboxweb-service'}{'TCPPort'} || 18083); |
133 |
|
|
+ |
134 |
|
|
+ $OUT .=<<_VBOX |
135 |
|
|
+VBOXWEB_USER=$vboxwebuser |
136 |
|
|
+VBOXWEB_HOST=$vboxwebaccess |
137 |
|
|
+VBOXWEB_PORT=$vboxwebTCPPort |
138 |
|
|
+VBOXWEB_LOGFILE=/var/log/virtualbox/vboxweb.log |
139 |
|
|
+INSTALL_DIR=/usr/lib/virtualbox |
140 |
|
|
+_VBOX |
141 |
|
|
+ |
142 |
|
|
+} |
143 |
|
|
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 |
144 |
|
|
--- 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 |
145 |
|
|
+++ 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 |
146 |
|
|
@@ -0,0 +1,2 @@ |
147 |
|
|
+[Install] |
148 |
|
|
+WantedBy=sme-server.target |