-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathinstall_linux
executable file
·48 lines (43 loc) · 2.04 KB
/
install_linux
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
#!/bin/bash
# ************install script**************************************************
#
# This will install correct version of powershell. No dependencies should be
# be required.
#
# This should be ran as root, so that it can make pwsh an exectuable.
#
# This will also run install.ps1, which will install commands in /usr/bin
# so that they can be open from any terminal. To see list of commands
# run command 'get help' after running this script.
#
# This is independent of swarm.ps1 in case user attempts to start swarm
# not as a root user. I however cannot gurantee miners will work, nor will
# they not have issues if they attempt to run swarm not as root.
# *******************************************************************************
## If powershell doesn't exist- Assume it is a first time run.
if ! [ -x "$(command -v pwsh)" ]; then
echo 'pwsh not found- installing 6.2.4'
wget https://github.com/PowerShell/PowerShell/releases/download/v6.2.4/powershell-6.2.4-linux-x64.tar.gz -O /tmp/powershell.tar.gz --no-check-certificate
mkdir -p /opt/microsoft/powershell/6.2.4
tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/6.2.4
chmod +x /opt/microsoft/powershell/6.2.4/pwsh
ln -s /opt/microsoft/powershell/6.2.4/pwsh /usr/bin/pwsh
rm -rf /tmp/powershell.tar.gz
chmod 777 -R $HOME/.local/share/powershell
fi
PVERSION=`pwsh -version`
## If pwsh is wrong version, install it again.
if [ "$PVERSION" != "PowerShell 6.2.4" ]; then
echo "updating powershell to latest version"
rm -rf /opt/microsoft/powershell/6.2.3
rm -rf /usr/bin/pwsh
wget https://github.com/PowerShell/PowerShell/releases/download/v6.2.4/powershell-6.2.4-linux-x64.tar.gz -O /tmp/powershell.tar.gz --no-check-certificate
mkdir -p /opt/microsoft/powershell/6.2.4
tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/6.2.4
chmod +x /opt/microsoft/powershell/6.2.4/pwsh
ln -s /opt/microsoft/powershell/6.2.4/pwsh /usr/bin/pwsh
rm -rf /tmp/powershell.tar.gz
fi
## Run install script per command request.
echo 'starting install script'
pwsh -command ".\build\powershell\scripts\install.ps1"