change indentation from tabs to spaces and couple other minor suggestions by shfmt

This commit is contained in:
ronivay
2021-08-24 08:57:15 +03:00
parent 03f5ad9d10
commit 8bd090aada
2 changed files with 1021 additions and 1017 deletions

View File

@@ -99,8 +99,11 @@ function selfUpgrade {
runcmd "cd $SCRIPT_DIR && git fetch"
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"
runcmd "cd $SCRIPT_DIR && git pull --ff-only" && \
{ printok "Self upgrade done" ; exec "$SCRIPT_DIR/xo-install.sh" "$@"; } || \
runcmd "cd $SCRIPT_DIR && git pull --ff-only" &&
{
printok "Self upgrade done"
exec "$SCRIPT_DIR/xo-install.sh" "$@"
} ||
printfail "Failed to self upgrade. Check logs for more details"
fi
fi
@@ -108,7 +111,6 @@ function selfUpgrade {
}
# log script version (git commit) and configuration variables to logfile
function scriptInfo {
@@ -293,7 +295,6 @@ function InstallDependenciesDeb {
printok "Installing setcap"
fi
# only run automated node install if executable not found
if [[ -z $(runcmd_stdout "command -v node") ]] || [[ -z $(runcmd_stdout "command -v npm") ]]; then
echo
@@ -581,7 +582,10 @@ function InstallXO {
if [[ $(runcmd_stdout "pgrep -f xo-server") ]]; then
echo
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"
fi
@@ -636,8 +640,11 @@ function InstallXO {
if [[ -n "$NODEBINARY" ]]; then
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" \
|| { 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" ; }
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"
}
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"
fi
@@ -675,7 +682,6 @@ function InstallXO {
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"
fi
echo
@@ -767,7 +773,6 @@ function InstallXO {
}
# run xen orchestra installation but also cleanup old installations based on value in xo-install.cfg
function UpdateXO {
@@ -1116,8 +1121,11 @@ read -r -p ": " option
case $answer in
y)
echo "Stopping 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
}
;;
n)
exit 0
@@ -1169,7 +1177,6 @@ if [[ $# == "0" ]]; then
INTERACTIVE="true"
fi
# these functions check specific requirements and are run everytime
selfUpgrade "$@"
scriptInfo

View File

@@ -24,7 +24,6 @@ function OSCheck {
echo "Please report any issues to this github project"
echo
}
function NetworkChoose {
@@ -39,8 +38,7 @@ function NetworkChoose {
echo "Which network should the VM use?"
echo
local PS3="Pick a number. CTRL+C to exit: "
select network in "${networks[@]}"
do
select network in "${networks[@]}"; do
# get only the network uuid from array which we need later on when adding vif
read -r -a network_split <<<"$network"
networkuuid=${network_split[0]}
@@ -76,8 +74,7 @@ function StorageChoose {
echo "default will attempt to use pool default SR"
echo
local PS3="Pick a number. CTRL+C to exit: "
select storage in "${storages[@]}" "default"
do
select storage in "${storages[@]}" "default"; do
# get only the storage repository uuid which we need later on when importing image
read -r -a storage_split <<<"$storage"
storageuuid=${storage_split[0]}