github.com/mysteriumnetwork/node@v0.0.0-20240516044423-365054f76801/bin/package/raspberry/files/1-setup-node.sh (about)

     1  #!/bin/bash -v
     2  
     3  export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
     4  export DEBIAN_FRONTEND="noninteractive"
     5  
     6  # Adds APT source once (no repeated entries)
     7  add_apt_source() {
     8    local src=$1
     9    local src_file=$2
    10    grep -qF "$src" "$src_file" || echo "$src" | tee -a "$src_file"
    11  }
    12  
    13  # Enable SSH access
    14  touch /boot/ssh
    15  
    16  # Add APT sources
    17  add_apt_source "deb http://ppa.launchpad.net/mysteriumnetwork/node/ubuntu focal main" "/etc/apt/sources.list.d/mysterium.list"
    18  apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ECCB6A56B22C536D
    19  
    20  add_apt_source "deb http://deb.debian.org/debian/ unstable main" "/etc/apt/sources.list.d/unstable.list"
    21  wget -O - https://ftp-master.debian.org/keys/archive-key-$(lsb_release -sr).asc | sudo apt-key add -
    22  printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' | sudo tee --append /etc/apt/preferences.d/limit-unstable
    23  
    24  # Import missing keys
    25  apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9
    26  apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6ED0E7B82643E131
    27  
    28  apt-get update --allow-releaseinfo-change
    29  
    30  # Install myst dependencies
    31  apt-get -y install \
    32    wireguard \
    33    openvpn
    34  
    35  # Setup unattended upgrades
    36  apt-get -y install \
    37    unattended-upgrades
    38  if [[ "${RELEASE_BUILD}" == "true" ]]; then
    39    echo "Release build, setting up auto-update"
    40    install --mode=644 unattended-upgrades /etc/apt/apt.conf.d/50unattended-upgrades
    41    install --mode=644 auto-upgrades /etc/apt/apt.conf.d/20auto-upgrades
    42  fi
    43  
    44  # Install myst
    45  install --mode=644 default-myst-conf /etc/default/mysterium-node
    46  mkdir -p /etc/mysterium-node
    47  install --mode=644 config.toml /etc/mysterium-node/config.toml
    48  chmod 755 myst_linux_armhf.deb
    49  yes | dpkg --install --force-depends myst_linux_armhf.deb
    50  chown -R mysterium-node:mysterium-node /etc/mysterium-node