Small readability improvements and explanation

This commit is contained in:
ronivay
2018-07-24 08:39:34 +03:00
parent 6da4b7e09d
commit 9f33a8277c

View File

@@ -103,7 +103,7 @@ function InstallDependenciesDebian {
echo "done" echo "done"
# install curl for later tasks if missing # install curl for later tasks if missing
if [[ ! $(which curl) ]]; then if [[ -z $(which curl) ]]; then
echo echo
echo -n "Installing curl..." echo -n "Installing curl..."
apt-get install -y curl >/dev/null apt-get install -y curl >/dev/null
@@ -161,6 +161,7 @@ function UpdateNodeYarn {
} 2>$LOGFILE } 2>$LOGFILE
function InstallXOPlugins { function InstallXOPlugins {
if [[ "$PLUGINS" ]] && [[ ! -z "$PLUGINS" ]]; then if [[ "$PLUGINS" ]] && [[ ! -z "$PLUGINS" ]]; then
echo echo
@@ -188,7 +189,7 @@ function InstallXO {
set -e set -e
TIME=`date +%Y%d%m%H%M` TIME=$(date +%Y%d%m%H%M)
# Create user if doesn't exist (if defined) # Create user if doesn't exist (if defined)
@@ -315,12 +316,12 @@ function InstallXO {
echo echo
echo "Looks like there was a problem when starting xo-server/reading journalctl. Please see logs for more details" echo "Looks like there was a problem when starting xo-server/reading journalctl. Please see logs for more details"
fi fi
} 2>$LOGFILE } 2>$LOGFILE
function UpdateXO { function UpdateXO {
if [[ $(ps aux | grep xo-server | grep -v grep) ]]; then if [[ $(ps aux | grep xo-server | grep -v grep) ]]; then
/bin/systemctl stop xo-server || { echo "failed to stop service, exiting..." ; exit 1; } /bin/systemctl stop xo-server || { echo "failed to stop service, exiting..." ; exit 1; }
fi fi
@@ -332,6 +333,7 @@ function UpdateXO {
echo -n "Removing old installations (leaving 3 latest)..." echo -n "Removing old installations (leaving 3 latest)..."
find $INSTALLDIR/xo-builds/ -maxdepth 1 -type d -name "xen-orchestra*" -printf "%T@ %p\n" | sort -n | cut -d' ' -f2- | head -n -3 | xargs -r rm -r find $INSTALLDIR/xo-builds/ -maxdepth 1 -type d -name "xen-orchestra*" -printf "%T@ %p\n" | sort -n | cut -d' ' -f2- | head -n -3 | xargs -r rm -r
echo "done" echo "done"
} 2>$LOGFILE } 2>$LOGFILE
function UpdateXOAutomate { function UpdateXOAutomate {
@@ -347,6 +349,7 @@ function UpdateXOAutomate {
esac esac
} }
function CheckOS { function CheckOS {
if [ -f /etc/centos-release ] ; then if [ -f /etc/centos-release ] ; then
@@ -375,7 +378,7 @@ function CheckOS {
function CheckSystemd { function CheckSystemd {
if [ ! $(which systemctl) ]; then if [ -z $(which systemctl) ]; then
echo "This tool is designed to work with systemd enabled systems only" echo "This tool is designed to work with systemd enabled systems only"
exit 0 exit 0
fi fi
@@ -401,8 +404,10 @@ echo " uncomment and edit XOUSER variable in this script to run service as unpr
echo " (Notice that you might have to make other changes depending on your system for this to work)" echo " (Notice that you might have to make other changes depending on your system for this to work)"
echo " This method only changes the user which runs the service. Other install tasks like node packages are still ran as root" echo " This method only changes the user which runs the service. Other install tasks like node packages are still ran as root"
echo echo
echo "- Data stored in redis and /var/lib/xo-server/data will not be touched"
echo "- Option 2. actually creates a new build from sources but works as an update to installations originally done with this tool" echo "- Option 2. actually creates a new build from sources but works as an update to installations originally done with this tool"
echo " NodeJS and Yarn packages are updated automatically. Check AUTOUPDATE variable to disable this"
echo " Data stored in redis and /var/lib/xo-server/data will not be touched during update procedure."
echo " 3 latest installations will be preserved and older ones are deleted after successful update. Fresh installation is symlinked as active"
echo echo
echo "- To run option 2. without interactive mode (as cronjob for automated updates for example) use --update" echo "- To run option 2. without interactive mode (as cronjob for automated updates for example) use --update"
echo echo