#!/bin/bash ################################################################################ ################################################################################ ####################### AmRRON Vara Setup ######################### ####################### Created by TB-14 ######################### ####################### 05 NOV 2022 ######################### ################################################################################ ################################################################################ ### This script will perform basic setup for VARA. ### Tested on Mint 21 ### Using guidance and tools from TK-05, KM4ACK, ptitSeb, Box86, and KI7POL #### Program setup functions # Find out if we have yad and install if not echo "Yad is used to create the interactive menus this program uses." echo "If yad is not installed, we will attempt to install it now." sleep 2 if ! hash yad 2>/dev/null; then sudo apt-get -y install yad || { echo "Yad install failed. Yad is required to run this installer. Please install yad and try again or check your internet connection."; exit 1; } fi # Find the screen size. Will default to 800x480 if it can not be detected. function set_screen_size() { screen_size=$(xdpyinfo | grep dimensions | \ sed -r 's/^[^0-9]*([0-9]+x[0-9]+).*$/\1/' | sed s/x/" "/ || echo 800 480) width=$(echo $screen_size | awk '{print $1}') height=$(echo $screen_size | awk '{print $2}') #xdpyinfo | grep 'dimensions:' # Divide by two so the dialogs take up half of the screen, which looks nice. rows=$(( height / 2 )) columns=$(( width / 2 )) # Unless the screen is tiny rows=$(( rows < 400 ? 400 : rows )) columns=$(( columns < 700 ? 700 : columns )) c="--width=${columns}" r="--height=${rows}" } # Determine location user is running script from. SOURCE="${BASH_SOURCE[0]}" # While $SOURCE is a symlink, resolve it while [ -h "$SOURCE" ]; do DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" SOURCE="$( readlink "$SOURCE" )" # If $SOURCE was a relative symlink (so no "/" as prefix, need to #resolve it relative to the symlink base directory [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" done DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" #echo "$DIR" #Set image location # Create a error function to make life easier later on function errors() { echo "${ERRCODE}" >> /tmp/failures } #Deterimine computer type. function noOS_Support() { yad --image=$DIR/images/corps-icon.png --center --no-buttons \ --title "INVALID OS DETECTED" \ --text "A valid OS was not detected.\n\nThis installer was designed for \ Debian based distros; specifically Raspbian Stretch, Linux Mint 18.3 / 19.1 and Ubuntu 18.04." \ ${r} ${c} exit 1 } function maybeOS_Support() { if (yad --image=$DIR/images/corps-icon.png --center \ --title "Not Supported OS" \ --text "Your OS may be compatible with this installer but has not been \ tested.\n\nThis installer has been tested on Raspberry Pi OS Buster and Bullseye \ (32bit and 64bit), Linux Mint 20.3 and 21. It should work on most Debian 10 / 11 based distros. \n\nWould you like to continue anyway?" ${r} ${c}) then yad --image=$DIR/images/corps-icon.png --center \ --title "Not Supported OS" \ --text "::: Did not detect perfectly supported OS but,\n\n \ ::: Continuing installation at user's own risk..." ${r} ${c} || { echo "exiting"; exit 1; } else yad --image=$DIR/images/corps-icon.png --center \ --title "Not Supported OS" \ --text "::: Exiting due to unsupported OS" ${r} ${c} exit 1 fi } # Compatibility check for OS # if lsb_release command is on their system if hash lsb_release 2>/dev/null; then PLAT=$(lsb_release -si) OSCN=$(lsb_release -sc) # We want this to be trusty xenial bionic cosmic disco; jessie strech buster; sara serena sonya sylvia tara tessa tina else # else get info from os-release PLAT=$(grep "^NAME" /etc/os-release | awk -F "=" '{print $2}' | tr -d '"' \ | awk '{print $1}') VER=$(grep "VERSION_ID" /etc/os-release | awk -F "=" '{print $2}' | tr -d '"') declare -A VER_MAP=(["11"]="bullseye" ["10"]="buster" ["9"]="stretch" ["8"]="jessie" ["16.04"]="xenial" \ ["14.04"]="trusty" ["18.04"]="bionic" ["18.10"]="cosmic" ["19.04"]="disco" ["19.10"]="eoan" ["20.04"]="focal" ["18"]="sara" ["18.1"]="serena" \ ["18.2"]="sonya" ["18.3"]="sylvia" ["19"]="tara" ["19.1"]="tessa" ["19.2"]="tina" ["19.3"]="tricia" ["20"]="ulyana" ["20.3"]="una" ["21"]="vanessa" ) OSCN=${VER_MAP["${VER}"]} fi case ${PLAT} in Raspbian|Debian|Linuxmint) case ${OSCN} in buster|bullseye|una|vanessa) ;; *) maybeOS_Support ;; esac ;; *) noOS_Support ;; esac #create a finish trap function finish { if [[ -f /tmp/results ]]; then rm /tmp/results fi if [[ -f /tmp/mastermenu ]]; then rm /tmp/mastermenu fi if [[ -f /tmp/cleanup ]]; then rm /tmp/cleanup fi if [[ -f /tmp/failures ]]; then rm /tmp/failures fi } trap finish EXIT ##make sure we dont already have a cleanup, mastermenu, or results text file if [[ -f /tmp/results ]]; then echo "Results file previously exists. Moving to /tmp/results.bak" mv /tmp/results /tmp/results.bak fi if [[ -f /tmp/mastermenu ]]; then echo "/tmp/mastermenu file previously exists. Moving to /tmp/mastermenu.bak" mv /tmp/mastermenu /tmp/mastermenu.bak fi if [[ -f /tmp/cleanup ]]; then echo "/tmp/cleanup file previously exists. Moving to /tmp/cleanup.bak" mv /tmp/cleanup /tmp/cleanup.bak fi if [[ -f /tmp/failures ]]; then echo "/tmp/failures file previously exists. Moving to /tmp/failures.bak" mv /tmp/failures /tmp/failures.bak fi function confirm_mint21() { if [ $OSCN != vanessa ]; then yad --image=$DIR/images/corps-icon.png --center \ --title "Not Supported OS" \ --text "::: Exiting due to unsupported OS. This script has only been tested on Mint 21 at this time." ${r} ${c} exit 1 fi } ################# VARAHFVER=$(curl -s https://rosmodem.wordpress.com/ | grep -m 1 "VARA HF" | awk -F "VARA HF" '{print $2}' | awk -F " " '{print $1}' | sed s/\ //g) VARAFMVER=$(curl -s https://rosmodem.wordpress.com/ | grep -m 1 "VARA FM" | awk -F "VARA FM" '{print $2}' | awk -F " " '{print $1}' | sed s/\ //g) VARACHATVER=$(curl -s https://rosmodem.wordpress.com/ | grep -m 1 "VARA Chat" | awk -F "VARA Chat" '{print $2}' | awk -F " " '{print $1}' | sed s/\ //g) VARAFMLINK=$(curl -s https://rosmodem.wordpress.com/ | grep -oP '(?=https://mega.nz).*?(?=" target="_blank" rel="noopener noreferrer">VARA FM v)') VARAHFLINK=$(curl -s https://rosmodem.wordpress.com/ | grep -oP '(?=https://mega.nz).*?(?=" target="_blank" rel="noopener noreferrer">VARA HF v)') VARACHATLINK=$(curl -s https://rosmodem.wordpress.com/ | grep -oP '(?=https://mega.nz).*?(?=" target="_blank" rel="noopener noreferrer">VARA Chat v)') function usergroups() { clear;echo echo "adding user to tty, dialout, & audio groups" sleep 1 MYUSER=$(whoami) CHK_DIALOUT=$(id -nG | grep dialout) CHK_TTY=$(id -nG | grep tty) CHK_AUDIO=$(id -nG | grep audio) if [ -z "$CHK_DIALOUT" ]; then echo "Adding user to dialout group" sudo usermod -a -G dialout $MYUSER else echo "User already in dialout group" fi if [ -z "$CHK_TTY" ]; then echo "Adding user to tty group" sudo usermod -a -G tty $MYUSER else echo "User already in tty group" fi if [ -z "$CHK_AUDIO" ]; then echo "Adding user to audio group" sudo usermod -a -G audio $MYUSER else echo "User already in audio group" fi } function install_wine() { export WINEARCH=win32 #install dependencies sudo apt install -y wine-stable winetricks #install with wintricks winetricks winxp winetricks sound=pulse winetricks vb6run winetricks -q vcrun2015 #Install Driver cd $HOME/Downloads wget http://files.k6eta.com/pdh.dll.zip unzip pdh.dll.zip && rm pdh.dll.zip mv pdh.dll $HOME/.wine/drive_c/windows/system32 } function installvara() { #download/install VARA HF/FM sudo apt install -y megatools curl p7zip-full mkdir -P $USERDIR/VARA && cd $USERDIR/VARA megadl $VARAHFLINK megadl $VARAFMLINK megadl $VARACHATLINK echo "unzipping VARA files" sleep 1 unzip VARA\ FM\ $VARAFMVER\ Setup.zip unzip VARA\ HF\ $VARAHFVER\ Setup.zip unzip VARA\ Chat\ $VARACHATVER\ Setup.zip rm VARA\ FM\ $VARAFMVER\ Setup.zip VARA\ HF\ $VARAHFVER\ Setup.zip VARA\ Chat\ $VARACHATVER\ Setup.zip #install VARA FM with wine /usr/bin/wine VARA\ FM\ setup\ \(Run\ as\ Administrator\).exe #install VARA with wine /usr/bin/wine VARA\ setup\ \(Run\ as\ Administrator\).exe } function installrmsexpress() { mkdir -P $USERDIR/Winlink && cd $USERDIR/Winlink wget -q -r -l1 -np -nd -A "Winlink_Express_install_*.zip" https://downloads.winlink.org/User%20Programs unzip Winlink_Express_install*.zip /usr/bin/wine Winlink_Express_install.exe } set_screen_size confirm_mint21 usergroups install_wine installvara installrmsexpress