-
Notifications
You must be signed in to change notification settings - Fork 1
/
upgrade.sh
41 lines (31 loc) · 1.23 KB
/
upgrade.sh
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
#!/bin/bash
[[ $EUID -ne 0 ]] && echo "This script must be run as root." && exit 1
heading ()
{
echo -e "\n\n+- $1\n"
}
echo -e '\n\n\n\n####################\n#'
echo -e '# This will upgrade MilwaukeeMakerspaceApi on this system'
echo -e '#\n####################\n'
systemctl stop MilwaukeeMakerspaceApi
rm -rf /opt/MilwaukeeMakerspaceApiOldOld
mv /opt/MilwaukeeMakerspaceApiOld /opt/MilwaukeeMakerspaceApiOldOld
mv /opt/MilwaukeeMakerspaceApi /opt/MilwaukeeMakerspaceApiOld
mkdir -p /opt/MilwaukeeMakerspaceApi
# Update the OS
heading 'Updating Operating System'
apt-get -y update
apt-get -y dist-upgrade
# Install .Net Core
heading 'Installing .Net Core'
apt-get -y install dotnet-runtime-7.0 aspnetcore-runtime-7.0
# Install MmsPiFobReader
heading 'Installer MilwaukeeMakerspaceApi'
cd /root
curl -s https://api.github.com/repos/DanDude0/MilwaukeeMakerspaceApi/releases/latest | grep -P "(?<=browser_download_url\": \")https://.*zip" -o | wget -i -
unzip -o MmsApi.zip -d /opt/MilwaukeeMakerspaceApi
rm -f MmsApi.zip
cp -p /opt/MilwaukeeMakerspaceApiOld/appsettings.json /opt/MilwaukeeMakerspaceApi/appsettings.json
echo 'Upgrade completed, restarting service'
systemctl start MilwaukeeMakerspaceApi
systemctl status MilwaukeeMakerspaceApi