forked from hifiberry/hifiberry-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-streaming
More file actions
93 lines (77 loc) · 2.25 KB
/
Copy pathinstall-streaming
File metadata and controls
93 lines (77 loc) · 2.25 KB
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
# Install prerequisites
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y install wget git
# Download DAC+ ADC kernel
cd
echo "Downloading DAC+ ADC kernel from Github"
git clone https://github.com/hifiberry/dacadckernel
cd /
echo Extracting kernel
sudo tar xvfz ~/dacadckernel/4.18.dacadc.tar.gz
cat /boot/config.txt | grep -v "kernel=" | grep -v "dtoverlay=hifiberry-" | grep -v "dtparam=audio=on" >> /tmp/config.txt
echo Enabling kernel in /boot/config.txt
echo "kernel=kernel7-hb.img" >> /tmp/config.txt
echo "dtoverlay=hifiberry-dacplusadc" >> /tmp/config.txt
sudo mv /boot/config.txt /boot/config.bak
sudo mv /tmp/config.txt /boot/config.txt
echo Removing temporary files
cd
rm -rf dacadckernel
# Install Icecast
sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install icecast2
# Install ices
sudo apt-get install -yq ices2
# Create streaming user
sudo useradd icecast -g audio
# Set correct permissions
sudo mkdir -p /var/log/icecast2
sudo mkdir -p /var/log/ices
sudo mkdir -p /var/icecast
sudo chown -R icecast /var/log/icecast2
sudo chown -R icecast /var/log/ices
sudo chown -R icecast /var/icecast
# Install config files
cd /etc
sudo mv ices.xml ices.xml.bak
sudo wget https://raw.githubusercontent.com/hifiberry/hifiberry-tools/master/conf/ices.conf
sudo mv ices.conf ices.xml
sudo chown icecast ices.xml
cd /etc/icecast2
sudo mv icecast.xml icecast.xml.bak
sudo wget https://raw.githubusercontent.com/hifiberry/hifiberry-tools/master/conf/icecast.xml
sudo chown icecast icecast.xml
# Icecast systemd integration
sudo rm /etc/init.d/icecast2
cat <<EOT | sudo tee /lib/systemd/system/icecast2.service
[Unit]
Description=Icecast2
After=network.target
[Service]
User=icecast
Group=audio
ExecStart=/usr/bin/icecast2 -b -c /etc/icecast2/icecast.xml
PIDFile=/var/icecast/icecast.pid
Type=forking
[Install]
WantedBy=multi-user.target
EOT
sudo systemctl daemon-reload
sudo systemctl enable icecast2
# Ices2 startup
cat <<EOT | sudo tee /lib/systemd/system/ices2.service
[Unit]
Description=Ices2
After=icecast2.service
[Service]
User=icecast
Group=audio
ExecStart=/usr/bin/ices2 /etc/ices.xml
[Install]
WantedBy=multi-user.target
EOT
sudo systemctl daemon-reload
sudo systemctl enable ices2
# Start Icecast and Ices2
sudo systemctl start icecast2
sudo systemctl start ices2