-
Notifications
You must be signed in to change notification settings - Fork 2
/
updateobjects.sh
executable file
·47 lines (35 loc) · 1.11 KB
/
updateobjects.sh
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
#!/bin/sh
# Dynamically get the card to use
dwpath="/opt/direwolf/"
echo "Setting up volume and aprs objects" #>> /tmp/dw-start.log
cardname='C-Media'
card=`arecord -l | grep $cardname | cut -f 2 -d " " | cut -f 1 -d ":"`
# Make sure our card is a number
if [ "$card" -eq "$card" ] 2>/dev/null; then
echo -n
else
echo "card didn't come up with a valid number: $card"
exit
fi
# Set mic to level 1 (was 5??)
/usr/bin/amixer -q -c $card sset Mic 1
# Set Auto Gain control off
/usr/bin/amixer -q -c $card sset "Auto Gain Control" off
# Set speaker to 5 (was 8?)
/usr/bin/amixer -q -c $card sset "Speaker" 5
# Update the Direwolf config file
template=${dwpath}/direwolf.template
config={$dwpath}/direwolf.conf
# Move the file so we can compare
mv $config ${config}.bak
echo "# Do not edit this file, edit $template" >$config
echo "# Generated by script" >>$config
echo "ADEVICE plughw:$card,0 plughw:$card,0" >>$config
cat $template >>$config
cd /opt/direwolf
timeout 120s perl ${dwpath}/aprs.pl >>$config
rc=$?
if [ $rc != 0 ]; then
echo "APRS Script failed, reverting"
mv ${config}.bak $config
fi