RmsGateway Install and Update script

C. Schuman wrote a script to install and update RMS Gateway. It`s very handy now the are very busy with updating the code of RMS Gateway to handle the new demands of Winlink.

You just have to pay attention to these lines of code that you have the right version.

cd /usr/local/src/ax25
#wget -qt 3 http://k4gbb.us/docs/scripts/rmsgw-2.4.0-181.tgz || /
wget -qt 3 http://k4gbb.no-ip.info/docs/scripts/rmsgw-2.4.0-181.1.tar.bz2
#wget -qt 3 http://www.w3sg.org/RMSGW/download/rmsgw-2.4.0-181.tgz
tar xf rmsgw-2.4.0-181.1.tar.bz2

The version rmsgw-2.4.0-181.1.tar.bz2 is of 14-Sep-2018 16:41

#!/bin/bash
# Installs/Updates the Linux RMS Gateway
# Provided by C Schuman, K4GBB k4gbb1gmail.com
#	Updated 30 Oct 2014

# Color Codes
Reset='\e[0m'
Red='\e[31m'
Green='\e[32m'
Yellow='\e[33m'
Blue='\e[34m'
White='\e[37m'
BluW='\e[37;44m'

UDATE="NO"
GWOWNER="rmsgw"

# Check  User ID

    if [ $UID != 0 ]; then
	echo "You must be root User to perform installation!"
	exit 1
    fi

echo -e "${BluW}\n \t  Install/Update Linux RMS Gate \n${Yellow}\t     version 2.4.0-181  \t \n \t \n${White}  Script provided by Charles S. Schuman ( K4GBB )  \n${Red}               k4gbb1@gmail.com \n${Reset}"

echo -e "${BluW}\t Installing Support libraries \t${Reset}"
apt-get install xutils-dev libxml2 libxml2-dev python-requests -y -q
apt-get install build-essential libax25-dev libx11-dev zlib1g-dev libncurses5-dev -y -q

#  create the group for the gateway if it doesn't exist
    grep "rmsgw:" /etc/group >/dev/null 2>&1
    if [ $? -ne 0 ]; then
	echo "Creating group rmsgw..."
	groupadd rmsgw
    fi

#  create the gateway user if it doesn't exist and lock the account

    grep "rmsgw:" /etc/passwd >/dev/null 2>&1
    if [ $? -ne 0 ]; then
	#
	# create the account
	#
 	echo "Creating user rmsgw..."
 	useradd -s /bin/false -g rmsgw rmsgw
    fi

  # lock the account to prevent a potential hole, unless the
  # owner is root
    if [ "$GWOWNER" != root ]; then
	echo "Locking user account $GWOWNER..."
	passwd -l $GWOWNER >/dev/null
	# while the account is locked, make the password to
	# never expire so that cron will be happy
	chage -E-1 $GWOWNER >/dev/null
    fi

echo -e "${BluW}\t Downloading RMS Source file \t${Reset}"

cd /usr/local/src/ax25
#wget -qt 3 http://k4gbb.us/docs/scripts/rmsgw-2.4.0-181.tgz || /
wget -qt 3 http://k4gbb.no-ip.info/docs/scripts/rmsgw-2.4.0-181.1.tar.bz2
#wget -qt 3 http://www.w3sg.org/RMSGW/download/rmsgw-2.4.0-181.tgz
tar xf rmsgw-2.4.0-181.1.tar.bz2
if [ $? -ne 0 ]
   then
 echo -e "${BluW}${Red}\t RMS File not available \t${Reset}"
 exit 1
fi

echo -e "${BluW}\t Compiling RMS Source file \t${Reset}"
cd rmsgw-2.4.0-181.1
make > RMS.txt

if [ $? -ne 0 ]
   then
 echo -e "${BluW}$Red} \tCompile error${White} - check RMS.txt File \t${Reset}"
 exit 1
   else 
 rm RMS.txt
fi
make install
echo -e "${BluW}RMS Gate Installed \t${Reset}"

# Add RMS_ACI to Crontab
cat /etc/crontab|grep rmsgw || echo "#6,36 *  * * *   rmsgw    /usr/local/bin/rmsgw_aci > /dev/null 2>&1
# (End) " >> /etc/crontab

# Install Logging
if [ ! -f "/etc/rsyslog.d/60-rmsgw.conf" ]; then
echo "# RMS Gate" > /etc/rsyslog.d/60-rms.conf 
echo "        local0.info                     /var/log/rms" >> /etc/rsyslog.d/60-rms.conf 
echo "        local0.debug                    /var/log/rms.debug" >> /etc/rsyslog.d/60-rms.conf
echo "        #local0.debug                   /dev/null" >> /etc/rsyslog.d/60-rms.conf 
echo "
# (End)" >> /etc/rsyslog.d/60-rms.conf 

service restart rsyslog
fi

# Use old rmschanstat file.
if [ -f /usr/local/bin/rmschanstat.~1~ ] ; then
    cp /usr/local/bin/rmschanstat.~1~ /usr/local/bin/rmschanstat
fi

date >> /root/Changes
echo "        RMS Gate Installed - rmsgw-2.4.0-181" >> /root/Changes
echo -e "${BluW} Be Sure to Update/Edit the channels.xml and gateway.config file${Reset}"
exit 0
# (End of Script)