Ori.livneh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/86287
Change subject: update-guest-additions: allow version to be specified as
command-line argument
......................................................................
update-guest-additions: allow version to be specified as command-line argument
As a fallback to automatic host VirtualBox version detection, we should allow
the user to specify the version as a command-line argument to
'update-guest-additions'. This patch implements this functionality. The
argument is '--virtualbox-version'.
Change-Id: I3b4a4f6c422364a0d903d2a2b1379719c7ed0e43
---
M puppet/modules/virtualbox/files/update-guest-additions
1 file changed, 18 insertions(+), 12 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vagrant
refs/changes/87/86287/1
diff --git a/puppet/modules/virtualbox/files/update-guest-additions
b/puppet/modules/virtualbox/files/update-guest-additions
index 5b3980c..7909750 100755
--- a/puppet/modules/virtualbox/files/update-guest-additions
+++ b/puppet/modules/virtualbox/files/update-guest-additions
@@ -17,11 +17,6 @@
printf "$(tput setaf 4)%s$(tput sgr0)\n" "$1"
}
-[[ ! -r "/etc/virtualbox-version" ]] && {
- warn 'Cannot determine host VirtualBox version.'
- exit 1
-}
-
# Re-run under 'sudo' if not invoked with 'sudo'.
[[ ! $SUDO_COMMAND ]] && {
@@ -29,19 +24,30 @@
exit $?
}
-VIRTUALBOX_VERSION="$(</etc/virtualbox-version)"
+# Allow VirtualBox version to be specified via '--virtualbox-version'
+# command-line argument:
+[[ "$*" =~ --virtualbox-version.([0-9][0-9.]+) ]] && {
+ VIRTUALBOX_VERSION="${BASH_REMATCH[1]}"
+}
+
+# If the version was not specified as a command-line argument, try to
+# read it from /etc/virtualbox-version:
+[[ ! $VIRTUALBOX_VERSION && -r "/etc/virtualbox-version" ]] && {
+ VIRTUALBOX_VERSION="$(</etc/virtualbox-version)"
+}
+
+[[ ! $VIRTUALBOX_VERSION ]] && {
+ warn 'Cannot determine host VirtualBox version! You can specify it using
--virtualbox-version.'
+ exit 1
+}
+
BASE_URL="http://download.virtualbox.org/virtualbox/${VIRTUALBOX_VERSION}"
GUEST_ADDITIONS_ISO="VBoxGuestAdditions_${VIRTUALBOX_VERSION}.iso"
GUEST_ADDITIONS_VERSION="$(modinfo -Fversion vboxguest)"
# Check if Guest additions need to be updated.
-[[ ! $VIRTUALBOX_VERSION ]] && {
- warn 'Cannot determine host VirtualBox version.'
- exit 1
-}
-
-[[ $GUEST_ADDITIONS_VERSION == "$VIRTUALBOX_VERSION" && $1 != "--force" ]] && {
+[[ $GUEST_ADDITIONS_VERSION == "$VIRTUALBOX_VERSION" && ! "$*" =~ --force ]]
&& {
notice 'Guest additions already up-to-date.' >&2
exit 0
}
--
To view, visit https://gerrit.wikimedia.org/r/86287
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b4a4f6c422364a0d903d2a2b1379719c7ed0e43
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits