Clear Across Kansas

Creating a YSFReflector

The YSFReflector registration site: https://register.ysfreflector.de/

How To Install and Configure a YSFReflector

Prerequisites:

  • Raspberry Pi (any model) with SD card imaged with Raspbian Stretch Lite
  • Installing on an older version of Raspbian or Debian may require adjusting file paths, etc.

Log in as root (or su -).

Update your system:
apt-get update && apt-get upgrade

Install git:
apt-get install git

Copy the source code from github:
git clone https://github.com/g4klx/YSFClients.git

This copies the actual sources of the whole YSFClients-Project into a folder “YSFClients”. Within this directory you’ll find a folder “YSFReflector”.

Type cd ./YSFClients/YSFReflector

then make clean all

A minute later the compile process is done and you have an executable file “YSFReflector”.

Within the directory you also have YSFReflector.ini that you need to customize to your own needs. Fill in the following:
Name=Your Reflector's name
Description=Your Reflector's description
FilePath=/usr/local/bin/
FileRoot=YSFReflector

There is also a line

Daemon=1

that forces the reflector-executable to run as a deamon after startup. For this you’ll need to setup a user “mmdvm” on your linux-system. This can be done with:
groupadd mmdvm
useradd mmdvm -g mmdvm -s /sbin/nologin

As a last step of installation, you may want to have the services started automatically at boot. Therefore you’ll need a start-up script. Using WinSCP, browse to /etc/init.d and create a file called YSFReflector.sh and paste the following text:

#!/bin/bash
### BEGIN INIT INFO
#
# Provides:             YSFReflector
# Required-Start:       $all
# Required-Stop:        
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description:    Example startscript YSFReflector

#
### END INIT INFO
## Fill in name of program here.
PROG="YSFReflector"
PROG_PATH="/usr/local/bin/"
PROG_ARGS="/etc/YSFReflector.ini"
PIDFILE="/var/run/YSFReflector.pid"
USER="root"

start() {
      if [ -e $PIDFILE ]; then
          ## Program is running, exit with error.
          echo "Error! $PROG is currently running!" 1>&2
          exit 1
      else
          cd $PROG_PATH
          ./$PROG $PROG_ARGS
          echo "$PROG started"
          touch $PIDFILE
      fi
}

stop() {
      if [ -e $PIDFILE ]; then
          ## Program is running, so stop it
         echo "$PROG is running"
         rm -f $PIDFILE
         killall $PROG
         echo "$PROG stopped"
      else
          ## Program is not running, exit with error.
          echo "Error! $PROG not started!" 1>&2
          exit 1
      fi
}

## Check to see if we are running as root first.
## Found at
## http://www.cyberciti.biz/tips/shell-root-user-check-script.html
if [ "$(id -u)" != "0" ]; then
      echo "This script must be run as root" 1>&2
      exit 1
fi

case "$1" in
      start)
          start
          exit 0
      ;;
      stop)
          stop
          exit 0
      ;;
      reload|restart|force-reload)
          stop
          sleep 5
          start
          exit 0
      ;;
      **)
          echo "Usage: $0 {start|stop|reload}" 1>&2
          exit 1
      ;;
esac
exit 0
### END

Move the binary and .ini files to their proper places:
cd /YSFClients/YSFReflector
mv YSFReflector /usr/local/bin
mv YSFReflector.ini /etc

To enable the service:
apt-get install chkconfig
chkconfig YSFReflector.sh on

To start the service simply reboot. reboot

One final word: Every (system-relevant) changes you make (for example name or description) are updated automatically in the registration-database by polling-mechanism each 5 minutes. If you want to change hostname/ip-address or port-number, you can do this in the self-service after logging in.

The YSFReflector Dashboard can be installed from source by following instructions from here:

https://github.com/dg9vh/YSFReflector-Dashboard

This short how-to describes step-by-step how to install the YSFReflector-Dashboard on a system using a Debian Linux distribution.

## Installation Steps (as root) ##

Install a webserver:

apt-get install apache2

Create a group for the webserver and add yourself to it:
groupadd www-data
usermod -G www-data -a

Set permissions so you and the webserver have full access to the files:
chown -R www-data:www-data /var/www/html
chmod -R 775 /var/www/html

Install PHP5 and enable the required modules:
apt-get install php7.0-common php7.0-cgi php7.0

Now you can clone the dashboard into your home directory:

cd ~
git clone https://github.com/dg9vh/YSFReflector-Dashboard.git

Next, you need to copy the files into the webroot so they can be served by apache2:
cp -R /root/YSFReflector-Dashboard/* /var/www/html/

To make sure the dashboard is served instead of the default “index.html”:
rm /var/www/html/index.html

To enable PHP in Apache2:
apt-get install libapache2-mod-php7.0

Next configure the dashboard by pointing your browser to http://IP-OF-YOUR-YSFREFLECTOR/setup.php
When configuring the dashboard, make sure to set the correct paths for logs, etc. If they are wrong, no last-heard or similar information will be shown on the dashboard!
This will create /var/www/html/config/config.php which contains your custom settings.

Now the dashboard should be reachable via http://IP-OF-YOUR-YSFREFLECTOR/

Finally, after verifying everything is working correctly, remove or rename the setup.php file so “hackers” can’t modify your config:
rm /var/www/html/setup.php

Note: It may take 24 to 48 hours for your new reflector to appear in Pi-Star’s reflector list.

Notice: These instructions are provided here for my own future reference. You may use them, provided that you understand that:

  • This is not my software and I didn’t write it.
  • These instructions are provided without warranty.
  • Spend some time researching a problem before asking for a quick answer.

Recent Posts