diff --git a/.gitignore b/.gitignore index 091fcce..5597bfd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ xo-install.cfg +patches/* logs/* diff --git a/README.md b/README.md index cf001e2..290ae7d 100644 --- a/README.md +++ b/README.md @@ -185,6 +185,12 @@ Note that for obvious reasons some of the proxy features seen in Xen Orchestra U Plugins are installed according to what is specified in `PLUGINS` variable inside `xo-install.cfg` configuration file. By default all available plugins that are part of xen orchestra repository are installed. This list can be narrowed down if needed and 3rd party plugins included. +#### Patches + +The script allows to apply extra patches during the Xen Orchestra build phase. If e.g. any local patches are needed, they can be dropped into the patches/ subfolder. Every file in there with the `.patch` suffix will be applied during building. + +This allows for local customization of XO. N.B. xo-install is not shipping with any patches, this is for advanced users. + ### Image If you don't want to first install a VM and then use `xo-install.sh` script on it, you have the possibility to import VM image which has everything already setup. Use `xo-vm-import.sh` to do this, it'll download a prebuilt Debian 11 image which has Xen Orchestra and XenOrchestraInstallerUpdater installed. diff --git a/sample.xo-install.cfg b/sample.xo-install.cfg index c8ebef0..49a795e 100644 --- a/sample.xo-install.cfg +++ b/sample.xo-install.cfg @@ -42,6 +42,9 @@ BRANCH="master" # default: ./logs #LOGPATH= +# Apply patches to sourcecode +APPLY_PATCHES="true" + # Only one PLUGINS variable can be used at a time. Comment out the other one if you change these below. Comment out both if you don't want any plugins to be installed. # Comma separated list of plugins to be installed, check README for more information. Note that 3rd party plugins defined below should be listed here as well with their name eq. repo1,repo2 etc. diff --git a/xo-install.sh b/xo-install.sh index 6cdec47..452f1b1 100755 --- a/xo-install.sh +++ b/xo-install.sh @@ -677,6 +677,26 @@ function PrepInstall { } +function ApplyPatches { + + set -euo pipefail + + trap ErrorHandling ERR INT + + if [[ "${APPLY_PATCHES:-}" != "true" ]]; then + echo + printinfo "No 3rd party patches to install" + return 0 + fi + + for patch in "$(dirname "$0")"/patches/*.patch; do + runcmd "cat $(dirname "$0")/patches/$(basename "$patch") | (cd $INSTALLDIR/xo-builds/xen-orchestra-$TIME && git apply -)" + done + echo + printok "Applying patches" + +} + # run actual xen orchestra installation. procedure is the same for new installation and update. we always build it from scratch. function InstallXO { @@ -704,6 +724,9 @@ function InstallXO { # Fetch 3rd party plugins source code InstallAdditionalXOPlugins + # Apply extra patches + ApplyPatches + echo printinfo "xo-server and xo-web build takes quite a while. Grab a cup of coffee and lay back" echo