styling: fix shfmt issues

This commit is contained in:
Roni Väyrynen
2022-01-01 19:09:31 +02:00
parent f9037cf0a2
commit 03abc1d1f8
3 changed files with 203 additions and 203 deletions

View File

@@ -5,5 +5,5 @@ tab_width = 8
end_of_line = lf end_of_line = lf
trim_trailing_whitespace = true trim_trailing_whitespace = true
insert_final_newline = true insert_final_newline = true
function_next_line = true function_next_line = false
switch_case_indent = true switch_case_indent = true

View File

@@ -595,14 +595,14 @@ function PrepInstall {
read -r -p "[y/N]: " answer read -r -p "[y/N]: " answer
answer="${answer:-n}" answer="${answer:-n}"
case "$answer" in case "$answer" in
y) y)
: :
;; ;;
n) n)
printinfo "Cleaning up install directory: $INSTALLDIR/xo-builds/xen-orchestra-$TIME" printinfo "Cleaning up install directory: $INSTALLDIR/xo-builds/xen-orchestra-$TIME"
runcmd "rm -rf $INSTALLDIR/xo-builds/xen-orchestra-$TIME" runcmd "rm -rf $INSTALLDIR/xo-builds/xen-orchestra-$TIME"
exit 0 exit 0
;; ;;
esac esac
else else
printinfo "No changes to $XO_SVC_DESC since previous install. Skipping build. Use the --force to update anyway." printinfo "No changes to $XO_SVC_DESC since previous install. Skipping build. Use the --force to update anyway."
@@ -984,36 +984,36 @@ function HandleArgs {
while true; do while true; do
case "$1" in case "$1" in
--force) --force)
shift shift
FORCE="true" FORCE="true"
;; ;;
--update) --update)
shift shift
local UPDATEARG=1 local UPDATEARG=1
TASK="Update" TASK="Update"
;; ;;
--install) --install)
shift shift
local INSTALLARG=1 local INSTALLARG=1
TASK="Installation" TASK="Installation"
;; ;;
--rollback) --rollback)
shift shift
local ROLLBACKARG=1 local ROLLBACKARG=1
;; ;;
--proxy) --proxy)
shift shift
local PROXYARG=1 local PROXYARG=1
;; ;;
--) --)
shift shift
break break
;; ;;
*) *)
shift shift
break break
;; ;;
esac esac
done done
@@ -1079,18 +1079,18 @@ function RollBackInstallation {
echo "3. Exit" echo "3. Exit"
read -r -p ": " answer read -r -p ": " answer
case $answer in case $answer in
1) 1)
XO_SVC="xo-server" XO_SVC="xo-server"
;; ;;
2) 2)
XO_SVC="xo-proxy" XO_SVC="xo-proxy"
;; ;;
3) 3)
exit exit
;; ;;
*) *)
exit exit
;; ;;
esac esac
else else
XO_SVC="xo-proxy" XO_SVC="xo-proxy"
@@ -1105,36 +1105,36 @@ function RollBackInstallation {
local INSTALLATION local INSTALLATION
select INSTALLATION in "${INSTALLATIONS[@]}"; do select INSTALLATION in "${INSTALLATIONS[@]}"; do
case $INSTALLATION in case $INSTALLATION in
*xen-orchestra*) *xen-orchestra*)
echo
if [[ "$XO_SVC" == "xo-server" ]]; then
printinfo "Setting $INSTALLDIR/xo-server symlink to $INSTALLATION/packages/xo-server"
runcmd "ln -sfn $INSTALLATION/packages/xo-server $INSTALLDIR/xo-server"
printinfo "Setting $INSTALLDIR/xo-web symlink to $INSTALLATION/packages/xo-web"
runcmd "ln -sfn $INSTALLATION/packages/xo-web $INSTALLDIR/xo-web"
echo echo
printinfo "Replacing xo.server.service systemd configuration file" if [[ "$XO_SVC" == "xo-server" ]]; then
runcmd "/bin/cp -f $INSTALLATION/packages/xo-server/xo-server.service /etc/systemd/system/xo-server.service" printinfo "Setting $INSTALLDIR/xo-server symlink to $INSTALLATION/packages/xo-server"
runcmd "/bin/systemctl daemon-reload" runcmd "ln -sfn $INSTALLATION/packages/xo-server $INSTALLDIR/xo-server"
echo printinfo "Setting $INSTALLDIR/xo-web symlink to $INSTALLATION/packages/xo-web"
printinfo "Restarting xo-server..." runcmd "ln -sfn $INSTALLATION/packages/xo-web $INSTALLDIR/xo-web"
runcmd "/bin/systemctl restart xo-server" echo
echo printinfo "Replacing xo.server.service systemd configuration file"
break runcmd "/bin/cp -f $INSTALLATION/packages/xo-server/xo-server.service /etc/systemd/system/xo-server.service"
fi runcmd "/bin/systemctl daemon-reload"
if [[ "$XO_SVC" == "xo-proxy" ]]; then echo
printinfo "Setting $INSTALLDIR/xo-proxy symlink to $INSTALLATION/@xen-orchestra/proxy" printinfo "Restarting xo-server..."
runcmd "ln -sfn $INSTALLATION/@xen-orchestra/proxy $INSTALLDIR/xo-proxy" runcmd "/bin/systemctl restart xo-server"
echo echo
printinfo "Restating xo-proxy..." break
runcmd "/bin/systemctl restart xo-proxy" fi
echo if [[ "$XO_SVC" == "xo-proxy" ]]; then
break printinfo "Setting $INSTALLDIR/xo-proxy symlink to $INSTALLATION/@xen-orchestra/proxy"
fi runcmd "ln -sfn $INSTALLATION/@xen-orchestra/proxy $INSTALLDIR/xo-proxy"
;; echo
*) printinfo "Restating xo-proxy..."
printfail "Try again" runcmd "/bin/systemctl restart xo-proxy"
;; echo
break
fi
;;
*)
printfail "Try again"
;;
esac esac
done done
@@ -1278,15 +1278,15 @@ function CheckMemory {
fi fi
read -r -p "continue anyway? y/N: " answer read -r -p "continue anyway? y/N: " answer
case $answer in case $answer in
y) y)
: :
;; ;;
n) n)
exit 0 exit 0
;; ;;
*) *)
exit 0 exit 0
;; ;;
esac esac
fi fi
@@ -1304,15 +1304,15 @@ function CheckDiskFree {
fi fi
read -r -p "continue anyway? y/N: " answer read -r -p "continue anyway? y/N: " answer
case $answer in case $answer in
y) y)
: :
;; ;;
n) n)
exit 0 exit 0
;; ;;
*) *)
exit 0 exit 0
;; ;;
esac esac
fi fi
} }
@@ -1353,105 +1353,105 @@ function StartUpScreen {
read -r -p ": " option read -r -p ": " option
case $option in case $option in
1) 1)
if [[ $(runcmd_stdout "pgrep -f xo-server") ]]; then if [[ $(runcmd_stdout "pgrep -f xo-server") ]]; then
echo "Looks like xo-server process is already running, consider running update instead. Continue anyway?" echo "Looks like xo-server process is already running, consider running update instead. Continue anyway?"
read -r -p "[y/N]: " answer read -r -p "[y/N]: " answer
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..." printfail "failed to stop service, exiting..."
exit 1 exit 1
} }
;; ;;
n) n)
exit 0
;;
*)
exit 0
;;
esac
fi
TASK="Installation"
XO_SVC="xo-server"
if [ "$PKG_FORMAT" == "rpm" ]; then
InstallDependenciesRPM
InstallXO
exit 0 exit 0
;; fi
*) if [ "$PKG_FORMAT" == "deb" ]; then
InstallDependenciesDeb
InstallXO
exit 0 exit 0
;; fi
esac ;;
fi 2)
TASK="Update"
TASK="Installation" XO_SVC="xo-server"
XO_SVC="xo-server" UpdateNodeYarn
UpdateXO
if [ "$PKG_FORMAT" == "rpm" ]; then
InstallDependenciesRPM
InstallXO
exit 0 exit 0
fi ;;
if [ "$PKG_FORMAT" == "deb" ]; then 3)
InstallDependenciesDeb RollBackInstallation
InstallXO
exit 0 exit 0
fi ;;
;; 4)
2) if [[ $(runcmd_stdout "pgrep -f xo-proxy") ]]; then
TASK="Update" echo "Looks like xo-proxy process is already running, consider running update instead. Continue anyway?"
XO_SVC="xo-server" read -r -p "[y/N]: " answer
UpdateNodeYarn case $answer in
UpdateXO y)
exit 0 echo "Stopping xo-proxy..."
;; runcmd "/bin/systemctl stop xo-proxy" ||
3) {
RollBackInstallation printfail "failed to stop service, exiting..."
exit 0 exit 1
;; }
4) ;;
if [[ $(runcmd_stdout "pgrep -f xo-proxy") ]]; then n)
echo "Looks like xo-proxy process is already running, consider running update instead. Continue anyway?" exit 0
read -r -p "[y/N]: " answer ;;
case $answer in *)
y) exit 0
echo "Stopping xo-proxy..." ;;
runcmd "/bin/systemctl stop xo-proxy" || esac
{ fi
printfail "failed to stop service, exiting..."
exit 1 TASK="Installation"
} XO_SVC="xo-proxy"
;;
n) if [[ "$PKG_FORMAT" == "rpm" ]]; then
InstallDependenciesRPM
InstallXOProxy
exit 0 exit 0
;; fi
*) if [[ "$PKG_FORMAT" == "deb" ]]; then
InstallDependenciesDeb
InstallXOProxy
exit 0 exit 0
;; fi
esac ;;
fi
TASK="Installation" 5)
XO_SVC="xo-proxy" TASK="Update"
XO_SVC="xo-proxy"
if [[ "$PKG_FORMAT" == "rpm" ]]; then UpdateNodeYarn
InstallDependenciesRPM UpdateXO
InstallXOProxy
exit 0 exit 0
fi ;;
if [[ "$PKG_FORMAT" == "deb" ]]; then 6)
InstallDependenciesDeb
InstallXOProxy
exit 0 exit 0
fi ;;
;; *)
echo "Please choose one of the options"
5) echo
TASK="Update" exit 0
XO_SVC="xo-proxy" ;;
UpdateNodeYarn
UpdateXO
exit 0
;;
6)
exit 0
;;
*)
echo "Please choose one of the options"
echo
exit 0
;;
esac esac
} }

View File

@@ -45,11 +45,11 @@ function NetworkChoose {
# print a menu where to choose network from # print a menu where to choose network from
case $network in case $network in
*) *)
# save network uuid for later # save network uuid for later
vifuuid="$networkuuid" vifuuid="$networkuuid"
break break
;; ;;
esac esac
done done
@@ -81,16 +81,16 @@ function StorageChoose {
# print a menu where to choose storage from # print a menu where to choose storage from
case $storage in case $storage in
default) default)
# this value is handled during import if set to default # this value is handled during import if set to default
sruuid=default sruuid=default
break break
;; ;;
*) *)
# save storage uuid for later # save storage uuid for later
sruuid=$storageuuid sruuid=$storageuuid
break break
;; ;;
esac esac
done done