-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXOA-Updater.sh
More file actions
executable file
·62 lines (51 loc) · 1.63 KB
/
Copy pathXOA-Updater.sh
File metadata and controls
executable file
·62 lines (51 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
# xo-updater (early version)
NODEVER="v22.22.3"
curl -L -s -o /tmp/node-${NODEVER}-linux-x64.tar.gz https://nodejs.org/dist/latest-v20.x/node-${NODEVER}-linux-x64.tar.gz
tar -C /tmp -xzf /tmp/node-${NODEVER}-linux-x64.tar.gz
CURD=`pwd`
cd /tmp/node-${NODEVER}-linux-x64
rsync -a bin include lib share /usr/local/
cd ${CURD}
npm update yarn --global
find /opt/xen-orchestra -iname \*.rej -o -iname \*.orig -exec rm {} \;
cd /opt/xen-orchestra
# cleanup last changes
git checkout .
for CHANGED in $(for FILE in $(cat series) ; do head -n2 $FILE ; done |grep -v orig | awk '{print $2}'|sort -u) ; do
git restore $CHANGED
done
git pull
/usr/local/bin/yarn
curl -s -L -o /root/series https://raw.githubusercontent.com/netmax79/XenOrchestra-Installer-Centos8/master/patches/series
for PATCH in $(cat /root/series) ; do
curl -s -L -o /root/${PATCH} https://raw.githubusercontent.com/netmax79/XenOrchestra-Installer-Centos8/master/patches/${PATCH}
done
GRC=0
for PATCH in $(cat /root/series) ; do
echo "Patch: ${PATCH}"
patch -p1 < /root/${PATCH}
RC=$?
GRC=$(expr $GRC + $RC)
done
if [ "$GRC" -gt 0 ] ; then
echo "Patches not fully applied, error combined error code is: $GRC"
exit 1
fi
/usr/local/bin/yarn build
systemctl stop xo-server
/bin/cat << EOF > /etc/systemd/system/xo-server.service
# Systemd service for XO-Server.
[Unit]
Description= XO Server
After=network-online.target
[Service]
WorkingDirectory=/opt/xen-orchestra/packages/xo-server/
ExecStart=/usr/local/bin/node ./dist/cli.mjs
Restart=always
SyslogIdentifier=xo-server
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl start xo-server