-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_streaming.sh
executable file
·65 lines (60 loc) · 1.83 KB
/
install_streaming.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
#!/bin/bash
# Raspberry Pi Internet Radio - Install Icecast2
# This script installs and configures Icecast2 to run with MPD
# $Id: install_streaming.sh,v 1.4 2014/05/31 06:24:40 bob Exp $
#
# Author : Bob Rathbone
# Site : http://www.bobrathbone.com
#
# 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.
# File locations
DIR=/home/pi/radio
MPDCONF=/etc/mpd.conf
XMLCONF=/etc/icecast2/icecast.xml
MPDSTREAM=${DIR}/configs/mpdstream
MOUNTPOINT=/mpd
echo "Starting Icecast2 integration with the Music Player Daemon"
if [[ $( id -u ) -ne 0 ]]; then
echo "This script can only be run as super user"
echo "Run the command \"sudo bash\" first"
exit 1
fi
# Install Icecast
if [[ ! -f ${XMLCONF} ]]; then
echo "The Icecast2 installation program will ask if you wish to configure Icecast2. "
echo "Answer 'yes' to this. Configure Icecast as follows:"
echo "Icecast2 hostname: localhost"
echo "Icecast2 source password: mympd"
echo "Icecast2 relay password: mympd"
echo "Icecast2 administration password: mympd"
echo -n "Continue y/n: "
read ans
if [[ "${ans}" -ne 'y' ]]; then
echo "Exiting."
exit 0
fi
echo
apt-get install icecast2
else
echo "Icecast2 package already installed"
fi
echo "Configuring Icecast2"
if [[ ! -f ${XMLCONF}.orig ]]; then
echo "Copying ${XMLCONF} to ${XMLCONF}.orig"
cp -fp ${XMLCONF} ${XMLCONF}.orig
OLDENTRY="<mount-name>\/example-complex\.ogg"
NEWENTRY="<mount-name>\/mpd<\/mount>"
sed -i "s/${OLDENTRY}.*/${NEWENTRY}/g" ${XMLCONF}
mkdir -p ${MOUNTPOINT}
service icecast2 restart
fi
# Modify mpd.conf
grep mympd /etc/mpd.conf > /dev/null
if [[ $? -ne 0 ]]; then
cat ${MPDSTREAM} >> ${MPDCONF}
service mpd restart
fi
# End of script