fix indentations, change the way systemd service file is activated so that enabling works correctly
This commit is contained in:
@@ -29,7 +29,7 @@ LOGFILE="$(dirname $0)/xo-install.log"
|
|||||||
# NodeJS and Yarn are automatically updated when running update. Switch this option to false if you want to disable it.
|
# NodeJS and Yarn are automatically updated when running update. Switch this option to false if you want to disable it.
|
||||||
AUTOUPDATE="true"
|
AUTOUPDATE="true"
|
||||||
|
|
||||||
# Define the number of previous installations you want to keep
|
# Define the number of previous installations you want to keep. Needs to be at least 1
|
||||||
PRESERVE="3"
|
PRESERVE="3"
|
||||||
|
|
||||||
### End of editable variables ###
|
### End of editable variables ###
|
||||||
@@ -237,10 +237,10 @@ function InstallXO {
|
|||||||
InstallXOPlugins
|
InstallXOPlugins
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Fixing binary path in systemd service configuration and symlinking to /etc/systemd/system/xo-server.service"
|
echo "Fixing binary path in systemd service configuration file"
|
||||||
sed -i "s#ExecStart=.*#ExecStart=$INSTALLDIR\/xo-server\/bin\/xo-server#" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/xo-server.service
|
sed -i "s#ExecStart=.*#ExecStart=$INSTALLDIR\/xo-server\/bin\/xo-server#" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/xo-server.service
|
||||||
echo
|
echo
|
||||||
echo "Adding WorkingDirectory parameter to systemd service configuration"
|
echo "Adding WorkingDirectory parameter to systemd service configuration file"
|
||||||
sed -i "/ExecStart=.*/a WorkingDirectory=$INSTALLDIR/xo-server" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/xo-server.service
|
sed -i "/ExecStart=.*/a WorkingDirectory=$INSTALLDIR/xo-server" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/xo-server.service
|
||||||
|
|
||||||
if [ $XOUSER ]; then
|
if [ $XOUSER ]; then
|
||||||
@@ -289,8 +289,8 @@ function InstallXO {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Symlinking systemd service configuration"
|
echo "Replacing systemd service configuration file"
|
||||||
ln -sfn $INSTALLDIR/xo-server/xo-server.service /etc/systemd/system/xo-server.service
|
/bin/cp -f $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/xo-server.service /etc/systemd/system/xo-server.service
|
||||||
sleep 2
|
sleep 2
|
||||||
echo "Reloading systemd configuration"
|
echo "Reloading systemd configuration"
|
||||||
echo
|
echo
|
||||||
@@ -335,11 +335,16 @@ function UpdateXO {
|
|||||||
|
|
||||||
InstallXO
|
InstallXO
|
||||||
|
|
||||||
# remove old builds. leave as many as defined in PRESERVE variable
|
if [[ "$PRESERVE" != "0" ]]; then
|
||||||
echo
|
|
||||||
echo -n "Removing old installations (leaving $PRESERVE latest)..."
|
# remove old builds. leave as many as defined in PRESERVE variable
|
||||||
find $INSTALLDIR/xo-builds/ -maxdepth 1 -type d -name "xen-orchestra*" -printf "%T@ %p\n" | sort -n | cut -d' ' -f2- | head -n -$PRESERVE | xargs -r rm -r
|
echo
|
||||||
echo "done"
|
echo -n "Removing old installations (leaving $PRESERVE latest)..."
|
||||||
|
find $INSTALLDIR/xo-builds/ -maxdepth 1 -type d -name "xen-orchestra*" -printf "%T@ %p\n" | sort -n | cut -d' ' -f2- | head -n -$PRESERVE | xargs -r rm -r
|
||||||
|
echo "done"
|
||||||
|
else
|
||||||
|
echo "PRESERVE variable is set to 0. This needs to be at least 1. Not doing a cleanup"
|
||||||
|
fi
|
||||||
|
|
||||||
} 2>$LOGFILE
|
} 2>$LOGFILE
|
||||||
|
|
||||||
@@ -376,37 +381,37 @@ function RollBackInstallation {
|
|||||||
|
|
||||||
INSTALLATIONS=($(find $INSTALLDIR/xo-builds/ -maxdepth 1 -type d -name "xen-orchestra-*"))
|
INSTALLATIONS=($(find $INSTALLDIR/xo-builds/ -maxdepth 1 -type d -name "xen-orchestra-*"))
|
||||||
|
|
||||||
if [[ $(echo ${#INSTALLATIONS[@]}) -le 1 ]]; then
|
if [[ $(echo ${#INSTALLATIONS[@]}) -le 1 ]]; then
|
||||||
echo "Only one installation exists, nothing to change"
|
echo "Only one installation exists, nothing to change"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Which installation to roll back?"
|
echo "Which installation to roll back?"
|
||||||
echo
|
echo
|
||||||
local PS3="Pick a number. CTRL+C to exit: "
|
local PS3="Pick a number. CTRL+C to exit: "
|
||||||
select INSTALLATION in "${INSTALLATIONS[@]}"; do
|
select INSTALLATION in "${INSTALLATIONS[@]}"; do
|
||||||
case $INSTALLATION in
|
case $INSTALLATION in
|
||||||
*xen-orchestra*)
|
*xen-orchestra*)
|
||||||
echo
|
echo
|
||||||
echo "Setting $INSTALLDIR/xo-server symlink to $INSTALLATION/packages/xo-server"
|
echo "Setting $INSTALLDIR/xo-server symlink to $INSTALLATION/packages/xo-server"
|
||||||
ln -sfn $INSTALLATION/packages/xo-server $INSTALLDIR/xo-server
|
ln -sfn $INSTALLATION/packages/xo-server $INSTALLDIR/xo-server
|
||||||
echo "Setting $INSTALLDIR/xo-web symlink to $INSTALLATION/packages/xo-web"
|
echo "Setting $INSTALLDIR/xo-web symlink to $INSTALLATION/packages/xo-web"
|
||||||
ln -sfn $INSTALLATION/packages/xo-web $INSTALLDIR/xo-web
|
ln -sfn $INSTALLATION/packages/xo-web $INSTALLDIR/xo-web
|
||||||
echo
|
echo
|
||||||
echo "Updating xo-server.service systemd configuration file location"
|
echo "Replacing xo.server.service systemd configuration file"
|
||||||
ln -sfn $INSTALLDIR/xo-server/xo-server.service /etc/systemd/system/xo-server.service
|
/bin/cp -f $INSTALLATION/packages/xo-server/xo-server.service /etc/systemd/system/xo-server.service
|
||||||
/bin/systemctl daemon-reload
|
/bin/systemctl daemon-reload
|
||||||
echo
|
echo
|
||||||
echo "Restarting xo-server..."
|
echo "Restarting xo-server..."
|
||||||
/bin/systemctl restart xo-server
|
/bin/systemctl restart xo-server
|
||||||
echo
|
echo
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Try again"
|
echo "Try again"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user