#!/bin/bash # This script automatically downloads and installs the appropriate Netrinos client # for the current system architecture. It should be run with superuser privileges. # # Usage: # sudo ./install-client.sh [version] [cli] # # or directly from the shell with: # # curl -fsSL https://dist.netrinos.com/linux/install-client.sh | sudo bash -s [version] [cli] # # Parameters: # version - latest (default), daily, beta, or specific version number # cli - optional flag to install CLI-only version (no GUI) # # The script first detects the system architecture, then downloads the appropriate # .deb package from the Netrinos distribution server. After downloading, it installs # the package using dpkg. # # Examples: # bash -s latest # Install latest UI version # bash -s daily cli # Install daily CLI-only version # bash -s cli # Install latest CLI-only version # Detect the system architecture detected_arch=$(uname -m) # Parse arguments - look for 'cli' flag anywhere in args cli_mode=false version="latest" for arg in "$@"; do arg_lower=${arg,,} if [ "$arg_lower" = "cli" ]; then cli_mode=true else version="$arg_lower" fi done # Define the base URL of the .deb packages base_url="https://dist.netrinos.com/linux" # If version = latest, set folder = latest case "$version" in beta) base_url="$base_url/beta" ;; daily) base_url="$base_url/daily" ;; latest) # latest is in main folder ;; *) base_url="$base_url/archive" ;; esac # Choose the appropriate .deb package based on the architecture case "$detected_arch" in x86_64) arch="amd64" ;; arm) arch="arm" ;; aarch64) arch="arm64" ;; armhf|armv6l|armv7l) arch="armhf" ;; *) echo "Unsupported architecture: $detected_arch" exit 1 ;; esac # Define the filename based on cli_mode if [ "$cli_mode" = true ]; then filename="netrinos-cli-linux_${version}_${arch}.deb" echo "Installing CLI-only version..." else filename="netrinos-client-linux_${version}_${arch}.deb" fi # Define the URL url="$base_url/$filename" echo Using: $url # Define the temporary file tmpfile=$(mktemp) # Download the .deb package wget -O "$tmpfile" "$url" # Install the .deb package sudo dpkg -i "$tmpfile" # If dpkg reports an error due to missing dependencies, you can install them with apt: sudo apt-get install -f -y # Save the upgrade channel preference if [ -x /usr/local/bin/netrinos ]; then echo "Setting upgrade channel to: $version" /usr/local/bin/netrinos upgrade channel "$version" >/dev/null 2>&1 || true fi