├── README.md
├── cleanup.sh
├── create_service.sh
├── dmridupdate.sh
├── dvmega_version.sh
├── install.sh
├── install_apps.sh
├── modify_platform.sh
├── rebuild.sh
├── resetini.sh
├── shortcuts.sh
└── update.sh
/README.md:
--------------------------------------------------------------------------------
1 | # MMDVM Raspberry Pi Image Scripts
2 |
3 | ### Purpose
4 | This will enable you to take a stock Raspbian Jessie and have a complete MMDVM System.
5 |
6 | This is created by Chris Andrist, KC7WSU. This process is used to create the DMR-UTAH MMDVM Images available [here](http://www.dmr-utah.net/support/mmdvm/images/).
7 |
8 | ### Step-by-Step
9 | 1. Basic Raspberry Pi Config
10 | - sudo raspi-config
11 | - Expand Filesystem
12 | - Disable Serial
13 | - Enable VNC
14 | - Localization
15 | - sudo reboot
16 |
17 | 2. Update Raspberry Pi
18 | - sudo apt-get update
19 | - sudo apt-get -y dist-upgrade
20 | - sudo reboot
21 |
22 | 3. Download Scripts
23 | - git clone https://github.com/candrist/mmdvm-image.git /home/pi/Scripts
24 |
25 | 4. Run initial install file
26 | - sudo /home/pi/Scripts/install.sh
27 |
28 | 5. Add Amateur Radio Menu
29 |
30 | - sudo nano /etc/xdg/menus/lxde-pi-applications.menu
31 |
32 | - Add Amateur Radio Section
33 |
34 | ```xml
35 |
36 |
45 | ```
46 |
47 | - Edit Layout Section
48 |
49 | ```xml
50 | Amateur Radio
51 | ```
52 |
53 | - sudo reboot
54 |
55 | 6. Install Applications from "lxTerminal"
56 | - /home/pi/Scripts/install_apps.sh
57 |
58 | 7. Create Shortcuts
59 | - sudo /home/pi/Scripts/shortcuts.sh
60 |
61 | 8. Create Service
62 | - sudo /home/pi/Scripts/create_service.sh
63 |
64 | 9. Run from Amateur Radio Menu
65 | - Rebuild From Source
66 | - Reset MMDVM.ini
67 |
68 | 10. Cleanup
69 | - /home/pi/Scripts/cleanup.sh
70 |
--------------------------------------------------------------------------------
/cleanup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Stop MMDVMHost
4 | sudo pkill -f /home/pi/Applications/MMDVMHost
5 | # Remove Old MMDVM.ini
6 | rm -Rf /home/pi/MMDVM_*.ini
7 | # Remove Script Logs
8 | rm -Rf /home/pi/Logs/*
9 | # Remove MMDVMHost Logs
10 | rm -Rf /home/pi/Applications/MMDVMHost/MMDVM-*.log
11 | # Remove Old DMRIds.dat files
12 | #rm -Rf /home/pi/Applications/MMDVMHost/DMRIds.dat
13 | rm -Rf /home/pi/Applications/MMDVMHost/DMRIds.dat.*
14 | # Clear Bash History
15 | cat /dev/null > /home/pi/.bash_history
16 | history -c
17 |
--------------------------------------------------------------------------------
/create_service.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Create Service File
4 | cat > /lib/systemd/system/mmdvmhost.service << EOL
5 | [Unit]
6 | Description=MMDVM Host Service
7 | After=syslog.target network.target
8 |
9 | [Service]
10 | User=pi
11 | WorkingDirectory=/home/pi/Applications/MMDVMHost
12 | ExecStart=/usr/bin/screen -S MMDVMHost -D -m /home/pi/Applications/MMDVMHost/MMDVMHost /home/pi/MMDVM.ini
13 | ExecStop=/usr/bin/screen -S MMDVMHost -X quit
14 |
15 | [Install]
16 | WantedBy=multi-user.target
17 | EOL
18 |
19 | # Create Timer - 2min Delay
20 | cat > /lib/systemd/system/mmdvmhost.timer << EOL
21 | [Timer]
22 | OnStartupSec=120
23 |
24 | [Install]
25 | WantedBy=multi-user.target
26 | EOL
27 |
28 | # Make Service and Timer Executable
29 | chmod 755 /lib/systemd/system/mmdvmhost.service
30 | chmod 755 /lib/systemd/system/mmdvmhost.timer
31 | # Delete Old Symbolic Links for Service
32 | rm -Rf /etc/systemd/system/mmdvmhost.timer /etc/systemd/system/mmdvmhost.service
33 | # Create Symbolic Links for Service
34 | ln -s /lib/systemd/system/mmdvmhost.timer /etc/systemd/system/mmdvmhost.timer
35 | ln -s /lib/systemd/system/mmdvmhost.service /etc/systemd/system/mmdvmhost.service
36 | # Pickup New Service and Enable Timer
37 | systemctl daemon-reload
38 | systemctl enable mmdvmhost.timer
39 |
--------------------------------------------------------------------------------
/dmridupdate.sh:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | ###############################################################################
4 | #
5 | # DMRIDUpdate.sh
6 | #
7 | # Copyright (C) 2016 by Tony Corbett G0WFV
8 | # Modified by Chris Andrist, KC7WSU for DMR-UTAH
9 | #
10 | # This program is free software; you can redistribute it and/or modify
11 | # it under the terms of the GNU General Public License as published by
12 | # the Free Software Foundation; either version 2 of the License, or
13 | # (at your option) any later version.
14 | #
15 | # This program is distributed in the hope that it will be useful,
16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | # GNU General Public License for more details.
19 | #
20 | # You should have received a copy of the GNU General Public License
21 | # along with this program; if not, write to the Free Software
22 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 | #
24 | ###############################################################################
25 | #
26 | # On a Linux based system, such as a Raspberry Pi, this script will perform all
27 | # the steps required to maintain the DMRIds.dat (or similar) file for you.
28 | #
29 | # It is designed to run from crontab and will download the latest IDs from the
30 | # master DMR-MARC ID database and optionally keep a backup of previously
31 | # created files for you.
32 | #
33 | # It will also prune the number of backup files according to a value specified
34 | # by you in the configuration below.
35 | #
36 | # When done, it will restart MMDVMHost to make the ID changes take effect.
37 | #
38 | # To install in root's crontab use the command ...
39 | #
40 | # sudo crontab -e
41 | #
42 | # ... and add the following line to the bottom of the file ...
43 | #
44 | # 0 0 * * * /path/to/script/DMRIDUpdate.sh 1>/dev/null 2>&1
45 | #
46 | # ... where /path/to/script/ should be replaced by the path to this script.
47 | #
48 | ###############################################################################
49 | #
50 | # CONFIGURATION
51 | #
52 | # Full path to DMR ID file
53 | DMRIDFILE=/home/pi/Applications/MMDVMHost/DMRIds.dat
54 | #
55 | # How many DMR ID files do you want backed up (0 = do not keep backups)
56 | DMRFILEBACKUP=1
57 | #
58 | # Command line to restart MMDVMHost
59 | RESTARTCOMMAND="sudo systemctl restart mmdvmhost.service"
60 | # RESTARTCOMMAND="killall MMDVMHost ; /path/to/MMDVMHost/executable/MMDVMHost /path/to/MMDVM/ini/file/MMDVM.ini"
61 |
62 | ###############################################################################
63 | #
64 | # Do not edit below here
65 | #
66 | ###############################################################################
67 |
68 | # Check we are pi user
69 | if [ "$(id -u)" != "1000" ]
70 | then
71 | echo "This script must be run as root" 1>&2
72 | exit 1
73 | fi
74 |
75 | # Create backup of old file
76 | if [ ${DMRFILEBACKUP} -ne 0 ]
77 | then
78 | cp ${DMRIDFILE} ${DMRIDFILE}.$(date +%d%m%y)
79 | fi
80 |
81 | # Prune backups
82 | BACKUPCOUNT=$(ls ${DMRIDFILE}.* | wc -l)
83 | BACKUPSTODELETE=$(expr ${BACKUPCOUNT} - ${DMRFILEBACKUP})
84 |
85 | if [ ${BACKUPCOUNT} -gt ${DMRFILEBACKUP} ]
86 | then
87 | for f in $(ls -tr ${DMRIDFILE}.* | head -${BACKUPSTODELETE})
88 | do
89 | rm $f
90 | done
91 | fi
92 |
93 | # Generate new file
94 | curl 'http://www.dmr-marc.net/cgi-bin/trbo-database/datadump.cgi?table=users&format=csv&header=0' 2>/dev/null | awk -F"," '{printf "%s\t%s\t%s\n", $1, $2, $4 == "" ? $3 : $4}' | sed -e 's/\(.\) .*/\1/g' > ${DMRIDFILE}
95 |
96 | # Restart MMDVMHost
97 | # eval ${RESTARTCOMMAND}
98 |
--------------------------------------------------------------------------------
/dvmega_version.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -m
3 | PORT="/dev/ttyAMA0"
4 | stty -F ${PORT} ospeed 115200 ispeed 115200 -crtscts
5 | #cat -v < $PORT &
6 | dd if=${PORT} bs=1 count=17 status=none | sed -e "s/$/\n/" &
7 | echo -ne '\xE0\x03\x00' > ${PORT}
8 | sleep 0.1
9 | exit 0
10 |
--------------------------------------------------------------------------------
/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #Install Required Software
4 | apt-get -y install build-essential oracle-java8-jdk mousepad mlocate screen libnotify-bin
5 |
6 | # VNC Mods
7 | bash -c 'echo " " >> /boot/config.txt'
8 | bash -c 'echo "# Change VNC Resolution" >> /boot/config.txt'
9 | bash -c 'echo "hdmi_force_hotplug=1" >> /boot/config.txt'
10 | bash -c 'echo "hdmi_ignore_edid=0xa5000080" >> /boot/config.txt'
11 | bash -c 'echo "hdmi_group=2" >> /boot/config.txt'
12 | bash -c 'echo "hdmi_mode=16" >> /boot/config.txt'
13 |
14 | # DV-Mega Mods
15 | systemctl stop serial-getty@ttyAMA0.service
16 | systemctl disable serial-getty@ttyAMA0.service
17 | systemctl stop hciuart
18 | systemctl disable hciuart
19 | sed -i -e 's/console=serial0,115200 console=tty1/console=tty1/' /boot/cmdline.txt
20 | sed -i -e 's/enable_uart=0/enable_uart=1/' /boot/config.txt
21 | bash -c 'echo " " >> /boot/config.txt'
22 | bash -c 'echo "# Disable Bluetooth on Raspberry Pi 3" >> /boot/config.txt'
23 | bash -c 'echo "dtoverlay=pi3-disable-bt" >> /boot/config.txt'
24 |
25 | #Create Ham Radio Menu Directory
26 | cat > /usr/share/raspi-ui-overrides/desktop-directories/lxde-amateur-radio.directory << EOL
27 | [Desktop Entry]
28 | Name=Amateur Radio
29 | Comment=Amateur Radio Appiications
30 | Icon=
31 | Type=Directory
32 | EOL
33 |
--------------------------------------------------------------------------------
/install_apps.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Directory Pre-Requisites
4 | mkdir -p /home/pi/Applications
5 | # Download and Install Arduino IDE
6 | wget -O /home/pi/Downloads/arduino-1.8.1-linuxarm.tar.xz https://downloads.arduino.cc/arduino-1.8.1-linuxarm.tar.xz
7 | tar xfv /home/pi/Downloads/arduino-1.8.1-linuxarm.tar.xz -C /home/pi/Applications/
8 | /home/pi/Applications/arduino-1.8.1/install.sh
9 | sudo mv /home/pi/.local/share/applications/arduino-arduinoide.desktop /usr/share/raspi-ui-overrides/applications/arduino-arduinoide.desktop
10 | sudo sed -i -e 's:Categories=Development;IDE;Electronics;:Categories=AmateurRadio:' /usr/share/raspi-ui-overrides/applications/arduino-arduinoide.desktop
11 | rm -Rf /home/pi/Desktop/arduino-arduinoide.desktop
12 | rm -Rf /home/pi/.gnome/apps/arduino-arduinoide.desktop
13 | rm -Rf /home/pi/Downloads/arduino-1.8.1-linuxarm.tar.xz
14 | # Download Source Code
15 | git clone https://github.com/g4klx/MMDVM.git /home/pi/Applications/MMDVM
16 | git clone https://github.com/g4klx/MMDVMHost.git /home/pi/Applications/MMDVMHost
17 | git clone https://github.com/g4klx/MMDVMCal.git /home/pi/Applications/MMDVMCal
18 | # Add Bash Shortcut
19 | bash -c 'echo " " >> ~/.bash_profile'
20 | bash -c 'echo "# Shortcuts" >> ~/.bash_profile'
21 | bash -c 'echo "alias smm=\"/home/pi/Applications/MMDVMHost/MMDVMHost /home/pi/MMDVM.ini\"" >> ~/.bash_profile'
22 |
--------------------------------------------------------------------------------
/modify_platform.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Update Platform.txt for SAM 1.6.11
4 | sed -i -e 's:recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" -mcpu={build.mcu} -mthumb {compiler.c.elf.flags} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--start-group {compiler.combine.flags} {object_files} "{build.variant.path}/{build.variant_system_lib}" "{build.path}/{archive_file}" -Wl,--end-group -lm -gcc:recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" -mcpu={build.mcu} -mthumb {compiler.c.elf.flags} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--start-group {compiler.combine.flags} {object_files} "{build.variant.path}/{build.variant_system_lib}" "{build.system.path}/CMSIS/CMSIS/Lib/GCC/libarm_cortexM3l_math.a" "{build.path}/{archive_file}" -Wl,--end-group -lm -gcc:' /home/pi/.arduino15/packages/arduino/hardware/sam/1.6.11/platform.txt
5 |
--------------------------------------------------------------------------------
/rebuild.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | LOG_DIRECTORY="/home/pi/Logs"
4 | LOG_FILE="$LOG_DIRECTORY/scripts_$(date +'%F').log"
5 | if [ ! -d "$LOG_DIRECTORY" ]; then
6 | mkdir -p $LOG_DIRECTORY
7 | fi
8 |
9 | touch $LOG_FILE
10 |
11 | exec > >(tee -a $LOG_FILE)
12 | exec 2>&1
13 |
14 | echo "[REBUILD][$(date)] ===== Rebuilding MMDVM from Repository ====="
15 | notify-send 'REBUILD' 'Rebuilding MMDVMCal from Repository' --icon=dialog-information
16 | cd /home/pi/Applications/MMDVM
17 | git fetch --all
18 | git reset --hard origin/master
19 | echo "[REBUILD][$(date)] !!!!! Make Sure You Run The Arudino IDE to Update Your DUE !!!!!"
20 | notify-send 'REBUILD' 'Run The Ardunio IDE to Update Your Due' --icon=dialog-error --urgency=critical
21 |
22 |
23 | echo "[REBUILD][$(date)] ===== Stopping MMDVMHost ====="
24 | notify-send 'REBUILD' 'Stopping MMDVMHost' --icon=dialog-information
25 | pkill -f /home/pi/Applications/MMDVMHost
26 | sleep 2
27 | echo "[REBUILD][$(date)] ===== Rebuilding MMDVMHost from Repository ====="
28 | notify-send 'REBUILD' 'Rebuilding MMDVMHost from Repository' --icon=dialog-information
29 | cd /home/pi/Applications/MMDVMHost
30 | git fetch --all
31 | git reset --hard origin/master
32 | make clean
33 | make
34 | sleep 2
35 | echo "[REBUILD][$(date)] ===== MMDVMHost Rebuilt Successfully ====="
36 | notify-send 'REBUILD' 'MMDVMHost Rebuilt Successfully' --icon=dialog-information --urgency=critical
37 |
38 |
39 | echo "[REBUILD][$(date)] ===== Rebuilding MMDVMCal from Repository ====="
40 | notify-send 'REBUILD' 'Rebuilding MMDVMCal from Repository' --icon=dialog-information
41 | cd /home/pi/Applications/MMDVMCal
42 | git fetch --all
43 | git reset --hard origin/master
44 | make clean
45 | make
46 | echo "[REBUILD][$(date)] ===== MMDVMCal Rebuilt Successfully ====="
47 | notify-send 'REBUILD' 'MMDVMCal Rebuilt Successfully' --icon=dialog-information --urgency=critical
48 |
49 |
50 | sleep 20
51 |
52 | exit
53 |
--------------------------------------------------------------------------------
/resetini.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | LOG_DIRECTORY="/home/pi/Logs"
4 | LOG_FILE="$LOG_DIRECTORY/scripts_$(date +'%F').log"
5 | if [ ! -d "$LOG_DIRECTORY" ]; then
6 | mkdir -p $LOG_DIRECTORY
7 | fi
8 |
9 | touch $LOG_FILE
10 |
11 | exec > >(tee -a $LOG_FILE)
12 | exec 2>&1
13 |
14 | echo "[RESETINI][$(date)] ===== Stopping MMDVMHost ====="
15 | notify-send 'RESETINI' 'Stopping MMDVMHost' --icon=dialog-information
16 | pkill -f /home/pi/Applications/MMDVMHost
17 | sleep 2
18 | echo "[RESETINI][$(date)] ===== Rebuilding MMDVM.ini from Repository ====="
19 | notify-send 'RESETINI' 'Rebuilding MMDVM.ini from Repository' --icon=dialog-information
20 | mv /home/pi/MMDVM.ini /home/pi/MMDVM_$(date +'%F').ini
21 | cp /home/pi/Applications/MMDVMHost/MMDVM.ini /home/pi/MMDVM.ini
22 | sleep 2
23 | echo "[RESETINI][$(date)] ===== MMDVM.ini Rebuilt Successful. Remember to Edit the MMDVM.ini ====="
24 | notify-send 'RESETINI' 'MMDVM.ini Rebuilt Successful. Remember to Edit the MMDVM.ini' --icon=dialog-error --urgency=critical
25 |
26 | sleep 20
27 |
28 | exit
29 |
--------------------------------------------------------------------------------
/shortcuts.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #Create Shortcuts in Ham Radio Menu
4 | cat > /usr/share/applications/mmdvm-edit_mmdvmini.desktop << EOL
5 | [Desktop Entry]
6 | Type=Application
7 | Name=Edit MMDVM.ini
8 | GenericName=Edit MMDVM.ini
9 | Exec=mousepad /home/pi/MMDVM.ini
10 | Icon=
11 | Terminal=false
12 | Categories=AmateurRadio;
13 | EOL
14 |
15 | cat > /usr/share/applications/mmdvm-mmdvmcal.desktop << EOL
16 | [Desktop Entry]
17 | Type=Application
18 | Name=MMDVM Calibration
19 | GenericName=Start MMDVMCal
20 | Exec=lxterminal --working-directory="/home/pi/Applications/MMDVMCal" --command="/home/pi/Applications/MMDVMCal/MMDVMCal /dev/ttyACM0"
21 | Icon=
22 | Terminal=false
23 | Categories=AmateurRadio;
24 | EOL
25 |
26 | cat > /usr/share/applications/mmdvm-mmdvmhost_start.desktop << EOL
27 | [Desktop Entry]
28 | Type=Application
29 | Name=MMDVMHost Start
30 | GenericName=MMDVMHost Start
31 | Exec=lxterminal --working-directory="/home/pi/Applications/MMDVMHost" --command="/home/pi/Applications/MMDVMHost/MMDVMHost /home/pi/MMDVM.ini"
32 | Icon=
33 | Terminal=false
34 | Categories=AmateurRadio;
35 | EOL
36 |
37 | cat > /usr/share/applications/mmdvm-mmdvmhost_stop.desktop << EOL
38 | [Desktop Entry]
39 | Type=Application
40 | Name=MMDVMHost Stop
41 | GenericName=MMDVMHost Stop
42 | Exec=pkill -f /home/pi/Applications/MMDVMHost
43 | Icon=
44 | Terminal=false
45 | Categories=AmateurRadio;
46 | EOL
47 |
48 | cat > /usr/share/applications/mmdvm-mmdvmhost_service_console.desktop << EOL
49 | [Desktop Entry]
50 | Type=Application
51 | Name=MMDVMHost Background Service Console
52 | GenericName=MMDVMHost Background Service Console
53 | Exec=screen -r MMDVMHost
54 | Icon=
55 | Terminal=true
56 | Categories=AmateurRadio;
57 | EOL
58 |
59 | cat > /usr/share/applications/mmdvm-mmdvmhost_service_start.desktop << EOL
60 | [Desktop Entry]
61 | Type=Application
62 | Name=MMDVMHost Background Service Start
63 | GenericName=MMDVMHost Background Service Start
64 | Exec=sudo systemctl start mmdvmhost.service
65 | Icon=
66 | Terminal=false
67 | Categories=AmateurRadio;
68 | EOL
69 |
70 | cat > /usr/share/applications/mmdvm-mmdvmhost_service_stop.desktop << EOL
71 | [Desktop Entry]
72 | Type=Application
73 | Name=MMDVMHost Background Service Stop
74 | GenericName=MMDVMHost Background Service Stop
75 | Exec=sudo systemctl stop mmdvmhost.service
76 | Icon=
77 | Terminal=false
78 | Categories=AmateurRadio;
79 | EOL
80 |
81 | cat > /usr/share/applications/mmdvm-mmdvmhost_service_restart.desktop << EOL
82 | [Desktop Entry]
83 | Type=Application
84 | Name=MMDVMHost Background Service Restart
85 | GenericName=MMDVMHost Background Service Restart
86 | Exec=sudo systemctl restart mmdvmhost.service
87 | Icon=
88 | Terminal=false
89 | Categories=AmateurRadio;
90 | EOL
91 |
92 | cat > /usr/share/applications/mmdvm-update.desktop << EOL
93 | [Desktop Entry]
94 | Type=Application
95 | Name=Update All
96 | GenericName=Update All
97 | Exec=/home/pi/Scripts/update.sh
98 | Icon=
99 | Terminal=true
100 | Categories=AmateurRadio;
101 | EOL
102 |
103 | cat > /usr/share/applications/mmdvm-rebuild.desktop << EOL
104 | [Desktop Entry]
105 | Type=Application
106 | Name=Rebuild From Source
107 | GenericName=Rebuild From Source
108 | Exec=/home/pi/Scripts/rebuild.sh
109 | Icon=
110 | Terminal=true
111 | Categories=AmateurRadio;
112 | EOL
113 |
114 | cat > /usr/share/applications/mmdvm-resetini.desktop << EOL
115 | [Desktop Entry]
116 | Type=Application
117 | Name=Reset MMDVM.ini
118 | GenericName=Reset MMDVM.ini
119 | Exec=/home/pi/Scripts/resetini.sh
120 | Icon=
121 | Terminal=true
122 | Categories=AmateurRadio;
123 | EOL
124 |
125 | cat > /usr/share/applications/mmdvm-updatedmriddb.desktop << EOL
126 | [Desktop Entry]
127 | Type=Application
128 | Name=Update DMR ID Database
129 | GenericName=Update DMR ID Database
130 | Exec=/home/pi/Scripts/dmridupdate.sh
131 | Icon=
132 | Terminal=false
133 | Categories=AmateurRadio;
134 | EOL
135 |
--------------------------------------------------------------------------------
/update.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | LOG_DIRECTORY="/home/pi/Logs"
4 | LOG_FILE="$LOG_DIRECTORY/scripts_$(date +'%F').log"
5 | if [ ! -d "$LOG_DIRECTORY" ]; then
6 | mkdir -p $LOG_DIRECTORY
7 | fi
8 |
9 | touch $LOG_FILE
10 |
11 | exec > >(tee -a $LOG_FILE)
12 | exec 2>&1
13 |
14 |
15 | cd /home/pi/Applications/MMDVM
16 | git fetch
17 |
18 | LOCAL=$(git rev-parse @)
19 | REMOTE=$(git rev-parse @{u})
20 | BASE=$(git merge-base @ @{u})
21 |
22 | if [ $LOCAL = $REMOTE ]; then
23 | echo "[UPDATE][$(date)] MMDVM is Up-to-Date"
24 | notify-send 'UPDATE' 'MMDVM is Up-to-Date' --icon=dialog-information --urgency=critical
25 | elif [ $LOCAL = $BASE ]; then
26 | echo "[UPDATE][$(date)] ===== Updating MMDVM From Repository ====="
27 | notify-send 'UPDATE' 'Updating MMDVM From Repository' --icon=dialog-information
28 | git pull
29 | echo "[UPDATE][$(date)] !!!!! Make Sure You Run The Arudino IDE to Update Your DUE !!!!!"
30 | notify-send 'UPDATE' 'Run The Ardunio IDE to Update Your Due' --icon=dialog-error --urgency=critical
31 | else
32 | echo "[UPDATE][$(date)] !!!!! Error with MMDVM Update !!!!!"
33 | notify-send 'UPDATE' 'Error with MMDVM Update!' --icon=dialog-error --urgency=critical
34 |
35 | fi
36 |
37 | sleep 3
38 |
39 | cd /home/pi/Applications/MMDVMHost
40 | git fetch
41 |
42 | LOCAL=$(git rev-parse @)
43 | REMOTE=$(git rev-parse @{u})
44 | BASE=$(git merge-base @ @{u})
45 |
46 | if [ $LOCAL = $REMOTE ]; then
47 | echo "[UPDATE][$(date)] MMDVMHost is Up-to-Date"
48 | notify-send 'UPDATE' 'MMDVMHost is Up-to-Date' --icon=dialog-information --urgency=critical
49 | elif [ $LOCAL = $BASE ]; then
50 | echo "[UPDATE][$(date)] ===== Stopping MMDVMHost ====="
51 | notify-send 'UPDATEt' 'Stopping MMDVMHost' --icon=dialog-information
52 | pkill -f /home/pi/Applications/MMDVMHost
53 | sleep 2
54 | echo "[UPDATE][$(date)] ===== Updating MMDVMHost from Repository ====="
55 | notify-send 'UPDATE' 'Updating MMDVMHost from Repository' --icon=dialog-information
56 | git pull
57 | make clean
58 | make
59 | sleep 2
60 | echo "[UPDATE][$(date)] ===== MMDVMHost Update Successful ====="
61 | notify-send 'UPDATE' 'MMDVMHost Update Successful' --icon=dialog-information --urgency=critical
62 | else
63 | echo "[UPDATE][$(date)] !!!!! Error with MMDVMHost Update !!!!!"
64 | notify-send 'UPDATE' 'Error with MMDVMHost Update!' --icon=dialog-error --urgency=critical
65 | fi
66 |
67 | sleep 3
68 |
69 | cd /home/pi/Applications/MMDVMCal
70 | git fetch
71 |
72 | LOCAL=$(git rev-parse @)
73 | REMOTE=$(git rev-parse @{u})
74 | BASE=$(git merge-base @ @{u})
75 |
76 | if [ $LOCAL = $REMOTE ]; then
77 | echo "[UPDATE][$(date)] MMDVMCal is Up-to-Date"
78 | notify-send 'UPDATE' 'MMDVMCal is Up-to-Date' --icon=dialog-information --urgency=critical
79 | elif [ $LOCAL = $BASE ]; then
80 | echo "[UPDATE][$(date)] ===== Updating MMDVMCal from Repository ====="
81 | notify-send 'UPDATE' 'Updating MMDVMCal from Repository' --icon=dialog-information
82 | git pull
83 | make clean
84 | make
85 | echo "[UPDATE][$(date)] ===== MMDVMCal Update Successful ====="
86 | notify-send 'UPDATE' 'MMDVMCal Update Successful' --icon=dialog-information --urgency=critical
87 | else
88 | echo "[UPDATE][$(date)] !!!!! Error with MMDVMCal Update !!!!!"
89 | notify-send 'UPDATE' 'Error with MMDVMCal Update!' --icon=dialog-error --urgency=critical
90 | fi
91 |
92 | sleep 20
93 |
94 | exit
95 |
--------------------------------------------------------------------------------