Skip to content

Commit

Permalink
Merge pull request #1451 from mysteriumnetwork/dpkg-install-sh
Browse files Browse the repository at this point in the history
Myst install through install.sh for Ubuntu
  • Loading branch information
zolia authored Dec 10, 2019
2 parents 6031b64 + a9faf0c commit 76c1af3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 8 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ Currently node supports OpenVPN as its underlying VPN transport.

Install latest stable release:
```bash
curl https://raw.githubusercontent.com/mysteriumnetwork/node/master/install.sh | sudo bash
sudo -E bash -c "$(curl -s https://raw.githubusercontent.com/mysteriumnetwork/node/master/install.sh)"
```

Or install latest snapshot (development build):
```bash
curl https://raw.githubusercontent.com/mysteriumnetwork/node/master/install.sh | SNAPSHOT=true sudo -E bash
SNAPSHOT=true sudo -E bash -c "$(curl -s https://raw.githubusercontent.com/mysteriumnetwork/node/master/install.sh)"
```

Service logs:
Expand All @@ -43,6 +43,8 @@ Service status:
sudo systemctl status mysterium-node.service
```

Installation script tested on these OSes so far: _Raspbian 10_, _Debian 9_, _Debian 10_, _Ubuntu 18.04_ and _Ubuntu 16.04_ .

### Docker

To run a node as docker container you will need [docker](https://www.docker.com/).
Expand Down
39 changes: 33 additions & 6 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
#!/bin/sh
#!/usr/bin/env bash

# Install latest release of myst for debian/raspbian
shopt -s extglob
set -e
set -o errtrace
set -o errexit
set -o pipefail

# Install latest release of myst for debian/ubuntu/raspbian
#
# Variables:
# - SNAPSHOT (default: false) - set to "true" to install development snapshot
#

set -e

if [[ "$SNAPSHOT" == "true" ]]; then
releases_url="http://api.github.com/repos/mysteriumnetwork/node-builds/releases"
else
Expand Down Expand Up @@ -40,6 +44,20 @@ get_linux_distribution() {
eval $__resultvar="'$result'"
}

get_version_codename() {
local __resultvar=$1
local result

if [[ -f "/etc/os-release" ]]; then
local id=$(awk -F= '$1=="VERSION_CODENAME" { print $2 ;}' /etc/os-release)
result="$id"
else
result="unknown"
fi

eval $__resultvar="'$result'"
}

get_architecture() {
local __resultvar=$1
local result
Expand Down Expand Up @@ -111,6 +129,13 @@ install_script_dependencies() {
}

install_dependencies() {
readonly local version_codename=$1

if [[ "$version_codename" == "xenial" ]]; then
curl -s https://swupdate.openvpn.net/repos/repo-public.gpg | apt-key add -
echo "deb http://build.openvpn.net/debian/openvpn/stable xenial main" > /etc/apt/sources.list.d/openvpn-aptrepo.list
fi

# Wireguard
echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable.list
printf 'Package: *\nPin: release a=unstable\nPin-Priority: 90\n' > /etc/apt/preferences.d/limit-unstable
Expand All @@ -135,15 +160,17 @@ echo "### Detecting platform"
get_os OS
get_architecture ARCH
get_linux_distribution DISTRO
echo "OS: $OS | architecture: $ARCH | distribution: $DISTRO"
get_version_codename VERSION_CODENAME

echo "OS: $OS | architecture: $ARCH | distribution: $DISTRO | version: $VERSION_CODENAME"
echo "### Detecting platform - done"

echo "### Downloading latest package"
download_latest_package PACKAGE_FILE $OS $ARCH $DISTRO
echo "### Downloading latest package - done: $PACKAGE_FILE"

echo "### Installing myst dependencies"
install_dependencies
install_dependencies $VERSION_CODENAME
echo "### Installing myst dependencies - done"

echo "### Installing myst & restarting service"
Expand Down

0 comments on commit 76c1af3

Please sign in to comment.