├── Pistar-SSH-Helper.tgz ├── README.md ├── dmrscan ├── dmrscan_example.jpg ├── example.jpg ├── example2.jpg ├── example3.jpg ├── example4.jpg ├── makefile ├── pistar-serv ├── psh-install.sh ├── psh-install.tgz ├── showlh ├── showlh.cfg ├── showlh.cpp ├── showlh.h ├── slh └── update-data /Pistar-SSH-Helper.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wa1gov/Pistar-SSH-Helper/4993c3f0cec01d2f26e420fd70ac82078197a3ca/Pistar-SSH-Helper.tgz -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pistar-SSH-Helper 2 | 3 | DESCRIPTION 4 | 5 | Program to display Pistar hotspot station info via an SSH 6 | session. 7 | 8 | This is a little C++ program that does a callsign lookup 9 | on a DMR id database file to display an extra large callsign 10 | and first name with additional info on the station (See the 11 | example*.* files). 12 | 13 | ---------------------------------------------------------------- 14 | REQUIREMENTS/PREREQUISITES TO DOWNLOAD AND INSTALL THE EXECUTABLE 15 | 16 | Most users can just install the executable as follows in this 17 | section. If problems arise, go to the next section to compile and 18 | create the executable for your particular hardware. 19 | 20 | Use SSH from the pistar dashboard or another ssh client and login 21 | to the Pistar hotspot. 22 | 23 | Download the tar archive from GitHub: 24 | 25 | wget -O psh-install.tgz https://github.com/wa1gov/Pistar-SSH-Helper/raw/master/psh-install.tgz 26 | 27 | Extract the contents of the tar archive: 28 | 29 | tar xvf psh-install.tgz 30 | 31 | psh-install.sh 32 | README.md 33 | showlh 34 | showlh.cfg 35 | slh 36 | 37 | Run this script as follows: 38 | 39 | ./psh-install.sh 40 | 41 | ---------------------------------------------------------------- 42 | REQUIREMENTS/PREREQUISITES TO DOWNLOAD and COMPILE THE SOURCE CODE 43 | 44 | The following requirements/prerequisites need to be done to compile 45 | and install the program. Perform these steps if there was a problem 46 | with using the executable in the above section. Otherwise, skip to the 47 | OPERATION and OPTIONS section. 48 | 49 | Use SSH from the pistar dashboard or another ssh client and login 50 | to the Pistar hotspot. 51 | 52 | Download the tar archive from GitHub: 53 | 54 | wget -O psh-install.tgz https://github.com/wa1gov/Pistar-SSH-Helper/raw/master/Pistar-SSH-Helper.tgz 55 | 56 | Extract the contents of the tar archive: 57 | 58 | tar xvf Pistar-SSH-Helper.tgz 59 | 60 | example.jpg 61 | example2.jpg 62 | example3.jpg 63 | psh-install.sh 64 | README.md 65 | makefile 66 | showlh.cfg 67 | showlh.h 68 | showlh.cpp 69 | 70 | Run make clean: 71 | 72 | make clean 73 | 74 | Run make: 75 | 76 | make 77 | 78 | Run this script to install the program: 79 | 80 | ./psh-install.sh 81 | 82 | ---------------------------------------------------------------- 83 | OPERATION and OPTIONS 84 | 85 | The showlh.cfg offers the option to choose a color for the callsign 86 | (DEFCOLOR) and the text (TXTCOLOR) display: 87 | 88 | BLACK 89 | BBLACK 90 | RED=DEFCOLOR 91 | BRED 92 | GREEN 93 | BGREEN 94 | WHITE=TXTCOLOR 95 | BWHITE 96 | 97 | Choose the color by editing the file and appending "=DEFCOLOR" 98 | or "=TXTCOLOR" to the color of choice as in the example above. 99 | 100 | The the program will display the CPU temperature on the divider 101 | line (see example3.jpg). The divider line color will change based 102 | on the CPU temperature as follows: 103 | 104 | GREEN < 50 degrees C. 105 | YELLOW >= 50 degrees C. 106 | RED >= 69 degrees C. 107 | 108 | Run slh to start the program 109 | 110 | ./slh 111 | 112 | Use CTRL+C to exit the program 113 | 114 | Run showlh -v to get the program version. 115 | 116 | ./showlh -v 117 | ./showlh version 1.1.0 118 | 119 | You can run showlh logfile_name 120 | to specify a different logfile from the default. 121 | 122 | Run the install script at any time to update the DMR ID database files. 123 | 124 | ./psh-install.sh 125 | 126 | ---------------------------------------------------------------- 127 | DISCLAIMER and CAVEATS 128 | 129 | 1. This program has only been tested with a Jumbospot MMDVM on RPI Zero. 130 | Other hotspots may exhibit different results or errors. 131 | 132 | 2. There is now support for Pi-Star 4.1 starting with Pistar-SSH-Helper 1.2.1. 133 | Limited tests have been done using the beta version Pi-Star 4.1.0 RC8. 134 | 135 | 3. For MMDVM hotspots, the default logfile is located in 136 | /var/log/pi-star and is named by convention: 137 | MMDVM-year-month-day.log 138 | A new logfile is created for the next day automatically via Pistar 139 | at 2400 UTC. The program may appear to hang at 2400 UTC when the new 140 | logfile is created. If this occurs, stop and restart the program. 141 | -------------------------------------------------------------------------------- /dmrscan: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | if [ -z "$1" ] 4 | then 5 | echo "Usage: $0 " 6 | exit 7 | fi 8 | COLOR="${BLUE}" 9 | SCAN_ARRAY=(`echo "$1" | awk -F, '{for(i=1; i<=NF; i++) print $i}'`) 10 | LEN=${#SCAN_ARRAY[@]} 11 | SIZE=$(($LEN-1)) 12 | STIM=() 13 | while true 14 | do 15 | for i in `seq 0 $SIZE` 16 | do 17 | SCAN=`egrep "${SCAN_ARRAY[$i]}" /var/log/pi-star/MM* | grep header | awk '{print $0}' | tail -1` 18 | TIME=`echo "$SCAN" | awk '{print $3}' | awk -F: '{print $1":"$2}'` 19 | if [ -n "$SCAN" ] && [ "${STIM[$i]}" != "$TIME" ] 20 | then 21 | TG=`echo "$SCAN" | awk '{print $NF}'` 22 | #figlet -f mono12 "${SCAN_ARRAY[$i]}" 23 | BIG=`figlet -f mono12 "${SCAN_ARRAY[$i]}"` 24 | echo -e "${COLOR}$BIG" 25 | #echo "Heard ${SCAN_ARRAY[$i]} on DMR Talk Group $TG at $TIME UTC" 26 | echo -e "${COLOR}Heard ${SCAN_ARRAY[$i]} on DMR Talk Group $TG at $TIME UTC" 27 | if [ "$2" = "mail" ] 28 | then 29 | ~/mailsend "Heard ${SCAN_ARRAY[$i]}" "Heard ${SCAN_ARRAY[$i]} on DMR Talk Group $TG at $TIME UTC" 30 | fi 31 | if [ "$2" = "sms" ] 32 | then 33 | ~/sendsms "Heard ${SCAN_ARRAY[$i]}" "Heard ${SCAN_ARRAY[$i]} on DMR Talk Group $TG at $TIME UTC" 34 | fi 35 | fi 36 | STIM[$i]="$TIME" 37 | done 38 | if [ -n "$2" ] 39 | then 40 | exit 41 | fi 42 | sleep 5 43 | done 44 | -------------------------------------------------------------------------------- /dmrscan_example.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wa1gov/Pistar-SSH-Helper/4993c3f0cec01d2f26e420fd70ac82078197a3ca/dmrscan_example.jpg -------------------------------------------------------------------------------- /example.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wa1gov/Pistar-SSH-Helper/4993c3f0cec01d2f26e420fd70ac82078197a3ca/example.jpg -------------------------------------------------------------------------------- /example2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wa1gov/Pistar-SSH-Helper/4993c3f0cec01d2f26e420fd70ac82078197a3ca/example2.jpg -------------------------------------------------------------------------------- /example3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wa1gov/Pistar-SSH-Helper/4993c3f0cec01d2f26e420fd70ac82078197a3ca/example3.jpg -------------------------------------------------------------------------------- /example4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wa1gov/Pistar-SSH-Helper/4993c3f0cec01d2f26e420fd70ac82078197a3ca/example4.jpg -------------------------------------------------------------------------------- /makefile: -------------------------------------------------------------------------------- 1 | # the compiler: gcc for C program, define as g++ for C++ 2 | CC = c++ 3 | 4 | # compiler flags: 5 | # -g adds debugging information to the executable file 6 | # -Wall turns on most, but not all, compiler warnings 7 | #CFLAGS = -std=c++0x -g -Wall 8 | CFLAGS = -std=c++0x 9 | 10 | # the build target executable: 11 | TARGET = showlh 12 | 13 | all: $(TARGET) 14 | 15 | $(TARGET): $(TARGET).cpp 16 | $(CC) $(CFLAGS) -o $(TARGET) $(TARGET).cpp 17 | 18 | clean: 19 | $(RM) $(TARGET) 20 | -------------------------------------------------------------------------------- /pistar-serv: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Utility to stop/start pistar services. 4 | # Use to refresh the pistar database after running update-data 5 | # 6 | # Usage: ./pistar-serv [ stop | start ] 7 | # 8 | if [ "$(id -u)" != "0" ]; then 9 | echo -e "You need to be root to run this command...\n" 10 | exit 1 11 | fi 12 | if [ "$1" = "stop" ] 13 | then 14 | echo "Stopping Services..." 15 | systemctl stop pistar-watchdog.service > /dev/null 2>&1 16 | systemctl stop pistar-remote.service > /dev/null 2>&1 17 | systemctl stop dmrgateway.service > /dev/null 2>&1 18 | systemctl stop dapnetgateway.service > /dev/null 2>&1 19 | systemctl stop ircddbgateway.service > /dev/null 2>&1 20 | systemctl stop timeserver.service > /dev/null 2>&1 21 | systemctl stop ysfgateway.service > /dev/null 2>&1 22 | systemctl stop ysf2dmr.service > /dev/null 2>&1 23 | systemctl stop ysf2nxdn.service > /dev/null 2>&1 24 | systemctl stop ysf2p25.service > /dev/null 2>&1 25 | systemctl stop ysfparrot.service > /dev/null 2>&1 26 | systemctl stop dmr2ysf.service > /dev/null 2>&1 27 | systemctl stop dmr2nxdn.service > /dev/null 2>&1 28 | systemctl stop p25gateway.service > /dev/null 2>&1 29 | systemctl stop p25parrot.service > /dev/null 2>&1 30 | systemctl stop nxdngateway.service > /dev/null 2>&1 31 | systemctl stop nxdn2dmr.service > /dev/null 2>&1 32 | systemctl stop nxdnparrot.service > /dev/null 2>&1 33 | systemctl stop dstarrepeater.service > /dev/null 2>&1 34 | systemctl stop mmdvmhost.service > /dev/null 2>&1 && sleep 2 > /dev/null 2>&1 35 | 36 | echo "Done" 37 | fi 38 | if [ "$1" = "start" ] 39 | then 40 | 41 | echo "Starting Services..." 42 | systemctl start dmrgateway.service > /dev/null 2>&1 43 | systemctl start ircddbgateway.service > /dev/null 2>&1 44 | systemctl start timeserver.service > /dev/null 2>&1 45 | systemctl start ysfgateway.service > /dev/null 2>&1 46 | systemctl start ysf2dmr.service > /dev/null 2>&1 47 | systemctl start ysf2nxdn.service > /dev/null 2>&1 48 | systemctl start ysf2p25.service > /dev/null 2>&1 49 | systemctl start ysfparrot.service > /dev/null 2>&1 50 | systemctl start dmr2ysf.service > /dev/null 2>&1 51 | systemctl start dmr2nxdn.service > /dev/null 2>&1 52 | systemctl start p25gateway.service > /dev/null 2>&1 53 | systemctl start p25parrot.service > /dev/null 2>&1 54 | systemctl start nxdngateway.service > /dev/null 2>&1 55 | systemctl start nxdn2dmr.service > /dev/null 2>&1 56 | systemctl start nxdnparrot.service > /dev/null 2>&1 57 | systemctl start dstarrepeater.service > /dev/null 2>&1 58 | systemctl start mmdvmhost.service > /dev/null 2>&1 59 | systemctl start dapnetgateway.service > /dev/null 2>&1 60 | systemctl start pistar-watchdog.service > /dev/null 2>&1 61 | systemctl start pistar-remote.service > /dev/null 2>&1 62 | echo "Done" 63 | fi 64 | -------------------------------------------------------------------------------- /psh-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Installing Pistar-SSH-Helper" 4 | echo "Updating Pistar, please wait..." 5 | 6 | sudo pistar-update > /dev/null 7 | sleep 5 8 | echo "Done updating Pistar!" 9 | 10 | echo "Running rpi-rw" 11 | sudo mount -o remount,rw / ; sudo mount -o remount,rw /boot 12 | 13 | echo "Downloading DMR ID database..." 14 | wget --timeout=120 --no-check-certificate --wait=3 'https://database.radioid.net/static/user.csv' -O usr_raw.bin 15 | awk -F, '{print $1","$2","$3","$5","$6","$7}' usr_raw.bin > usr.bin 16 | echo "Done downloading DMR ID database!" 17 | 18 | echo "Installing/upgrading figlet..." 19 | sudo apt-get -y install figlet > /dev/null 20 | echo "Done installing figlet!" 21 | 22 | echo "Installing/upgrading toilet..." 23 | sudo apt-get -y install toilet > /dev/null 24 | echo "Done installing toilet!" 25 | echo 26 | echo "To start Pistar-SSH-Helper,type:" 27 | echo 28 | echo "./slh" 29 | echo 30 | echo "Done installing Pistar-SSH-Helper!!" 31 | -------------------------------------------------------------------------------- /psh-install.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wa1gov/Pistar-SSH-Helper/4993c3f0cec01d2f26e420fd70ac82078197a3ca/psh-install.tgz -------------------------------------------------------------------------------- /showlh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wa1gov/Pistar-SSH-Helper/4993c3f0cec01d2f26e420fd70ac82078197a3ca/showlh -------------------------------------------------------------------------------- /showlh.cfg: -------------------------------------------------------------------------------- 1 | BLACK 2 | BBLACK 3 | RED=DEFCOLOR 4 | BRED 5 | GREEN 6 | BGREEN 7 | YELLOW 8 | BYELLOW 9 | BLUE 10 | BBLUE 11 | MAGENTA 12 | BMAGENTA 13 | CYAN 14 | BCYAN 15 | WHITE=TXTCOLOR 16 | BWHITE 17 | -------------------------------------------------------------------------------- /showlh.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * file showlh.cpp 3 | * author WA1GOV 4 | * date 9/15/2018 5 | * version 1.2.4 6 | * 7 | * Pi-star ssh helper callsign lookup and display 8 | * 9 | * DESCRIPTION 10 | * 11 | * This is a little program that reads the latest MMDVM log 12 | * file from the default /var/log/pistar directory. It then 13 | * does a callsign lookup on the dmr id database file to 14 | * display additional info on the station. A command line 15 | * argument is used to specify the MMDVM log file as the 16 | * name changes daily. 17 | * 18 | */ 19 | 20 | // Use "c++ -std=c++0x slh.cpp" or 21 | // "g++ -std=c++0x slh.cpp" to compile 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include "showlh.h" 31 | 32 | using namespace std; 33 | int pistar = 3; 34 | int firstrun=0; 35 | static int last_position=0; 36 | string DEFCOLOR; 37 | string TXTCOLOR; 38 | string DIVCOLOR; 39 | 40 | std::string(get_callsign(const std::string& callsign)) 41 | { 42 | string id, scall; 43 | string call_line; 44 | 45 | ifstream ip("usr.bin"); 46 | if(!ip.is_open()) std::cout << "ERROR: File Open" << '\n'; 47 | 48 | // find the callsign in the database, return the full line 49 | 50 | while(ip.good()) 51 | { 52 | getline(ip,call_line); 53 | if( call_line.find(callsign) != string::npos) { 54 | std::stringstream stream(call_line); 55 | getline(stream, id, ','); 56 | getline(stream, scall, ','); 57 | if ( callsign==scall ) { 58 | return(call_line); 59 | } 60 | } 61 | } 62 | ip.close(); 63 | return("Reached EOF,Callsign,Not_found,Update,database"); 64 | } 65 | 66 | // read file until new line 67 | // save position 68 | 69 | int find_new_text(ifstream &infile) { 70 | 71 | infile.seekg(0,ios::end); 72 | int filesize = infile.tellg(); 73 | float cputemp, BER; 74 | int loss, found; 75 | string line, cline, pktl, ber, netpl, netber, netdur, netTG; 76 | string cmd1, cmd2, cmd3, cmd4, cmd5, cmd6; 77 | string strWords[30]; 78 | string trimtime, trimname; 79 | string dmrid, call, name, city, state, country; 80 | short counter = 0; 81 | 82 | // check if the new file started 83 | 84 | if(filesize < last_position) { 85 | last_position=0; 86 | } 87 | 88 | // only do this the first time through 89 | 90 | if( firstrun == 0 ) { 91 | last_position=filesize; 92 | firstrun=1; 93 | } 94 | 95 | // read file from last position until new line is found 96 | 97 | for(int n=last_position; n> loss; 146 | if (loss < 2) DIVCOLOR=TXTCOLOR; 147 | if (loss >= 2) DIVCOLOR="OnAmber"; 148 | if (loss > 3) DIVCOLOR="OnRed"; 149 | cout << colors[TXTCOLOR] << "\b\b\b\b \t Duration " << netdur << " seconds, "; 150 | cout << colors[DIVCOLOR] << netpl << RESET << colors[TXTCOLOR] << " packet loss, "; 151 | 152 | // Set color for BER 153 | std::string ber = netber.substr(0, netber.find("%")); 154 | stringstream lb(ber); 155 | lb >> BER; 156 | if (BER < 2) DIVCOLOR=TXTCOLOR; 157 | if (BER >= 2) DIVCOLOR="OnAmber"; 158 | if (BER >= 5.0) DIVCOLOR="OnRed"; 159 | cout << "BER: " << colors[DIVCOLOR] << netber << RESET << colors[TXTCOLOR] << "\n"; 160 | 161 | } 162 | 163 | // clear array and counter 164 | for(int i = 0; i <= counter; i++) { 165 | strWords[i].clear(); 166 | } 167 | counter=0; 168 | 169 | // get only lines that contain the words "network|RF" and "from" 170 | 171 | if( line.find("network") != string::npos) { 172 | found = 1; 173 | } 174 | if( line.find("RF") != string::npos) { 175 | found = 1; 176 | } 177 | if( line.find("CSBK") != string::npos) { 178 | found = 0; 179 | } 180 | if( line.find("transmissio") != string::npos) { 181 | found = 0; 182 | } 183 | if( found == 1 ) { 184 | found = 0; 185 | if(( line.find("DMR") != string::npos) && ( line.find("from") != string::npos)) { 186 | for(unsigned int i=0; i> cputemp; 209 | if (cputemp/1000 < 50) DIVCOLOR="GREEN"; 210 | if (cputemp/1000 >= 50) DIVCOLOR="YELLOW"; 211 | if (cputemp/1000 >= 69) DIVCOLOR="RED"; 212 | 213 | cout << colors[DIVCOLOR] << "═══════════════════════ CPU Temp: "; 214 | cout << std::fixed << std::setprecision(1) << cputemp/1000 << "C/" << cputemp/1000*1.8+32; 215 | cout << "F ════════════════════════" << RESET; 216 | 217 | // Use figlet to banner the callsign 218 | 219 | // Set callsign color 220 | 221 | cout << colors[DEFCOLOR] << "\n"; 222 | 223 | std::string cmd1 = "figlet -f mono12 "; 224 | std::string cmd2 = strWords[11]; 225 | std::string cmd3 = cmd1+cmd2; 226 | 227 | system( cmd3.c_str() ); 228 | 229 | cout << colors[TXTCOLOR] << "\n"; // text color 230 | 231 | // Parse the database line 232 | 233 | std::stringstream stream(cline); 234 | getline(stream, dmrid, ','); 235 | getline(stream, call, ','); 236 | getline(stream, name, ','); 237 | if ( name != "" ) { 238 | 239 | // Get the first name only 240 | 241 | std::string tname = name.substr(0, name.find(" ")); 242 | 243 | // Strip out quotes in first name 244 | 245 | tname.erase(std::remove(tname.begin(), tname.end(), '"')\ 246 | , tname.end()); 247 | trimname = tname; 248 | if ( tname.length() > 11 ) { 249 | tname.erase(11, tname.length()); 250 | } 251 | getline(stream, city, ','); 252 | getline(stream, state, ','); 253 | getline(stream, country, ','); 254 | 255 | // Use figlet to banner the first name 256 | 257 | if ( tname != "" ) { 258 | std::string cmd4 = "figlet -f mono9 "; 259 | std::string cmd5 = tname; 260 | std::string cmd6 = cmd4+cmd5; 261 | system( cmd6.c_str() ); 262 | } 263 | } 264 | 265 | // print out the database info after callsign and name banner 266 | 267 | cout << trimtime << " " << call << "," << trimname << ","; 268 | cout << city << "," << state << "," << country << " TG-"; 269 | cout << netTG << endl; 270 | DIVCOLOR="OnRed"; 271 | cout << colors[DIVCOLOR] << " TX " << RESET << flush; 272 | 273 | // clear array and counter 274 | for(int i = 0; i <= counter; i++) { 275 | strWords[i].clear(); 276 | } 277 | counter=0; 278 | } 279 | } 280 | 281 | // end of file 282 | 283 | if(filesize == last_position) { 284 | return filesize; 285 | } 286 | } 287 | 288 | return 0; 289 | } 290 | 291 | int main(int argc, char *argv[]) { 292 | if (argc < 2) { // infile name 293 | std::cerr << "Usage: " << argv[0] << " " << std::endl; 294 | return 1; 295 | } 296 | if (std::string(argv[1]) == "-v") { 297 | std::cout << argv[0] << " version 1.2.4\n"; 298 | return 0; 299 | } 300 | if (argc == 3) { 301 | if (std::string(argv[2]) == "4") { 302 | pistar=4; 303 | } 304 | } 305 | std::ifstream cfgin("showlh.cfg"); 306 | if(!cfgin.is_open()) { 307 | std::cout << "##### showlh.cfg ERROR: File Open #####" << '\n'; 308 | } 309 | std::string cfgline; 310 | DEFCOLOR="WHITE"; 311 | TXTCOLOR="WHITE"; 312 | while( std::getline(cfgin, cfgline)) { 313 | std::stringstream stream(cfgline); 314 | if( cfgline.find("DEFCOLOR") != string::npos) { 315 | std::stringstream stream(cfgline); 316 | getline(stream, DEFCOLOR, '='); 317 | } 318 | if( cfgline.find("TXTCOLOR") != string::npos) { 319 | std::stringstream stream(cfgline); 320 | getline(stream, TXTCOLOR, '='); 321 | } 322 | } 323 | cfgin.close(); 324 | std::cout << colors[TXTCOLOR] << "***** Gateway Activity from " << argv[1] << " *****\n"; 325 | for(;;) { 326 | std::ifstream infile(argv[1]); 327 | int current_position = find_new_text(infile); 328 | usleep(1000000); 329 | } 330 | 331 | } 332 | -------------------------------------------------------------------------------- /showlh.h: -------------------------------------------------------------------------------- 1 | // USING ANSI COLORS 2 | 3 | static std::map colors = { 4 | { "BLACK", "\x1b[30m" }, 5 | { "BBLACK", "\x1b[90m" }, 6 | { "RED", "\x1b[31m" }, 7 | { "BRED", "\x1b[91m" }, 8 | { "GREEN", "\x1b[32m" }, 9 | { "BGREEN", "\x1b[92m" }, 10 | { "YELLOW", "\x1b[33m" }, 11 | { "BYELLOW", "\x1b[93m" }, 12 | { "BLUE", "\x1b[34m" }, 13 | { "BBLUE", "\x1b[94m" }, 14 | { "MAGENTA", "\x1b[35m" }, 15 | { "BMAGENTA", "\x1b[95m" }, 16 | { "CYAN", "\x1b[36m" }, 17 | { "BCYAN", "\x1b[96m" }, 18 | { "WHITE", "\x1b[37m" }, 19 | { "BWHITE", "\x1b[97m" }, 20 | { "OnBlack", "\x1b[40m" }, 21 | { "OnRed", "\x1b[41m" }, 22 | { "OnGreen", "\x1b[42m" }, 23 | { "OnYellow", "\x1b[43m" }, 24 | { "OnBlue", "\x1b[44m" }, 25 | { "OnPurple", "\x1b[45m" }, 26 | { "OnCyan", "\x1b[46m" }, 27 | { "OnWhite", "\x1b[47m" }, 28 | { "OnAmber", "\x1b[38;5;16;48;5;172m" } 29 | }; 30 | static const std::string RESET="\x1b[0m"; 31 | -------------------------------------------------------------------------------- /slh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | VER=`grep Version /etc/pistar-release | awk '{print $3}' | awk -F. '{print $1}'` 3 | LOG=`ls -tr /var/log/pi-star/MMDVM* | tail -1` 4 | ./showlh $LOG $VER 5 | -------------------------------------------------------------------------------- /update-data: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Utility to download the latest DMR database. 4 | # Optional: Use the -c option to sync the Pistar database with 5 | # the DMR database. If you use the -c option, you must stop/start 6 | # Pistar services or reboot the hotspot to update the Pistar DB. 7 | # 8 | # Usage: ./update-data [ -c ] 9 | # 10 | 11 | sudo mount -o remount,rw / ; sudo mount -o remount,rw /boot 12 | cd ~ 13 | DMRIDFILE="/usr/local/etc/DMRIds.dat" 14 | echo "Downloading DMR database..." 15 | wget --timeout=120 --no-check-certificate --wait=3 'https://database.radioid.net/static/user.csv' -O usr_raw.bin 16 | sudo curl --fail -o ${DMRIDFILE} http://www.pistar.uk/downloads/DMRIds.dat 17 | echo "Converting usr_raw.bin to usr.bin" 18 | mv usr.bin usr.sav 19 | mv DMRids.dat DMRids.sav 20 | awk -F, '{print $1","$2","$3","$5","$6","$7}' usr_raw.bin > usr.bin 21 | echo "Converting usr.bin to DMRids.dat" 22 | awk -F, '{print $1" "$2" "$3}' usr.bin | awk '{print $1"\t"$2"\t"$3}' | sed 's/"//' > DMRids.dat 23 | if [ "$1" = "-c" ] 24 | then 25 | echo "Copying DMRids.dat to DMRIds.dat" 26 | sudo cp DMRids.dat DMRIds.dat 27 | fi 28 | echo "--------------------------------------------------" 29 | ls -l ${DMRIDFILE} 30 | wc -l ${DMRIDFILE} DMRids.dat 31 | echo "--------------------------------------------------" 32 | ls -l usr.bin 33 | wc -l usr.bin usr_raw.bin 34 | --------------------------------------------------------------------------------