#!/bin/bash
# script updated May-27-2026 on http://f6bvp.org
# Downloads ax25up, ax25stop, ax25restart and myfpac.sh from f6bvp.org
# and installs them in /usr/local/sbin
#
# Color Codes
Reset='\e[0m'
Red='\e[31m'
Green='\e[30;42m'   # Black/Green
Yellow='\e[33m'
YelRed='\e[31;43m'  # Red/Yellow
BluW='\e[37;44m'    # White/Blue

if [ "$(id -u)" != "0" ]; then
    echo "You need to be root to execute this script"
    exit 1
fi

echo -e "${BluW}\t\n\t Script provided by F6BVP for installing AX.25 sbin tools\t\n\t\t\t ${Red} May-27-2026 \n\t\t${Yellow}       bernard.f6bvp@gmail.com\n${Reset}"

SBIN=/usr/local/sbin

# List of tools to download and install
TOOLS="ax25up ax25stop ax25restart myfpac.sh"

for TOOL in $TOOLS ; do
    echo -e "${Green}\t Downloading $TOOL ...${Reset}"
    wget -q -O $SBIN/$TOOL http://f6bvp.org/$TOOL
    if [ $? -ne 0 ] ; then
        echo -e "${Red}\t ERROR : $TOOL download failed${Reset}"
        exit 1
    fi
    chmod 775 $SBIN/$TOOL
    echo -e "${Green}\t $TOOL installed in $SBIN${Reset}"
done

echo -e "${Green}\t\n\t ax25up, ax25stop, ax25restart and myfpac.sh successfully installed in $SBIN\n${Reset}"
#
