fix for installation to work with new .toml configuration files. also keep support for old .yaml just in case
This commit is contained in:
@@ -402,25 +402,50 @@ function InstallXO {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Fixing relative path to xo-web installation in xo-server configuration file"
|
echo "Fixing relative path to xo-web installation in xo-server configuration file"
|
||||||
sed -i "s/#'\/': '\/path\/to\/xo-web\/dist\//'\/': '..\/xo-web\/dist\//" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.yaml
|
|
||||||
sleep 2
|
|
||||||
|
|
||||||
if [[ $PORT != "80" ]]; then
|
# temporarily look for .yaml file first, if not found then assume that new .toml format exists
|
||||||
echo "Changing port in xo-server configuration file"
|
if [[ -f $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.yaml ]]; then
|
||||||
sed -i "s/port: 80/port: $PORT/" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.yaml
|
sed -i "s/#'\/': '\/path\/to\/xo-web\/dist\//'\/': '..\/xo-web\/dist\//" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.yaml
|
||||||
sleep 2
|
sleep 2
|
||||||
fi
|
|
||||||
|
|
||||||
if $HTTPS ; then
|
if [[ $PORT != "80" ]]; then
|
||||||
echo "Enabling HTTPS in xo-server configuration file"
|
echo "Changing port in xo-server configuration file"
|
||||||
sed -i "s%# cert: '.\/certificate.pem'% cert: '$PATH_TO_HTTPS_CERT'%" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.yaml
|
sed -i "s/port: 80/port: $PORT/" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.yaml
|
||||||
sed -i "s%# key: '.\/key.pem'% key: '$PATH_TO_HTTPS_KEY'%" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.yaml
|
sleep 2
|
||||||
sed -i "s/#redirectToHttps/redirectToHttps/" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.yaml
|
fi
|
||||||
sleep 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Activating modified configuration file"
|
if $HTTPS ; then
|
||||||
mv $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.yaml $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/.xo-server.yaml
|
echo "Enabling HTTPS in xo-server configuration file"
|
||||||
|
sed -i "s%# cert: '.\/certificate.pem'% cert: '$PATH_TO_HTTPS_CERT'%" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.yaml
|
||||||
|
sed -i "s%# key: '.\/key.pem'% key: '$PATH_TO_HTTPS_KEY'%" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.yaml
|
||||||
|
sed -i "s/#redirectToHttps/redirectToHttps/" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.yaml
|
||||||
|
sleep 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Activating modified configuration file"
|
||||||
|
mv $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.yaml $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/.xo-server.yaml
|
||||||
|
|
||||||
|
else
|
||||||
|
sed -i "s/#'\/' = '\/path\/to\/xo-web\/dist\//'\/' = '..\/xo-web\/dist\//" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.toml
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
if [[ $PORT != "80" ]]; then
|
||||||
|
echo "Changing port in xo-server configuration file"
|
||||||
|
sed -i "s/port = 80/port = $PORT/" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.toml
|
||||||
|
sleep 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
if $HTTPS ; then
|
||||||
|
echo "Enabling HTTPS in xo-server configuration file"
|
||||||
|
sed -i "s%# cert = '.\/certificate.pem'%cert = '$PATH_TO_HTTPS_CERT'%" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.toml
|
||||||
|
sed -i "s%# key = '.\/key.pem'%key = '$PATH_TO_HTTPS_KEY'%" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.toml
|
||||||
|
sed -i "s/# redirectToHttps/redirectToHttps/" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.toml
|
||||||
|
sleep 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Activating modified configuration file"
|
||||||
|
mv $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.toml $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/.xo-server.toml
|
||||||
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Symlinking fresh xo-server install/update to $INSTALLDIR/xo-server"
|
echo "Symlinking fresh xo-server install/update to $INSTALLDIR/xo-server"
|
||||||
|
Reference in New Issue
Block a user