]> ###2017.05.19e - Fixed extension pack install failure due to license agreement acceptance prompt - finally got it working :) ###2017.05.19d - Fixed extension pack install failure due to license agreement acceptance prompt using different approach (license number) ###2017.05.19c - Fixed extension pack install failure due to license agreement acceptance prompt ###2015.09.18 - Fixed online package lookup ###2015.09.17 - Added unRAID 6.1 compatibility and keep backward compatibility ###2015.06.07 - Changed start and stop events to "started" and "stopping_svcs" instead of "disks_mounted" and "unmounting_disks" - Moved plugin icon to "User Utilities" section (unRAID v6) ###2015.06.05 - Added launch option from plugin manager (unRAID v6) - Changed package version to same as plugin version - Fixed - Inadvertently Cleared vboxwebsrv settings - Returned onsubmit="validateForm();" to form submission ###2015.04.22-1 - Fixed unRAID v5 compatibility ###2015.04.22 - Added newline between each log line during install/remove scripts - Added settings page icon - Changed package so that it extracts directly to all needed folders (/etc/rc.d, /usr/local/emhttp/plugins/virtualbox) - Add version to PAGE file automatically so it and package don't need to be modified on every change ###2015.04.21-1 - Fixed unRAID v5 compatibility ###2015.04.21 - Added support for unRAID v6 Plugin Manager and Architecture - Added support for tgz and txz compiled packages ###0.5.7 - Reduced plugin load time by reducing network accessing when checking online versions ### 0.5.6 - Added MD5 checksum verification for all downloaded packages immediately after download - delete download if MD5 cannot be verified or fails verification ### 0.5.5 - Fixed kernel version number extraction from online package ### 0.5.4 - Changed unRAID compiled VirtualBox version availability and presentation in WEBUI (compatible and latest) - Changed timeout to 10 seconds (instead of 60) - Added plugin forum link to WEBUI - Automatic support of 32/64bit packages depending on OS ### 0.5.3 - Added changelog history - Enabled changing of Mount and Startup options also when virtualbox is running - They impact only during plugin start - Only if VirtualBox installed give option to update from local or online versions if exist otherwise download options - Changed "vboxmanage" to correct case "VBoxManage" and added full path "/opt/Virtualbox/VBoxManage" - Added to log confirmation that installation of packages completed correctly. - If "VirtualBox LOCAL version different than INSTALLED version" then function changed to "update" instead of "install" - Duplicated all "logger" output also to regular output "echo" - Added --timeout=10 on all wget commands - Minor UI Change ### 0.5.2 - Added Latest Release version available from VirtualBox.org (not necessarily existing for unRAID yet) - Local versions extraction - Cosmetic changes ### 0.5.1 - Fixed bottom of page is sometimes not visible due to unRAID progressframe ### 0.5 - Added option to download GuestAdditions Package - Added option to change /boot/custom/vbox to different location including moving of files - New parameter in configuration - Changed configuration update code - When upgrading from older version plugins the following line should be added to cfg file before upgading the plugin: VBOX_SYMLINK_LOCATION="/boot/custom/vbox" That way the plugin can move existing files once you decide to move the VirtualBox symbolic link from original location "/boot/custom/vbox" to your new desired location. ### 0.4.2 - Fixed: Icon file couldn't be saved because plugin folder doesn't exist on first run ### 0.4.1 - Fixed: Icon file deleted when upgrading plugin without restarting server ### 0.4 - Workaround for downloading non exiting icon file ### 0.3 - Fixed startup sequence - Virtualbox can only be started (specifically VMs) after array mounted ### 0.2.7 - Changed WEBUI layout, Corrected few functions ### 0.2.6 - Corrected access to previous session VM list (vms_session.cfg) ### 0.2.5 - Corrected boot and plugin update functions ### 0.2.4 - Fix install function during boot when online version doesn't exist or is not checked ### 0.2.3 - Fix install function ### 0.2.2 - Initial Release logit() { echo "" echo "$1" } DOWNLOAD_PKG="false" INSTALL_PKG="false" logit "Installing plugin..." if [ ! -d "&pluginLOC;" ] ; then logit "Creating plugin folder &pluginLOC;" mkdir -p "&pluginLOC;" else logit "Plugin folder &pluginLOC; already exists" fi logit "Checking existing package &pluginLOC;/&packagefile;..." if [ -f "&pluginLOC;/&packagefile;" ] ; then VBOX_PKG_LOCAL_MD5=$(/usr/bin/md5sum &pluginLOC;/&packagefile; | cut -d' ' -f1) if [ "$VBOX_PKG_LOCAL_MD5" == "&packageMD5;" ] ; then logit "Latest package already exists &pluginLOC;/&packagefile;" INSTALL_PKG="true" else logit "Local/Online package MD5 mismatch ($VBOX_PKG_LOCAL_MD5/&packageMD5;) on &pluginLOC;/&packagefile; - deleting local package" DOWNLOAD_PKG="true" fi else logit "Latest package does not exist &pluginLOC;/&packagefile;" DOWNLOAD_PKG="true" fi if [ "$DOWNLOAD_PKG" == "true" ]; then logit "Saving any previous packages from &pluginLOC;" mkdir -p "/tmp/&name;-packages" TEMP="&pluginLOC;/&name;-package-*" mv -f $TEMP "/tmp/&name;-packages" logit "Attempting to download plugin package &packageURL;..." wget --quiet --spider --no-check-certificate --timeout=10 &packageURL; if [ ! $? == "0" ] ; then logit "Package server down &packageURL; - Plugin cannot install" INSTALL_PKG="false" else wget --quiet --no-check-certificate --timeout=10 -O &pluginLOC;/&packagefile; &packageURL; if [ ! -f "&pluginLOC;/&packagefile;" ] ; then logit "Package download failed &packageURL; - Plugin cannot install" INSTALL_PKG="false" else VBOX_PKG_LOCAL_MD5=$(/usr/bin/md5sum &pluginLOC;/&packagefile; | cut -d' ' -f1) if [ "$VBOX_PKG_LOCAL_MD5" != "&packageMD5;" ] ; then logit "Package MD5 mismatch ($VBOX_PKG_LOCAL_MD5/&packageMD5;) on &pluginLOC;/&packagefile; - Plugin cannot install" INSTALL_PKG="false" else logit "Package &packagefile; downloaded to &pluginLOC; - MD5 match "$VBOX_PKG_LOCAL_MD5"" INSTALL_PKG="true" fi fi fi fi if [ "$INSTALL_PKG" == "true" ] ; then logit "Extracting plugin package..." [ -f "/etc/rc.d/rc.&name;" ] && rm -f "/etc/rc.d/rc.&name;" [ -d "&emhttpLOC;" ] && rm -fR "&emhttpLOC;" tar -xf "&pluginLOC;/&packagefile;" -C "/" chmod 0770 "&emhttpLOC;/scripts/rc.&name;" ln -s "&emhttpLOC;/scripts/rc.&name;" "/etc/rc.d/rc.&name;" UNRAID_OS_BITS=$(getconf LONG_BIT) echo "Version=\"&version;\"" >> "&emhttpLOC;/&name;.page" if [ "$UNRAID_OS_BITS" == "64" ] ; then echo "Menu=\"Utilities\"" >> "&emhttpLOC;/&name;.page" echo "---" >> "&emhttpLOC;/&name;.page" else echo "Menu=\"OtherSettings\"" >> "&emhttpLOC;/&name;.page" cp -f "&emhttpLOC;/images/&name;.png" "&emhttpLOC;" cp -f "&emhttpLOC;/php/&name;_main.php" "&emhttpLOC;/&name;.php" fi echo "<?php include '&emhttpLOC;/php/&name;_main.php';?>" >> "&emhttpLOC;/&name;.page" if [ ! -f "&pluginLOC;/&name;.cfg" ] ; then logit "Configuration file not found. Creating configuration file..." echo "# VirtualBox plugin configuration - Do not modify manually - Change via WEBUI" > "&pluginLOC;/&name;.cfg" fi logit "Checking all configuration file parameters exist" [ ! `cat "&pluginLOC;/&name;.cfg" | grep INSTALL_ON_BOOT` ] && echo "INSTALL_ON_BOOT=\"false\"" >> "&pluginLOC;/&name;.cfg" [ ! `cat "&pluginLOC;/&name;.cfg" | grep UPGRADE_ON_BOOT` ] && echo "UPGRADE_ON_BOOT=\"false\"" >> "&pluginLOC;/&name;.cfg" [ ! `cat "&pluginLOC;/&name;.cfg" | grep UPGRADE_PLG_ON_BOOT` ] && echo "UPGRADE_PLG_ON_BOOT=\"false\"" >> "&pluginLOC;/&name;.cfg" [ ! `cat "&pluginLOC;/&name;.cfg" | grep START_ON_ARRAY_MOUNT` ] && echo "START_ON_ARRAY_MOUNT=\"false\"" >> "&pluginLOC;/&name;.cfg" [ ! `cat "&pluginLOC;/&name;.cfg" | grep START_VMS_ON_START` ] && echo "START_VMS_ON_START=\"previous\"" >> "&pluginLOC;/&name;.cfg" [ ! `cat "&pluginLOC;/&name;.cfg" | grep VBOX_SYMLINK_LOCATION` ] && echo "VBOX_SYMLINK_LOCATION=\"/boot/custom/vbox\"" >> "&pluginLOC;/&name;.cfg" [ ! `cat "&pluginLOC;/&name;.cfg" | grep VBOXWEBSRV_HOST_IP` ] && echo "VBOXWEBSRV_HOST_IP=\"127.0.0.1\"" >> "&pluginLOC;/&name;.cfg" [ ! `cat "&pluginLOC;/&name;.cfg" | grep VBOXWEBSRV_HOST_PORT` ] && echo "VBOXWEBSRV_HOST_PORT=\"18083\"" >> "&pluginLOC;/&name;.cfg" [ ! `cat "&pluginLOC;/&name;.cfg" | grep VBOXWEBSRV_LOGFILE` ] && echo "VBOXWEBSRV_LOGFILE=\"/boot/config/plugins/virtualbox/vboxwebsrv.log\"" >> "&pluginLOC;/&name;.cfg" [ ! `cat "&pluginLOC;/&name;.cfg" | grep VBOXWEBSRV_VERBOSE` ] && echo "VBOXWEBSRV_VERBOSE=\"true\"" >> "&pluginLOC;/&name;.cfg" [ ! `cat "&pluginLOC;/&name;.cfg" | grep VBOXWEBSRV_LOGROTATE` ] && echo "VBOXWEBSRV_LOGROTATE=\"0\"" >> "&pluginLOC;/&name;.cfg" [ ! `cat "&pluginLOC;/&name;.cfg" | grep VBOXWEBSRV_LOGSIZE` ] && echo "VBOXWEBSRV_LOGSIZE=\"50000\"" >> "&pluginLOC;/&name;.cfg" [ ! `cat "&pluginLOC;/&name;.cfg" | grep VBOXWEBSRV_LOGINTERVAL` ] && echo "VBOXWEBSRV_LOGINTERVAL=\"604800\"" >> "&pluginLOC;/&name;.cfg" rm -Rf "/tmp/&name;-packages" rm -f "/tmp/&name;-install" logit "Plugin and Package file &packagefile; extracted and installed successfully" exit 0 else if [ -f "&pluginLOC;/&packagefile;" ] ; then rm -f "&pluginLOC;/&packagefile;" fi logit "Reverting back to previously saved packages..." TEMP1="/tmp/&name;-packages" TEMP2=$(ls $TEMP1) if [ "$TEMP2" != "" ] ; then TEMP="/tmp/&name;-packages/&name;-package-*" mv -f $TEMP "&pluginLOC;" logit "Previous packages restored" else logit "No previous packages to restored" fi rm -Rf "/tmp/&name;-packages" rm -f "/tmp/&name;-install" logit "Plugin install failed" exit 1 fi logit() { echo "$1" echo "" } logit "Removing plugin..." [ -f "/tmp/&name;-install" ] && rm -f "/tmp/&name;-install" [ -f "/etc/rc.d/rc.&name;" ] && "/etc/rc.d/rc.&name;" stop [ -f "/etc/rc.d/rc.&name;" ] && rm -f "/etc/rc.d/rc.&name;" [ -d "&emhttpLOC;" ] && rm -fR "&emhttpLOC;" logit "Plugin stopped and removed - no files removed from &pluginLOC;"