DMRIDUpdate.sh script para atualizar o MMDVM hotspot Pi-Star
Este é um pequeno script shell que pode ser utilizado para atualizar o arquivos de DMR id's e mostrar nas telas Nextion, ou outras, normalmente utilizando com NextionDriver (normalmente ele não vem instalado na instalação padrão do Pi-Star. Necessário consultar este link)
/etc/crontab
12 0 * * * root /bin/bash /root/DMRIupdate.sh
/etc/crontab
12 0 * * * root /bin/bash /root/DMRIupdate.sh
#! /bin/bash
###############################################################################
#
# DMRIDUpdate.sh
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
###############################################################################
#
# On a Linux based system, such as a Raspberry Pi, this script will update the
# stripped.csv and DMRIds.dat files.
#
# It is designed to run from crontab and will download the latest IDs from the
# master DMR-MARC ID database and optionally keep a backup of previously
# created files for you.
#
# It will also prune the number of backup files according to a value specified
# by you in the configuration below.
#
# After restarting the hotspot, the changes will be loaded.
#
# To install in root's crontab use the command ...
#
# sudo crontab -e
#
# ... and add the following line to the bottom of the file ...
#
# 0 0 * * * /root/DMRIDUpdate.sh 1>/dev/null 2>&1
#
# (change root to wherever you placed the script)
#
###############################################################################
#
sudo mount -o remount,rw / ; sudo mount -o remount,rw /boot
cd /tmp
wget https://database.radioid.net/static/user.csv
cat user.csv | awk -F, '{print $1 "," $2 "," $3 " " $4 "," $5 "," $6 ",,"}' > /usr/local/etc/stripped.csv
cd /usr/local/etc
cat stripped.csv | awk -F, '{print $1 " " $2 " " $3}' | awk -v OFS='\t' '{print $1,$2,$3}' >DMRIds.dat