-
Notifications
You must be signed in to change notification settings - Fork 28
/
writeblankplug
104 lines (92 loc) · 3.37 KB
/
writeblankplug
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
# writeblankplug
# KD4Z
# Version: 3.19
# Writes a totally blank codeplug to the radio as a last resort to recover a sick radio
BACKUPFQN=~/archive/myplug.bin
while true
do
echo ""
echo -e "${RED}WRITE A BLANK CODEPLUG TO RADIO"
echo -e ""
echo -e " ${WHITE}1${YELLOW}) VHF MD-380 / RT-3 (no GPS)"
echo -e " ${WHITE}2${YELLOW}) UHF MD-380 / RT-3 (no GPS)"
echo -e " ${WHITE}3${YELLOW}) VHF MD-390 / RT-8 (with GPS)"
echo -e " ${WHITE}4${YELLOW}) UHF MD-390 / RT-8 (with GPS)"
echo ""
echo -e " or Press Enter to abort"
echo -e "${WHITE}"
echo ""
read -p 'Choose 1, 2, 3 or 4 and then press Enter ' userval
case $userval in
1)
echo -e "${YELLOW}Making a backup of your current codeplug..."
echo -e "${RED}"
if [ -f $BACKUPFQN ]; then
rm $BACKUPFQN
fi
~/md380tools/md380-dfu read $BACKUPFQN
echo -e "${YELLOW}Writing blank codeplug to VHF MD-380 / RT-3"
echo -e "${RED}"
~/md380tools/md380-dfu write ~/md380tools-vm/archive/blankplugMD380vhf.rdt
~/md380tools/md380-dfu reboot
if [ -f $BACKUPFQN ]; then
echo -e "${WHITE}If you just made a mistake, you can restore your previous codeplug with this:"
echo -e "${BLUE}~/md380tools/md380-dfu write $BACKUPFQN"
fi
break;;
2)
echo -e "${YELLOW}Making a backup of your current codeplug..."
echo -e "${RED}"
if [ -f $BACKUPFQN ]; then
rm $BACKUPFQN
fi
~/md380tools/md380-dfu read $BACKUPFQN
echo -e "${YELLOW}Writing blank codeplug to UHF MD-380 / RT-3"
echo -e "${RED}"
~/md380tools/md380-dfu write ~/md380tools-vm/archive/blankplugMD380uhf.rdt
~/md380tools/md380-dfu reboot
if [ -f $BACKUPFQN ]; then
echo -e "${WHITE}If you just made a mistake, you can restore your previous codeplug with this:"
echo -e "${BLUE}~/md380tools/md380-dfu write $BACKUPFQN"
fi
break;;
3)
echo -e "${YELLOW}Making a backup of your current codeplug..."
echo -e "${RED}"
if [ -f $BACKUPFQN ]; then
rm $BACKUPFQN
fi
~/md380tools/md380-dfu read $BACKUPFQN
echo -e "${YELLOW}Writing blank codeplug to VHF MD-390 / RT-8"
echo -e "${RED}"
~/md380tools/md380-dfu write ~/md380tools-vm/archive/blankplugMD390vhf.rdt
~/md380tools/md380-dfu reboot
echo -e "${WHITE}If you just made a mistake, you can restore your previous codeplug with this:"
if [ -f $BACKUPFQN ]; then
echo -e "${BLUE}~/md380tools/md380-dfu write $BACKUPFQN"
fi
break;;
4)
echo -e "${YELLOW}Making a backup of your current codeplug..."
echo -e "${RED}"
if [ -f $BACKUPFQN ]; then
rm $BACKUPFQN
fi
~/md380tools/md380-dfu read $BACKUPFQN
echo -e "${YELLOW}Writing blank codeplug to UHF MD-390 / RT-8"
echo -e "${RED}"
~/md380tools/md380-dfu write ~/md380tools-vm/archive/blankplugMD390uhf.rdt
~/md380tools/md380-dfu reboot
echo -e "${WHITE}If you just made a mistake, you can restore your previous codeplug with this:"
if [ -f $BACKUPFQN ]; then
echo -e "${BLUE}~/md380tools/md380-dfu write $BACKUPFQN"
fi
break;;
*)
break;;
esac
done
sleep 3
echo ""
echo -e "${NC}Run the ${YELLOW}menu${NC} command to return to main screen"