-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathselect_daemon.sh
executable file
·101 lines (83 loc) · 2.16 KB
/
select_daemon.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
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
#!/bin/bash
# Raspberry Pi Internet Radio
# $Id: select_daemon.sh,v 1.11 2015/02/08 13:19:30 bob Exp $
#
# Author : Bob Rathbone
# Site : http://www.bobrathbone.com
#
# This program is used during installation to set up which
# radio daemon is to be used
#
# License: GNU V3, See https://www.gnu.org/copyleft/gpl.html
#
# Disclaimer: Software is provided as is and absolutly no warranties are implied or given.
# The authors shall not be liable for any loss or damage however caused.
#
DAEMON=radiod.py
INIT=/etc/init.d/radiod
# Display types
LCD=1 # LCD screen (direct)
I2C=2 # Requires I2C libraries
CAD=3 # PiFace Control and Display
echo
echo "Radio daemon selection"
echo
echo "Select the radio daemon to be installed 1-8:"
echo
echo "1) Two line LCD with push buttons (radiod.py)"
echo "2) Four line LCD with push buttons (radio4.py)"
echo "3) Two line LCD with rotary encoders (rradiod.py)"
echo "4) Four line LCD with rotary encoders (rradio4.py)"
echo "5) Two line Adafruit LCD with push buttons (ada_radio.py)"
echo "6) Two line LCD with I2C backpack and rotary encoders (rradiobp.py)"
echo "7) Four line LCD with I2C backpack and rotary encoders (rradiobp4.py)"
echo "8) PiFace Control and Display - CAD (radio_piface.py)"
echo "x) Exit"
echo -n "Select version: "
while read ans
do
if [[ ${ans} == '1' ]]; then
DAEMON=radiod.py
TYPE=${LCD}
break
elif [[ ${ans} == '2' ]]; then
DAEMON=radio4.py
TYPE=${LCD}
break
elif [[ ${ans} == '3' ]]; then
DAEMON=rradiod.py
TYPE=${LCD}
break
elif [[ ${ans} == '4' ]]; then
DAEMON=rradio4.py
TYPE=${LCD}
break
elif [[ ${ans} == '5' ]]; then
DAEMON=ada_radio.py
TYPE=${I2C}
break
elif [[ ${ans} == '6' ]]; then
DAEMON=rradiobp.py
TYPE=${I2C}
break
elif [[ ${ans} == '7' ]]; then
DAEMON=rradiobp4.py
TYPE=${I2C}
break
elif [[ ${ans} == '8' ]]; then
DAEMON=radio_piface.py
TYPE=${CAD}
break
elif [[ ${ans} == 'x' ]]; then
exit 0
else
echo -n "Select version: "
fi
done
echo "Daemon ${DAEMON} selected"
# Update the System V init script
sudo sed -i "s/^NAME=.*/NAME=${DAEMON}/g" ${INIT}
echo
# Pass selected daemon type to post install script
exit ${TYPE}
# End of script