Merge pull request #113 from bnerickson/master

Adding option to disable repos installation
This commit is contained in:
Roni Väyrynen
2022-04-01 14:17:59 +03:00
committed by GitHub
3 changed files with 71 additions and 15 deletions

View File

@@ -145,6 +145,22 @@ deb:
- sudo (if set in xo-install.cfg) - sudo (if set in xo-install.cfg)
``` ```
Following repositories will be installed if needed and repository install is enabled in xo-install.cfg
```
rpm:
- forensics repository
- epel repository
- nodesource repository
- yarn repository
deb:
- universe repository (ubuntu)
- nodesource repository
- yarn repository
```
#### Backup proxy #### Backup proxy
**Proxy installation method is experimental, use at your own risk. Proxy installation from sources is not documented by Xen Orchestra team. Method used here is the outcome of trial and error.** **Proxy installation method is experimental, use at your own risk. Proxy installation from sources is not documented by Xen Orchestra team. Method used here is the outcome of trial and error.**

View File

@@ -79,3 +79,10 @@ PRESERVE="3"
# If set to true together with cert/key paths, defined pem key/certificate will be created if neither exists. # If set to true together with cert/key paths, defined pem key/certificate will be created if neither exists.
# options: true/false # options: true/false
#AUTOCERT="false" #AUTOCERT="false"
# If set to true, this will install the rpm/deb repositories necessary for the Xen Orchestra install.
# If set to false, these repositories will not be installed. Also automatic nodejs upgrade will be disabled.
# Note that installation will fail if all needed packages aren't available from configured repositories. See README for list of packages.
# options: true/false
# default: true
#INSTALL_REPOS="true"

View File

@@ -41,6 +41,7 @@ PATH_TO_HTTPS_KEY="${PATH_TO_HTTPS_KEY:-""}"
AUTOCERT="${AUTOCERT:-"false"}" AUTOCERT="${AUTOCERT:-"false"}"
USESUDO="${USESUDO:-"false"}" USESUDO="${USESUDO:-"false"}"
GENSUDO="${GENSUDO:-"false"}" GENSUDO="${GENSUDO:-"false"}"
INSTALL_REPOS="${INSTALL_REPOS:-"true"}"
# set variables not changeable in configfile # set variables not changeable in configfile
TIME=$(date +%Y%m%d%H%M) TIME=$(date +%Y%m%d%H%M)
@@ -196,8 +197,8 @@ function InstallDependenciesRPM {
# Install necessary dependencies for XO build # Install necessary dependencies for XO build
# only install epel-release if doesn't exist # only install epel-release if doesn't exist and user allows it to be installed
if [[ -z $(runcmd_stdout "rpm -qa epel-release") ]]; then if [[ -z $(runcmd_stdout "rpm -qa epel-release") ]] && [[ "$INSTALL_REPOS" == "true" ]]; then
echo echo
printprog "Installing epel-repo" printprog "Installing epel-repo"
runcmd "yum -y install epel-release" runcmd "yum -y install epel-release"
@@ -214,7 +215,13 @@ function InstallDependenciesRPM {
if [[ -z $(runcmd_stdout "command -v node") ]]; then if [[ -z $(runcmd_stdout "command -v node") ]]; then
echo echo
printprog "Installing node.js" printprog "Installing node.js"
runcmd "curl -s -L https://rpm.nodesource.com/setup_${NODEVERSION}.x | bash -"
# only install nodejs repo if user allows it to be installed
if [[ "$INSTALL_REPOS" == "true" ]]; then
runcmd "curl -s -L https://rpm.nodesource.com/setup_${NODEVERSION}.x | bash -"
fi
runcmd "yum install -y nodejs"
printok "Installing node.js" printok "Installing node.js"
else else
UpdateNodeYarn UpdateNodeYarn
@@ -224,18 +231,28 @@ function InstallDependenciesRPM {
if [[ -z $(runcmd_stdout "command -v yarn") ]]; then if [[ -z $(runcmd_stdout "command -v yarn") ]]; then
echo echo
printprog "Installing yarn" printprog "Installing yarn"
runcmd "curl -s -o /etc/yum.repos.d/yarn.repo https://dl.yarnpkg.com/rpm/yarn.repo && yum -y install yarn"
# only install yarn repo if user allows it to be installed
if [[ "$INSTALL_REPOS" == "true" ]]; then
runcmd "curl -s -o /etc/yum.repos.d/yarn.repo https://dl.yarnpkg.com/rpm/yarn.repo"
fi
runcmd "yum -y install yarn"
printok "Installing yarn" printok "Installing yarn"
fi fi
# only install libvhdi-tools if vhdimount is not present # only install libvhdi-tools if vhdimount is not present
if [[ -z $(runcmd_stdout "command -v vhdimount") ]]; then if [[ -z $(runcmd_stdout "command -v vhdimount") ]]; then
echo echo
printprog "Installing libvhdi-tools from forensics repository" printprog "Installing libvhdi-tools"
runcmd "rpm -ivh https://forensics.cert.org/cert-forensics-tools-release-el8.rpm" if [[ "$INSTALL_REPOS" == "true" ]]; then
runcmd "sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/cert-forensics-tools.repo" runcmd "rpm -ivh https://forensics.cert.org/cert-forensics-tools-release-el8.rpm"
runcmd "yum --enablerepo=forensics install -y libvhdi-tools" runcmd "sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/cert-forensics-tools.repo"
printok "Installing libvhdi-tools from forensics repository" runcmd "yum --enablerepo=forensics install -y libvhdi-tools"
else
runcmd "yum install -y libvhdi-tools"
fi
printok "Installing libvhdi-tools"
fi fi
echo echo
@@ -259,7 +276,7 @@ function InstallDependenciesDeb {
# Install necessary dependencies for XO build # Install necessary dependencies for XO build
if [[ "$OSNAME" == "Ubuntu" ]]; then if [[ "$OSNAME" == "Ubuntu" ]] && [[ "$INSTALL_REPOS" == "true" ]]; then
echo echo
printprog "OS Ubuntu so making sure universe repository is enabled" printprog "OS Ubuntu so making sure universe repository is enabled"
runcmd "apt-get install -y software-properties-common" runcmd "apt-get install -y software-properties-common"
@@ -310,7 +327,12 @@ function InstallDependenciesDeb {
if [[ -z $(runcmd_stdout "command -v node") ]] || [[ -z $(runcmd_stdout "command -v npm") ]]; then if [[ -z $(runcmd_stdout "command -v node") ]] || [[ -z $(runcmd_stdout "command -v npm") ]]; then
echo echo
printprog "Installing node.js" printprog "Installing node.js"
runcmd "curl -sL https://deb.nodesource.com/setup_${NODEVERSION}.x | bash -"
# only install nodejs repo if user allows it to be installed
if [[ "$INSTALL_REPOS" == "true" ]]; then
runcmd "curl -sL https://deb.nodesource.com/setup_${NODEVERSION}.x | bash -"
fi
runcmd "apt-get install -y nodejs" runcmd "apt-get install -y nodejs"
printok "Installing node.js" printok "Installing node.js"
else else
@@ -321,8 +343,13 @@ function InstallDependenciesDeb {
if [[ -z $(runcmd_stdout "command -v yarn") ]]; then if [[ -z $(runcmd_stdout "command -v yarn") ]]; then
echo echo
printprog "Installing yarn" printprog "Installing yarn"
runcmd "curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -"
runcmd "echo \"deb https://dl.yarnpkg.com/debian/ stable main\" | tee /etc/apt/sources.list.d/yarn.list" # only install yarn repo if user allows it to be installed
if [[ "$INSTALL_REPOS" == "true" ]]; then
runcmd "curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -"
runcmd "echo \"deb https://dl.yarnpkg.com/debian/ stable main\" | tee /etc/apt/sources.list.d/yarn.list"
fi
runcmd "apt-get update" runcmd "apt-get update"
runcmd "apt-get install -y yarn" runcmd "apt-get install -y yarn"
printok "Installing yarn" printok "Installing yarn"
@@ -357,10 +384,14 @@ function UpdateNodeYarn {
local NODEV=$(runcmd_stdout "node -v 2>/dev/null| grep -Eo '[0-9.]+' | cut -d'.' -f1") local NODEV=$(runcmd_stdout "node -v 2>/dev/null| grep -Eo '[0-9.]+' | cut -d'.' -f1")
if [ "$PKG_FORMAT" == "rpm" ]; then if [ "$PKG_FORMAT" == "rpm" ]; then
if [[ -n "$NODEV" ]] && [[ "$NODEV" -lt "${NODEVERSION}" ]]; then # update node version if needed.
# skip update if repository install is disabled as we can't quarantee this actually updates anything
if [[ -n "$NODEV" ]] && [[ "$NODEV" -lt "${NODEVERSION}" ]] && [[ "$INSTALL_REPOS" == "true" ]]; then
echo echo
printprog "node.js version is $NODEV, upgrading to ${NODEVERSION}.x" printprog "node.js version is $NODEV, upgrading to ${NODEVERSION}.x"
runcmd "curl -sL https://rpm.nodesource.com/setup_${NODEVERSION}.x | bash -" runcmd "curl -sL https://rpm.nodesource.com/setup_${NODEVERSION}.x | bash -"
runcmd "yum clean all" runcmd "yum clean all"
runcmd "yum install -y nodejs" runcmd "yum install -y nodejs"
printok "node.js version is $NODEV, upgrading to ${NODEVERSION}.x" printok "node.js version is $NODEV, upgrading to ${NODEVERSION}.x"
@@ -378,10 +409,12 @@ function UpdateNodeYarn {
fi fi
if [ "$PKG_FORMAT" == "deb" ]; then if [ "$PKG_FORMAT" == "deb" ]; then
if [[ -n "$NODEV" ]] && [[ "$NODEV" -lt "${NODEVERSION}" ]]; then if [[ -n "$NODEV" ]] && [[ "$NODEV" -lt "${NODEVERSION}" ]] && [[ "$INSTALL_REPOS" == "true" ]]; then
echo echo
printprog "node.js version is $NODEV, upgrading to ${NODEVERSION}.x" printprog "node.js version is $NODEV, upgrading to ${NODEVERSION}.x"
runcmd "curl -sL https://deb.nodesource.com/setup_${NODEVERSION}.x | bash -" runcmd "curl -sL https://deb.nodesource.com/setup_${NODEVERSION}.x | bash -"
runcmd "apt-get install -y nodejs" runcmd "apt-get install -y nodejs"
printok "node.js version is $NODEV, upgrading to ${NODEVERSION}.x" printok "node.js version is $NODEV, upgrading to ${NODEVERSION}.x"
else else