From 8bd5867fe9b1174fade741f698f82d884621026e Mon Sep 17 00:00:00 2001 From: Tim Sedlmeyer Date: Wed, 11 Apr 2018 18:08:36 -0400 Subject: [PATCH 1/2] Use $INSTALLDIR when setting working directory Fix WorkingDirectory for systemd service configuration being hardcoded to /etc/xo/xo-server. --- xo-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xo-install.sh b/xo-install.sh index f125d6b..2566bda 100755 --- a/xo-install.sh +++ b/xo-install.sh @@ -170,7 +170,7 @@ function InstallXO { 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 "Adding WorkingDirectory parameter to systemd service configuration" - sed -i "/ExecStart=.*/a WorkingDirectory=/etc/xo/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 echo "Adding user to systemd config" From 444307193a3931ecdeceb209504ce6292dd64151 Mon Sep 17 00:00:00 2001 From: Tim Sedlmeyer Date: Wed, 11 Apr 2018 18:54:03 -0400 Subject: [PATCH 2/2] Use 'id -u' to check for root Root user is not always named root but is always uid 0 --- xo-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xo-install.sh b/xo-install.sh index 2566bda..46748be 100755 --- a/xo-install.sh +++ b/xo-install.sh @@ -14,7 +14,7 @@ function CheckUser { # Make sure the script is ran as root - if [[ ! $(whoami) == "root" ]]; then + if [[ ! "$(id -u)" == "0" ]]; then echo "This script needs to be ran as root" exit 0 fi