change indentation from tabs to spaces and couple other minor suggestions by shfmt
This commit is contained in:
@@ -99,8 +99,11 @@ function selfUpgrade {
|
|||||||
runcmd "cd $SCRIPT_DIR && git fetch"
|
runcmd "cd $SCRIPT_DIR && git fetch"
|
||||||
if [[ $(runcmd_stdout "cd $SCRIPT_DIR && git diff --name-only @{upstream}| grep xo-install.sh") ]]; then
|
if [[ $(runcmd_stdout "cd $SCRIPT_DIR && git diff --name-only @{upstream}| grep xo-install.sh") ]]; then
|
||||||
printinfo "Newer version of script available, attempting to self upgrade"
|
printinfo "Newer version of script available, attempting to self upgrade"
|
||||||
runcmd "cd $SCRIPT_DIR && git pull --ff-only" && \
|
runcmd "cd $SCRIPT_DIR && git pull --ff-only" &&
|
||||||
{ printok "Self upgrade done" ; exec "$SCRIPT_DIR/xo-install.sh" "$@"; } || \
|
{
|
||||||
|
printok "Self upgrade done"
|
||||||
|
exec "$SCRIPT_DIR/xo-install.sh" "$@"
|
||||||
|
} ||
|
||||||
printfail "Failed to self upgrade. Check logs for more details"
|
printfail "Failed to self upgrade. Check logs for more details"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -108,7 +111,6 @@ function selfUpgrade {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# log script version (git commit) and configuration variables to logfile
|
# log script version (git commit) and configuration variables to logfile
|
||||||
function scriptInfo {
|
function scriptInfo {
|
||||||
|
|
||||||
@@ -293,7 +295,6 @@ function InstallDependenciesDeb {
|
|||||||
printok "Installing setcap"
|
printok "Installing setcap"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# only run automated node install if executable not found
|
# only run automated node install if executable not found
|
||||||
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
|
||||||
@@ -581,7 +582,10 @@ function InstallXO {
|
|||||||
if [[ $(runcmd_stdout "pgrep -f xo-server") ]]; then
|
if [[ $(runcmd_stdout "pgrep -f xo-server") ]]; then
|
||||||
echo
|
echo
|
||||||
printprog "Shutting down xo-server"
|
printprog "Shutting down xo-server"
|
||||||
runcmd "/bin/systemctl stop xo-server" || { printfail "failed to stop service, exiting..." ; exit 1; }
|
runcmd "/bin/systemctl stop xo-server" || {
|
||||||
|
printfail "failed to stop service, exiting..."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
printok "Shutting down xo-server"
|
printok "Shutting down xo-server"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -636,8 +640,11 @@ function InstallXO {
|
|||||||
|
|
||||||
if [[ -n "$NODEBINARY" ]]; then
|
if [[ -n "$NODEBINARY" ]]; then
|
||||||
printprog "Attempting to set cap_net_bind_service permission for $NODEBINARY"
|
printprog "Attempting to set cap_net_bind_service permission for $NODEBINARY"
|
||||||
runcmd "setcap 'cap_net_bind_service=+ep' $NODEBINARY" && printok "Attempting to set cap_net_bind_service permission for $NODEBINARY" \
|
runcmd "setcap 'cap_net_bind_service=+ep' $NODEBINARY" && printok "Attempting to set cap_net_bind_service permission for $NODEBINARY" ||
|
||||||
|| { printfail "Attempting to set cap_net_bind_service permission for $NODEBINARY" ; echo " Non-privileged user might not be able to bind to <1024 port. xo-server won't start most likely" ; }
|
{
|
||||||
|
printfail "Attempting to set cap_net_bind_service permission for $NODEBINARY"
|
||||||
|
echo " Non-privileged user might not be able to bind to <1024 port. xo-server won't start most likely"
|
||||||
|
}
|
||||||
else
|
else
|
||||||
printfail "Can't find node executable, or it's a symlink to non existing file. Not trying to setcap. xo-server won't start most likely"
|
printfail "Can't find node executable, or it's a symlink to non existing file. Not trying to setcap. xo-server won't start most likely"
|
||||||
fi
|
fi
|
||||||
@@ -675,7 +682,6 @@ function InstallXO {
|
|||||||
runcmd "mkdir -p $CONFIGPATH/.config/xo-server"
|
runcmd "mkdir -p $CONFIGPATH/.config/xo-server"
|
||||||
runcmd "mv -f $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.toml $CONFIGPATH/.config/xo-server/config.toml"
|
runcmd "mv -f $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.toml $CONFIGPATH/.config/xo-server/config.toml"
|
||||||
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
@@ -767,7 +773,6 @@ function InstallXO {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# run xen orchestra installation but also cleanup old installations based on value in xo-install.cfg
|
# run xen orchestra installation but also cleanup old installations based on value in xo-install.cfg
|
||||||
function UpdateXO {
|
function UpdateXO {
|
||||||
|
|
||||||
@@ -1116,8 +1121,11 @@ read -r -p ": " option
|
|||||||
case $answer in
|
case $answer in
|
||||||
y)
|
y)
|
||||||
echo "Stopping xo-server..."
|
echo "Stopping xo-server..."
|
||||||
runcmd "/bin/systemctl stop xo-server" \
|
runcmd "/bin/systemctl stop xo-server" ||
|
||||||
|| { printfail "failed to stop service, exiting..." ; exit 1; }
|
{
|
||||||
|
printfail "failed to stop service, exiting..."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
;;
|
;;
|
||||||
n)
|
n)
|
||||||
exit 0
|
exit 0
|
||||||
@@ -1169,7 +1177,6 @@ if [[ $# == "0" ]]; then
|
|||||||
INTERACTIVE="true"
|
INTERACTIVE="true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# these functions check specific requirements and are run everytime
|
# these functions check specific requirements and are run everytime
|
||||||
selfUpgrade "$@"
|
selfUpgrade "$@"
|
||||||
scriptInfo
|
scriptInfo
|
||||||
|
@@ -24,7 +24,6 @@ function OSCheck {
|
|||||||
echo "Please report any issues to this github project"
|
echo "Please report any issues to this github project"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function NetworkChoose {
|
function NetworkChoose {
|
||||||
@@ -39,8 +38,7 @@ function NetworkChoose {
|
|||||||
echo "Which network should the VM use?"
|
echo "Which network should the VM use?"
|
||||||
echo
|
echo
|
||||||
local PS3="Pick a number. CTRL+C to exit: "
|
local PS3="Pick a number. CTRL+C to exit: "
|
||||||
select network in "${networks[@]}"
|
select network in "${networks[@]}"; do
|
||||||
do
|
|
||||||
# get only the network uuid from array which we need later on when adding vif
|
# get only the network uuid from array which we need later on when adding vif
|
||||||
read -r -a network_split <<<"$network"
|
read -r -a network_split <<<"$network"
|
||||||
networkuuid=${network_split[0]}
|
networkuuid=${network_split[0]}
|
||||||
@@ -76,8 +74,7 @@ function StorageChoose {
|
|||||||
echo "default will attempt to use pool default SR"
|
echo "default will attempt to use pool default SR"
|
||||||
echo
|
echo
|
||||||
local PS3="Pick a number. CTRL+C to exit: "
|
local PS3="Pick a number. CTRL+C to exit: "
|
||||||
select storage in "${storages[@]}" "default"
|
select storage in "${storages[@]}" "default"; do
|
||||||
do
|
|
||||||
# get only the storage repository uuid which we need later on when importing image
|
# get only the storage repository uuid which we need later on when importing image
|
||||||
read -r -a storage_split <<<"$storage"
|
read -r -a storage_split <<<"$storage"
|
||||||
storageuuid=${storage_split[0]}
|
storageuuid=${storage_split[0]}
|
||||||
|
Reference in New Issue
Block a user