From 3944e5dabf4d437437f2e31c8cb45fb0ad45f86d Mon Sep 17 00:00:00 2001 From: Tynan McAuley <16469394+tymcauley@users.noreply.github.com> Date: Mon, 5 Nov 2018 17:20:55 -0500 Subject: [PATCH] Migrated configuration to a standalone file. The deployed configuration file (xo-install.cfg) is not tracked by git, so changes made by users won't affect their ability to update this git repo. --- .gitignore | 1 + sample.xo-install.cfg | 23 +++++++++++++++++++++++ xo-install.sh | 33 ++++++++------------------------- 3 files changed, 32 insertions(+), 25 deletions(-) create mode 100644 sample.xo-install.cfg diff --git a/.gitignore b/.gitignore index cb81e89..e1382ad 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ xo-install.log +xo-install.cfg tests/*/* tests/* !tests/Ubuntu diff --git a/sample.xo-install.cfg b/sample.xo-install.cfg new file mode 100644 index 0000000..f3fe87e --- /dev/null +++ b/sample.xo-install.cfg @@ -0,0 +1,23 @@ +# Optional user that runs the service. root by default +#XOUSER="node" + +# Port number where xen-orchestra service is bound +PORT="80" + +# Base dir for installation and future updates +INSTALLDIR="/etc/xo" + +# Git branch or tag (append tags/ before the tag name) where xen-orchestra sources are fetched +BRANCH="master" + +# Log path for possible errors +LOGFILE="$(dirname $0)/xo-install.log" + +# comma separated list of plugins to be installed, check README for more information +#PLUGINS="xo-server-transport-email,xo-server-usage-report,xo-server-perf-alert" + +# NodeJS and Yarn are automatically updated when running update. Switch this option to false if you want to disable it. +AUTOUPDATE="true" + +# Define the number of previous installations you want to keep. Needs to be at least 1 +PRESERVE="3" diff --git a/xo-install.sh b/xo-install.sh index 5d02dd1..6f454c1 100755 --- a/xo-install.sh +++ b/xo-install.sh @@ -6,33 +6,16 @@ # Repository: https://github.com/ronivay/XenOrchestraInstallerUpdater # ######################################################################### -### Start of editable variables ### +SAMPLE_CONFIG_FILE="sample.xo-install.cfg" +CONFIG_FILE="xo-install.cfg" -# Optional user that runs the service. root by default -#XOUSER="node" +# Deploy default configuration file if the user doesn't have their own yet. +if [[ ! -e "$CONFIG_FILE" ]]; then + cp $SAMPLE_CONFIG_FILE $CONFIG_FILE +fi -# Port number where xen-orchestra service is bound -PORT="80" - -# Base dir for installation and future updates -INSTALLDIR="/etc/xo" - -# Git branch or tag (append tags/ before the tag name) where xen-orchestra sources are fetched -BRANCH="master" - -# Log path for possible errors -LOGFILE="$(dirname $0)/xo-install.log" - -# comma separated list of plugins to be installed, check README for more information -#PLUGINS="xo-server-transport-email,xo-server-usage-report,xo-server-perf-alert" - -# NodeJS and Yarn are automatically updated when running update. Switch this option to false if you want to disable it. -AUTOUPDATE="true" - -# Define the number of previous installations you want to keep. Needs to be at least 1 -PRESERVE="3" - -### End of editable variables ### +# See this file for all script configuration variables. +source $CONFIG_FILE function CheckUser {