This is more for my documentation for myself but if it can help anyone else, feel free to use it.

This was partially compiled with the help of the K-Link Repeater Network Website for the Rasberry-Pi with edits below to work with Ubuntu 16

Prerequisites:

Fresh install of Ubuntu 16


Let’s get started…..

  • Enter root mode: sudo su

  • Install git: apt-get install git

  • Install Build-Essentials: sudo apt-get install build-essential

  • Install htop process viewer: apt install htop

  • Install sysv-rc-conf: apt install sysv-rc-conf

  • Create mmdvm group: groupadd mmdvm

  • Create mmdvm user: useradd mmdvm -g mmdvm -s /sbin/nologin

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

  • Browse to the YSFReflector directory in user folder: cd ./YSFClients/YSFReflector

  • Compile git code: make clean all

You will need to edit the YSFReflector.ini and customize it with your settings.

  • While you are in the YSFReflector Directory, type: nano YSFReflector.ini

Name=Your Reflector's name
Description=Your Reflector's description
FilePath=/usr/local/bin/
FileRoot=YSFReflector

  • There is also a line that says Daemon=1, change it to Daemon=0

  • Save the file CTRL+X and select Y to overwrite existing file.

Now we need to move some files around:

  • Move executable: mv YSFReflector /usr/local/bin

  • Move YSFReflector.ini to /etc/ : mv YSFReflector.ini /etc

Now you will need to create a script file to help automatically start YSFReflector at boot.

Browse to the following directory: /etc/init.d

  • cd ~

  • cd /etc/init.d

Create file called YSFReflector.sh (Make sure you are in the “/etc/init.d” directory.

  • nano YSFReflector.sh

  • Copy and paste the following text into the nano editor.

  • #!/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
  • Save the file by pressing CTRL+X and select Y

  • Enable file to be executed: chmod +x YSFReflector.sh

  • Set Script to run at startup: sysv-rc-conf YSFReflector.sh on

REBOOT!

Once rebooted, you can type “htop” (after you login) and you should see the YSFReflector in the list of running services.