emulators/virtualbox-ose*: Improve rc script

- Add sort VMs by name during auto start and reverse sort during stop -
  with this user can control the order in which VMs are started and stopped.
- Increase default delay between start VMs from 0 to 1 second -
  useful when automatically starting more than "2-3" VMs.
This commit is contained in:
Vladimir Druzenko
2025-06-21 23:23:38 +03:00
parent 97c4312ebc
commit 5ab3be27e7
12 changed files with 20 additions and 20 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
PORTNAME= virtualbox-ose
DISTVERSION= 7.0.26
PORTREVISION?= 2
PORTREVISION?= 3
CATEGORIES= emulators
MASTER_SITES= https://download.virtualbox.org/virtualbox/${DISTVERSION}/:src \
LOCAL/vvd:docs
@@ -37,7 +37,7 @@ restart_cmd="${name}_restart"
vboxinit_start()
{
# Get a list of all machines with autorun enabled in phpvirtualbox
${su_command} "${command} list vms | /usr/bin/tr -d '{}\"'" | while read VMNAME UUID; do
${su_command} "${command} list vms | /usr/bin/tr -d '{}\"'" | /usr/bin/sort | while read VMNAME UUID; do
STARTUP=$(${su_command} "${command} getextradata ${UUID} 'pvbx/startupMode'" | /usr/bin/cut -d' ' -f2)
if [ "${STARTUP}" == "auto" ]; then
echo "${name}: starting machine ${VMNAME} ..."
@@ -50,7 +50,7 @@ vboxinit_start()
vboxinit_stop()
{
# Get all running machines
${su_command} "${command} list runningvms | /usr/bin/tr -d '{}\"'" | while read VMNAME UUID; do
${su_command} "${command} list runningvms | /usr/bin/tr -d '{}\"'" | /usr/bin/sort -r | while read VMNAME UUID; do
echo "${name}: stopping machine ${VMNAME} with action '${vboxinit_stop}' ..."
${su_command} "${command} controlvm ${UUID} ${vboxinit_stop}"
sleep "${vboxinit_stop_delay}"
@@ -75,7 +75,7 @@ load_rc_config $name
: ${vboxinit_user="%%VBOXUSER%%"}
: ${vboxinit_home=$(/usr/sbin/pw usershow -7 -n "${vboxinit_user}" | /usr/bin/cut -d: -f6)}
: ${vboxinit_stop="savestate"}
: ${vboxinit_start_delay="0"}
: ${vboxinit_start_delay="1"}
: ${vboxinit_stop_delay="0"}
HOME=${vboxinit_home}
USER=${vboxinit_user}
+1 -1
View File
@@ -1,6 +1,6 @@
PORTNAME= virtualbox-ose
DISTVERSION= 7.1.10
PORTREVISION?= 0
PORTREVISION?= 1
CATEGORIES= emulators
MASTER_SITES= https://download.virtualbox.org/virtualbox/${DISTVERSION}/:src \
LOCAL/vvd:docs
@@ -37,7 +37,7 @@ restart_cmd="${name}_restart"
vboxinit_start()
{
# Get a list of all machines with autorun enabled in phpvirtualbox
${su_command} "${command} list vms | /usr/bin/tr -d '{}\"'" | while read VMNAME UUID; do
${su_command} "${command} list vms | /usr/bin/tr -d '{}\"'" | /usr/bin/sort | while read VMNAME UUID; do
STARTUP=$(${su_command} "${command} getextradata ${UUID} 'pvbx/startupMode'" | /usr/bin/cut -d' ' -f2)
if [ "${STARTUP}" == "auto" ]; then
echo "${name}: starting machine ${VMNAME} ..."
@@ -50,7 +50,7 @@ vboxinit_start()
vboxinit_stop()
{
# Get all running machines
${su_command} "${command} list runningvms | /usr/bin/tr -d '{}\"'" | while read VMNAME UUID; do
${su_command} "${command} list runningvms | /usr/bin/tr -d '{}\"'" | /usr/bin/sort -r | while read VMNAME UUID; do
echo "${name}: stopping machine ${VMNAME} with action '${vboxinit_stop}' ..."
${su_command} "${command} controlvm ${UUID} ${vboxinit_stop}"
sleep "${vboxinit_stop_delay}"
@@ -75,7 +75,7 @@ load_rc_config $name
: ${vboxinit_user="%%VBOXUSER%%"}
: ${vboxinit_home=$(/usr/sbin/pw usershow -7 -n "${vboxinit_user}" | /usr/bin/cut -d: -f6)}
: ${vboxinit_stop="savestate"}
: ${vboxinit_start_delay="0"}
: ${vboxinit_start_delay="1"}
: ${vboxinit_stop_delay="0"}
HOME=${vboxinit_home}
USER=${vboxinit_user}
+1 -1
View File
@@ -1,6 +1,6 @@
PORTNAME= virtualbox-ose
DISTVERSION= 5.2.44
PORTREVISION?= 31
PORTREVISION?= 32
CATEGORIES= emulators
MASTER_SITES= https://download.virtualbox.org/virtualbox/${DISTVERSION}/:src \
LOCAL/bofh/emulators/virtualbox-ose-legacy:docs
@@ -37,7 +37,7 @@ restart_cmd="${name}_restart"
vboxinit_start()
{
# Get a list of all machines with autorun enabled in phpvirtualbox
${su_command} "${command} list vms | /usr/bin/tr -d '{}\"'" | while read VMNAME UUID; do
${su_command} "${command} list vms | /usr/bin/tr -d '{}\"'" | /usr/bin/sort | while read VMNAME UUID; do
STARTUP=$(${su_command} "${command} getextradata ${UUID} 'pvbx/startupMode'" | /usr/bin/cut -d' ' -f2)
if [ "${STARTUP}" == "auto" ]; then
echo "${name}: starting machine ${VMNAME} ..."
@@ -50,7 +50,7 @@ vboxinit_start()
vboxinit_stop()
{
# Get all running machines
${su_command} "${command} list runningvms | /usr/bin/tr -d '{}\"'" | while read VMNAME UUID; do
${su_command} "${command} list runningvms | /usr/bin/tr -d '{}\"'" | /usr/bin/sort -r | while read VMNAME UUID; do
echo "${name}: stopping machine ${VMNAME} with action '${vboxinit_stop}' ..."
${su_command} "${command} controlvm ${UUID} ${vboxinit_stop}"
sleep "${vboxinit_stop_delay}"
@@ -75,7 +75,7 @@ load_rc_config $name
: ${vboxinit_user="%%VBOXUSER%%"}
: ${vboxinit_home=$(/usr/sbin/pw usershow -7 -n "${vboxinit_user}" | /usr/bin/cut -d: -f6)}
: ${vboxinit_stop="savestate"}
: ${vboxinit_start_delay="0"}
: ${vboxinit_start_delay="1"}
: ${vboxinit_stop_delay="0"}
HOME=${vboxinit_home}
USER=${vboxinit_user}
+1 -1
View File
@@ -1,4 +1,4 @@
PORTREVISION= 2
PORTREVISION= 3
PKGNAMESUFFIX= -nox11-70
MASTERDIR= ${.CURDIR}/../virtualbox-ose-70
+1 -1
View File
@@ -1,4 +1,4 @@
PORTREVISION= 0
PORTREVISION= 1
PKGNAMESUFFIX= -nox11-71
MASTERDIR= ${.CURDIR}/../virtualbox-ose-71
@@ -1,4 +1,4 @@
PORTREVISION= 27
PORTREVISION= 32
PKGNAMESUFFIX= -nox11-legacy
MASTERDIR= ${.CURDIR}/../virtualbox-ose-legacy
+1 -1
View File
@@ -1,4 +1,4 @@
PORTREVISION= 14
PORTREVISION= 15
PKGNAMESUFFIX= -nox11
MASTERDIR= ${.CURDIR}/../virtualbox-ose
+1 -1
View File
@@ -1,6 +1,6 @@
PORTNAME= virtualbox-ose
DISTVERSION= 6.1.50
PORTREVISION?= 14
PORTREVISION?= 15
CATEGORIES= emulators
MASTER_SITES= https://download.virtualbox.org/virtualbox/${DISTVERSION}/:src \
LOCAL/bofh/emulators/virtualbox-ose:docs
+3 -3
View File
@@ -37,7 +37,7 @@ restart_cmd="${name}_restart"
vboxinit_start()
{
# Get a list of all machines with autorun enabled in phpvirtualbox
${su_command} "${command} list vms | /usr/bin/tr -d '{}\"'" | while read VMNAME UUID; do
${su_command} "${command} list vms | /usr/bin/tr -d '{}\"'" | /usr/bin/sort | while read VMNAME UUID; do
STARTUP=$(${su_command} "${command} getextradata ${UUID} 'pvbx/startupMode'" | /usr/bin/cut -d' ' -f2)
if [ "${STARTUP}" == "auto" ]; then
echo "${name}: starting machine ${VMNAME} ..."
@@ -50,7 +50,7 @@ vboxinit_start()
vboxinit_stop()
{
# Get all running machines
${su_command} "${command} list runningvms | /usr/bin/tr -d '{}\"'" | while read VMNAME UUID; do
${su_command} "${command} list runningvms | /usr/bin/tr -d '{}\"'" | /usr/bin/sort -r | while read VMNAME UUID; do
echo "${name}: stopping machine ${VMNAME} with action '${vboxinit_stop}' ..."
${su_command} "${command} controlvm ${UUID} ${vboxinit_stop}"
sleep "${vboxinit_stop_delay}"
@@ -75,7 +75,7 @@ load_rc_config $name
: ${vboxinit_user="%%VBOXUSER%%"}
: ${vboxinit_home=$(/usr/sbin/pw usershow -7 -n "${vboxinit_user}" | /usr/bin/cut -d: -f6)}
: ${vboxinit_stop="savestate"}
: ${vboxinit_start_delay="0"}
: ${vboxinit_start_delay="1"}
: ${vboxinit_stop_delay="0"}
HOME=${vboxinit_home}
USER=${vboxinit_user}