| 
				
			 | 
			
			
				@@ -0,0 +1,677 @@ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1
			 | 
			
			
				+#!/bin/bash 
			 | 
		
	
		
			
			| 
				
			 | 
			
				2
			 | 
			
			
				+# 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3
			 | 
			
			
				+# .---.                  .              . 
			 | 
		
	
		
			
			| 
				
			 | 
			
				4
			 | 
			
			
				+# |                      |              | 
			 | 
		
	
		
			
			| 
				
			 | 
			
				5
			 | 
			
			
				+# |--- .--. .-.  .-.  .-.|  .-. .--.--. |.-.  .-. .--.  .-. 
			 | 
		
	
		
			
			| 
				
			 | 
			
				6
			 | 
			
			
				+# |    |   (.-' (.-' (   | (   )|  |  | |   )(   )|  | (.-' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7
			 | 
			
			
				+# '    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				8
			 | 
			
			
				+# 
			 | 
		
	
		
			
			| 
				
			 | 
			
				9
			 | 
			
			
				+#                    Freedom in the Cloud 
			 | 
		
	
		
			
			| 
				
			 | 
			
				10
			 | 
			
			
				+# 
			 | 
		
	
		
			
			| 
				
			 | 
			
				11
			 | 
			
			
				+# Icecast application 
			 | 
		
	
		
			
			| 
				
			 | 
			
				12
			 | 
			
			
				+# 
			 | 
		
	
		
			
			| 
				
			 | 
			
				13
			 | 
			
			
				+# License 
			 | 
		
	
		
			
			| 
				
			 | 
			
				14
			 | 
			
			
				+# ======= 
			 | 
		
	
		
			
			| 
				
			 | 
			
				15
			 | 
			
			
				+# 
			 | 
		
	
		
			
			| 
				
			 | 
			
				16
			 | 
			
			
				+# Copyright (C) 2017 Bob Mottram <bob@freedombone.net> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				17
			 | 
			
			
				+# 
			 | 
		
	
		
			
			| 
				
			 | 
			
				18
			 | 
			
			
				+# This program is free software: you can redistribute it and/or modify 
			 | 
		
	
		
			
			| 
				
			 | 
			
				19
			 | 
			
			
				+# it under the terms of the GNU Affero General Public License as published by 
			 | 
		
	
		
			
			| 
				
			 | 
			
				20
			 | 
			
			
				+# the Free Software Foundation, either version 3 of the License, or 
			 | 
		
	
		
			
			| 
				
			 | 
			
				21
			 | 
			
			
				+# (at your option) any later version. 
			 | 
		
	
		
			
			| 
				
			 | 
			
				22
			 | 
			
			
				+# 
			 | 
		
	
		
			
			| 
				
			 | 
			
				23
			 | 
			
			
				+# This program is distributed in the hope that it will be useful, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				24
			 | 
			
			
				+# but WITHOUT ANY WARRANTY; without even the implied warranty of 
			 | 
		
	
		
			
			| 
				
			 | 
			
				25
			 | 
			
			
				+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
			 | 
		
	
		
			
			| 
				
			 | 
			
				26
			 | 
			
			
				+# GNU Affero General Public License for more details. 
			 | 
		
	
		
			
			| 
				
			 | 
			
				27
			 | 
			
			
				+# 
			 | 
		
	
		
			
			| 
				
			 | 
			
				28
			 | 
			
			
				+# You should have received a copy of the GNU Affero General Public License 
			 | 
		
	
		
			
			| 
				
			 | 
			
				29
			 | 
			
			
				+# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
			 | 
		
	
		
			
			| 
				
			 | 
			
				30
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				31
			 | 
			
			
				+VARIANTS='full' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				32
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				33
			 | 
			
			
				+IN_DEFAULT_INSTALL=0 
			 | 
		
	
		
			
			| 
				
			 | 
			
				34
			 | 
			
			
				+SHOW_ON_ABOUT=1 
			 | 
		
	
		
			
			| 
				
			 | 
			
				35
			 | 
			
			
				+SHOW_ICANN_ADDRESS_ON_ABOUT=0 
			 | 
		
	
		
			
			| 
				
			 | 
			
				36
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				37
			 | 
			
			
				+ICECAST_DOMAIN_NAME= 
			 | 
		
	
		
			
			| 
				
			 | 
			
				38
			 | 
			
			
				+ICECAST_CODE= 
			 | 
		
	
		
			
			| 
				
			 | 
			
				39
			 | 
			
			
				+ICECAST_PORT=8005 
			 | 
		
	
		
			
			| 
				
			 | 
			
				40
			 | 
			
			
				+ICECAST_ONION_PORT=8146 
			 | 
		
	
		
			
			| 
				
			 | 
			
				41
			 | 
			
			
				+ICECAST_DIR=/icestream 
			 | 
		
	
		
			
			| 
				
			 | 
			
				42
			 | 
			
			
				+ICECAST_PLAYLIST_FILE=/etc/ices2/playlist.txt 
			 | 
		
	
		
			
			| 
				
			 | 
			
				43
			 | 
			
			
				+ICECAST_LOGIN_TEXT=$"Icecast login" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				44
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				45
			 | 
			
			
				+icecast_variables=(MY_USERNAME 
			 | 
		
	
		
			
			| 
				
			 | 
			
				46
			 | 
			
			
				+                   ONION_ONLY 
			 | 
		
	
		
			
			| 
				
			 | 
			
				47
			 | 
			
			
				+                   ICECAST_DOMAIN_NAME 
			 | 
		
	
		
			
			| 
				
			 | 
			
				48
			 | 
			
			
				+                   ICECAST_CODE 
			 | 
		
	
		
			
			| 
				
			 | 
			
				49
			 | 
			
			
				+                   DEFAULT_LANGUAGE) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				50
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				51
			 | 
			
			
				+function icecast_update_daemon { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				52
			 | 
			
			
				+    echo '#! /bin/sh' > /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				53
			 | 
			
			
				+    echo '#' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				54
			 | 
			
			
				+    echo '# icecast2' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				55
			 | 
			
			
				+    echo '#' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				56
			 | 
			
			
				+    echo '#                Written by Miquel van Smoorenburg <miquels@cistron.nl>.' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				57
			 | 
			
			
				+    echo '#                Modified for Debian' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				58
			 | 
			
			
				+    echo '#                by Ian Murdock <imurdock@gnu.ai.mit.edu>.' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				59
			 | 
			
			
				+    echo '#' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				60
			 | 
			
			
				+    echo '#                Further modified by Keegan Quinn <ice@thebasement.org>' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				61
			 | 
			
			
				+    echo '#                for use with Icecast 2' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				62
			 | 
			
			
				+    echo '#' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				63
			 | 
			
			
				+    echo '' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				64
			 | 
			
			
				+    echo 'PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				65
			 | 
			
			
				+    echo 'DAEMON=/usr/bin/icecast2' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				66
			 | 
			
			
				+    echo 'NAME=icecast2' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				67
			 | 
			
			
				+    echo 'DESC=icecast2' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				68
			 | 
			
			
				+    echo 'ICES=/usr/bin/ices2' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				69
			 | 
			
			
				+    echo 'ICES_CONFIGFILE=/etc/ices2/ices-playlist.xml' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				70
			 | 
			
			
				+    echo '' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				71
			 | 
			
			
				+    echo 'test -x $DAEMON || exit 0' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				72
			 | 
			
			
				+    echo '' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				73
			 | 
			
			
				+    echo '# Defaults' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				74
			 | 
			
			
				+    echo 'CONFIGFILE="/etc/icecast2/icecast.xml"' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				75
			 | 
			
			
				+    echo 'CONFIGDEFAULTFILE="/etc/default/icecast2"' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				76
			 | 
			
			
				+    echo 'USERID=icecast2' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				77
			 | 
			
			
				+    echo 'GROUPID=icecast' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				78
			 | 
			
			
				+    echo 'ENABLE="false"' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				79
			 | 
			
			
				+    echo '' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				80
			 | 
			
			
				+    echo '# Reads config file (will override defaults above)' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				81
			 | 
			
			
				+    echo '[ -r "$CONFIGDEFAULTFILE" ] && . $CONFIGDEFAULTFILE' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				82
			 | 
			
			
				+    echo '' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				83
			 | 
			
			
				+    echo 'if [ "$ENABLE" != "true" ]; then' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				84
			 | 
			
			
				+    echo '        echo "$NAME daemon disabled - read $CONFIGDEFAULTFILE."' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				85
			 | 
			
			
				+    echo '        exit 0' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				86
			 | 
			
			
				+    echo 'fi' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				87
			 | 
			
			
				+    echo '' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				88
			 | 
			
			
				+    echo 'set -e' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				89
			 | 
			
			
				+    echo '' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				90
			 | 
			
			
				+    echo 'case "$1" in' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				91
			 | 
			
			
				+    echo '  start)' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				92
			 | 
			
			
				+    echo '        echo -n "Starting $DESC: "' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				93
			 | 
			
			
				+    echo '        start-stop-daemon --start --quiet --chuid $USERID:$GROUPID \' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				94
			 | 
			
			
				+    echo '                --exec $DAEMON -- -b -c $CONFIGFILE' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				95
			 | 
			
			
				+    echo '        sleep 3' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				96
			 | 
			
			
				+    echo '        start-stop-daemon --start --quiet --exec $ICES $ICES_CONFIGFILE' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				97
			 | 
			
			
				+    echo '        echo "$NAME."' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				98
			 | 
			
			
				+    echo '        ;;' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				99
			 | 
			
			
				+    echo '  stop)' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				100
			 | 
			
			
				+    echo '        echo -n "Stopping $DESC: "' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				101
			 | 
			
			
				+    echo '        start-stop-daemon --stop --oknodo --quiet --exec $ICES' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				102
			 | 
			
			
				+    echo '' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				103
			 | 
			
			
				+    echo '        start-stop-daemon --stop --oknodo --quiet --exec $DAEMON' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				104
			 | 
			
			
				+    echo '        echo "$NAME."' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				105
			 | 
			
			
				+    echo '        ;;' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				106
			 | 
			
			
				+    echo '  reload|force-reload)' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				107
			 | 
			
			
				+    echo '        echo "Reloading $DESC configuration files."' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				108
			 | 
			
			
				+    echo '        start-stop-daemon --stop --oknodo --quiet --exec $ICES' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				109
			 | 
			
			
				+    echo '        start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				110
			 | 
			
			
				+    echo '        sleep 3' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				111
			 | 
			
			
				+    echo '        start-stop-daemon --start --quiet --exec $ICES $ICES_CONFIGFILE' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				112
			 | 
			
			
				+    echo '        ;;' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				113
			 | 
			
			
				+    echo '  restart)' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				114
			 | 
			
			
				+    echo '        echo -n "Restarting $DESC: "' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				115
			 | 
			
			
				+    echo '        start-stop-daemon --stop --oknodo --quiet --exec $ICES' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				116
			 | 
			
			
				+    echo '' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				117
			 | 
			
			
				+    echo '        start-stop-daemon --stop --oknodo --quiet --exec $DAEMON' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				118
			 | 
			
			
				+    echo '        sleep 3' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				119
			 | 
			
			
				+    echo '        start-stop-daemon --start --quiet --chuid $USERID:$GROUPID \' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				120
			 | 
			
			
				+    echo '                --exec $DAEMON -- -b -c $CONFIGFILE' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				121
			 | 
			
			
				+    echo '        sleep 3' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				122
			 | 
			
			
				+    echo '        start-stop-daemon --start --quiet --exec $ICES $ICES_CONFIGFILE' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				123
			 | 
			
			
				+    echo '        echo "$NAME."' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				124
			 | 
			
			
				+    echo '        ;;' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				125
			 | 
			
			
				+    echo '  *)' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				126
			 | 
			
			
				+    echo '        echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				127
			 | 
			
			
				+    echo '        exit 1' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				128
			 | 
			
			
				+    echo '        ;;' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				129
			 | 
			
			
				+    echo 'esac' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				130
			 | 
			
			
				+    echo '' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				131
			 | 
			
			
				+    echo 'exit 0' >> /etc/init.d/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				132
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				133
			 | 
			
			
				+    systemctl daemon-reload 
			 | 
		
	
		
			
			| 
				
			 | 
			
				134
			 | 
			
			
				+    systemctl restart icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				135
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				136
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				137
			 | 
			
			
				+function change_password_icecast { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				138
			 | 
			
			
				+    curr_username="$1" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				139
			 | 
			
			
				+    new_user_password="$2" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				140
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				141
			 | 
			
			
				+    sed -i  -e "s|<source-password>[^<]*</source-password>|<source-password>$new_user_password</source-password>|" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				142
			 | 
			
			
				+        -e "s|<relay-password>[^<]*</relay-password>|<relay-password>$new_user_password</relay-password>|" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				143
			 | 
			
			
				+        -e "s|<admin-password>[^<]*</admin-password>|<admin-password>$new_user_password</admin-password>|" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				144
			 | 
			
			
				+        /etc/icecast2/icecast.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				145
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				146
			 | 
			
			
				+    ${PROJECT_NAME}-pass -u "$curr_username" -a icecast -p "$new_user_password" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				147
			 | 
			
			
				+    systemctl restart icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				148
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				149
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				150
			 | 
			
			
				+function logging_on_icecast { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				151
			 | 
			
			
				+    echo -n '' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				152
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				153
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				154
			 | 
			
			
				+function logging_off_icecast { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				155
			 | 
			
			
				+    echo -n '' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				156
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				157
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				158
			 | 
			
			
				+function reconfigure_icecast { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				159
			 | 
			
			
				+    echo -n '' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				160
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				161
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				162
			 | 
			
			
				+function icecast_convert_files { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				163
			 | 
			
			
				+    clear 
			 | 
		
	
		
			
			| 
				
			 | 
			
				164
			 | 
			
			
				+    cd ${1} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				165
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				166
			 | 
			
			
				+    echo $'Converting any mp3 files to ogg format' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				167
			 | 
			
			
				+    find . -type f -name '*.mp3' -exec bash -c 'ffmpeg -i "$0" -c:a libvorbis -q:a 4 "${f/%mp3/ogg}' '{}' \; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				168
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				169
			 | 
			
			
				+    echo $'Converting any mp4 files to ogv format' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				170
			 | 
			
			
				+    find . -type f -name '*.mp4' -exec bash -c 'ffmpeg -i "$0" -c:a libvorbis -q:a 4 "${f/%mp4/ogv}' '{}' \; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				171
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				172
			 | 
			
			
				+    chown -R icecast2:icecast2 $ICECAST_DIR 
			 | 
		
	
		
			
			| 
				
			 | 
			
				173
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				174
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				175
			 | 
			
			
				+function icecast_add_file_to_playlist { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				176
			 | 
			
			
				+    files_dir=${1} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				177
			 | 
			
			
				+    if [ ! -d $files_dir ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				178
			 | 
			
			
				+        return 
			 | 
		
	
		
			
			| 
				
			 | 
			
				179
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				180
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				181
			 | 
			
			
				+    echo $'Adding ogg files to playlist' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				182
			 | 
			
			
				+    find $files_dir -type f -name '*.ogg' -print0 | while read -d $'\0' file; do 
			 | 
		
	
		
			
			| 
				
			 | 
			
				183
			 | 
			
			
				+        if ! grep -q "$file" $ICECAST_PLAYLIST_FILE; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				184
			 | 
			
			
				+            echo "$file" >> $ICECAST_PLAYLIST_FILE 
			 | 
		
	
		
			
			| 
				
			 | 
			
				185
			 | 
			
			
				+        fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				186
			 | 
			
			
				+    done 
			 | 
		
	
		
			
			| 
				
			 | 
			
				187
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				188
			 | 
			
			
				+    echo $'Adding ogv files to playlist' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				189
			 | 
			
			
				+    find $files_dir -type f -name '*.ogv' -print0 | while read -d $'\0' file; do 
			 | 
		
	
		
			
			| 
				
			 | 
			
				190
			 | 
			
			
				+        if ! grep -q "$file" $ICECAST_PLAYLIST_FILE; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				191
			 | 
			
			
				+            echo "$file" >> $ICECAST_PLAYLIST_FILE 
			 | 
		
	
		
			
			| 
				
			 | 
			
				192
			 | 
			
			
				+        fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				193
			 | 
			
			
				+    done 
			 | 
		
	
		
			
			| 
				
			 | 
			
				194
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				195
			 | 
			
			
				+    chown icecast2:icecast2 $ICECAST_PLAYLIST_FILE 
			 | 
		
	
		
			
			| 
				
			 | 
			
				196
			 | 
			
			
				+    systemctl restart icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				197
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				198
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				199
			 | 
			
			
				+function icecast_import_from_directory { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				200
			 | 
			
			
				+    data=$(tempfile 2>/dev/null) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				201
			 | 
			
			
				+    dialog --title "Choose a directory containing stream files" --dselect /home/$MY_USERNAME/ 30 60 2> $data 
			 | 
		
	
		
			
			| 
				
			 | 
			
				202
			 | 
			
			
				+    selected_dir=$(cat $data) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				203
			 | 
			
			
				+    rm $data 
			 | 
		
	
		
			
			| 
				
			 | 
			
				204
			 | 
			
			
				+    if [[ "$selected_dir" == "$ICECAST_DIR" ]]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				205
			 | 
			
			
				+        return 
			 | 
		
	
		
			
			| 
				
			 | 
			
				206
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				207
			 | 
			
			
				+    if [ ! -d $selected_dir ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				208
			 | 
			
			
				+        return 
			 | 
		
	
		
			
			| 
				
			 | 
			
				209
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				210
			 | 
			
			
				+    if [[ "$selected_dir" == "/home/$MY_USERNAME/" ]]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				211
			 | 
			
			
				+        return 
			 | 
		
	
		
			
			| 
				
			 | 
			
				212
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				213
			 | 
			
			
				+    if [[ "$selected_dir" == "/home/$MY_USERNAME/."* ]]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				214
			 | 
			
			
				+        return 
			 | 
		
	
		
			
			| 
				
			 | 
			
				215
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				216
			 | 
			
			
				+    if [[ "$selected_dir" == *"/Maildir" || "$selected_dir" == *"/Sync" ]]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				217
			 | 
			
			
				+        return 
			 | 
		
	
		
			
			| 
				
			 | 
			
				218
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				219
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				220
			 | 
			
			
				+    dialog --title $"Import stream files directory into Icecast" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				221
			 | 
			
			
				+           --backtitle $"Freedombone Control Panel" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				222
			 | 
			
			
				+           --defaultno \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				223
			 | 
			
			
				+           --yesno $"\nImport the directory:\n\n  $selected_dir" 12 75 
			 | 
		
	
		
			
			| 
				
			 | 
			
				224
			 | 
			
			
				+    sel=$? 
			 | 
		
	
		
			
			| 
				
			 | 
			
				225
			 | 
			
			
				+    case $sel in 
			 | 
		
	
		
			
			| 
				
			 | 
			
				226
			 | 
			
			
				+        1) return;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				227
			 | 
			
			
				+        255) return;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				228
			 | 
			
			
				+    esac 
			 | 
		
	
		
			
			| 
				
			 | 
			
				229
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				230
			 | 
			
			
				+    if [ ! -d $ICECAST_DIR ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				231
			 | 
			
			
				+        mkdir -p $ICECAST_DIR 
			 | 
		
	
		
			
			| 
				
			 | 
			
				232
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				233
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				234
			 | 
			
			
				+    dest_dir=$(basename "$selected_dir") 
			 | 
		
	
		
			
			| 
				
			 | 
			
				235
			 | 
			
			
				+    mv "$selected_dir" $ICECAST_DIR 
			 | 
		
	
		
			
			| 
				
			 | 
			
				236
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				237
			 | 
			
			
				+    icecast_convert_files $ICECAST_DIR/$dest_dir 
			 | 
		
	
		
			
			| 
				
			 | 
			
				238
			 | 
			
			
				+    icecast_add_file_to_playlist $ICECAST_DIR/$dest_dir 
			 | 
		
	
		
			
			| 
				
			 | 
			
				239
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				240
			 | 
			
			
				+    dialog --title $"Import stream files directory into Icecast" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				241
			 | 
			
			
				+           --msgbox $"Import success" 6 40 
			 | 
		
	
		
			
			| 
				
			 | 
			
				242
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				243
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				244
			 | 
			
			
				+function icecast_import_from_usb { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				245
			 | 
			
			
				+    clear 
			 | 
		
	
		
			
			| 
				
			 | 
			
				246
			 | 
			
			
				+    detect_usb_drive 
			 | 
		
	
		
			
			| 
				
			 | 
			
				247
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				248
			 | 
			
			
				+    if [ ! -b $USB_DRIVE ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				249
			 | 
			
			
				+        dialog --title $"Import stream files from USB drive" --msgbox $'No USB drive found' 6 50 
			 | 
		
	
		
			
			| 
				
			 | 
			
				250
			 | 
			
			
				+        return 
			 | 
		
	
		
			
			| 
				
			 | 
			
				251
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				252
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				253
			 | 
			
			
				+    backup_mount_drive ${USB_DRIVE} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				254
			 | 
			
			
				+    if [ ! -d $USB_MOUNT$ICECAST_DIR ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				255
			 | 
			
			
				+        dialog --title $"Import stream files from USB drive" --msgbox $'No stream files directory found on USB drive' 6 50 
			 | 
		
	
		
			
			| 
				
			 | 
			
				256
			 | 
			
			
				+        backup_unmount_drive ${USB_DRIVE} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				257
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				258
			 | 
			
			
				+    cp -ru $USB_MOUNT$ICECAST_DIR/* $ICECAST_DIR 
			 | 
		
	
		
			
			| 
				
			 | 
			
				259
			 | 
			
			
				+    backup_unmount_drive ${USB_DRIVE} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				260
			 | 
			
			
				+    icecast_convert_files $ICECAST_DIR 
			 | 
		
	
		
			
			| 
				
			 | 
			
				261
			 | 
			
			
				+    dialog --title $"Import stream files from USB drive" --msgbox $'Import complete. You may now remove the USB drive' 6 50 
			 | 
		
	
		
			
			| 
				
			 | 
			
				262
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				263
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				264
			 | 
			
			
				+function icecast_export_to_usb { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				265
			 | 
			
			
				+    clear 
			 | 
		
	
		
			
			| 
				
			 | 
			
				266
			 | 
			
			
				+    detect_usb_drive 
			 | 
		
	
		
			
			| 
				
			 | 
			
				267
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				268
			 | 
			
			
				+    if [ ! -b $USB_DRIVE ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				269
			 | 
			
			
				+        dialog --title $"Export stream files to USB drive" --msgbox $'No USB drive found' 6 50 
			 | 
		
	
		
			
			| 
				
			 | 
			
				270
			 | 
			
			
				+        return 
			 | 
		
	
		
			
			| 
				
			 | 
			
				271
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				272
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				273
			 | 
			
			
				+    backup_mount_drive ${USB_DRIVE} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				274
			 | 
			
			
				+    if [ ! -d $USB_MOUNT$ICECAST_DIR ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				275
			 | 
			
			
				+        mkdir -p $USB_MOUNT$ICECAST_DIR 
			 | 
		
	
		
			
			| 
				
			 | 
			
				276
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				277
			 | 
			
			
				+    cp -ru $ICECAST_DIR/* $USB_MOUNT$ICECAST_DIR 
			 | 
		
	
		
			
			| 
				
			 | 
			
				278
			 | 
			
			
				+    backup_unmount_drive ${USB_DRIVE} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				279
			 | 
			
			
				+    dialog --title $"Export stream files to USB drive" --msgbox $'Export complete. You may now remove the USB drive' 6 50 
			 | 
		
	
		
			
			| 
				
			 | 
			
				280
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				281
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				282
			 | 
			
			
				+function icecast_format_drive { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				283
			 | 
			
			
				+    detect_usb_drive 
			 | 
		
	
		
			
			| 
				
			 | 
			
				284
			 | 
			
			
				+    data=$(tempfile 2>/dev/null) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				285
			 | 
			
			
				+    trap "rm -f $data" 0 1 2 5 15 
			 | 
		
	
		
			
			| 
				
			 | 
			
				286
			 | 
			
			
				+    dialog --title $"Format USB drive $USB_DRIVE for stream file storage" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				287
			 | 
			
			
				+           --backtitle $"Freedombone Control Panel" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				288
			 | 
			
			
				+           --defaultno \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				289
			 | 
			
			
				+           --yesno $"\nPlease confirm that you wish to format drive\n\n    ${USB_DRIVE}\n\nAll current data on the drive will be lost, and you will be prompted to give a password used to encrypt the drive.\n\nDANGER: If you screw up here and format the wrong drive it's your own fault!" 16 60 
			 | 
		
	
		
			
			| 
				
			 | 
			
				290
			 | 
			
			
				+    sel=$? 
			 | 
		
	
		
			
			| 
				
			 | 
			
				291
			 | 
			
			
				+    case $sel in 
			 | 
		
	
		
			
			| 
				
			 | 
			
				292
			 | 
			
			
				+        1) return;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				293
			 | 
			
			
				+        255) return;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				294
			 | 
			
			
				+    esac 
			 | 
		
	
		
			
			| 
				
			 | 
			
				295
			 | 
			
			
				+    rm $data 
			 | 
		
	
		
			
			| 
				
			 | 
			
				296
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				297
			 | 
			
			
				+    clear 
			 | 
		
	
		
			
			| 
				
			 | 
			
				298
			 | 
			
			
				+    echo '' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				299
			 | 
			
			
				+    echo $"Formatting drive $USB_DRIVE. ALL CONTENTS WILL BE LOST." 
			 | 
		
	
		
			
			| 
				
			 | 
			
				300
			 | 
			
			
				+    echo '' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				301
			 | 
			
			
				+    ${PROJECT_NAME}-format $USB_DRIVE 
			 | 
		
	
		
			
			| 
				
			 | 
			
				302
			 | 
			
			
				+    dialog --title $"Format USB drive $USB_DRIVE for stream file storage" --msgbox $'Format complete. You may now export stream files or remove the USB drive' 6 50 
			 | 
		
	
		
			
			| 
				
			 | 
			
				303
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				304
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				305
			 | 
			
			
				+function icecast_edit_playlist { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				306
			 | 
			
			
				+    editor $ICECAST_PLAYLIST_FILE 
			 | 
		
	
		
			
			| 
				
			 | 
			
				307
			 | 
			
			
				+    systemctl restart icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				308
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				309
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				310
			 | 
			
			
				+function icecast_change_login { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				311
			 | 
			
			
				+    read_config_param $MY_USERNAME 
			 | 
		
	
		
			
			| 
				
			 | 
			
				312
			 | 
			
			
				+    ICECAST_USER_PASSWORD=$(${PROJECT_NAME}-pass -u $MY_USERNAME -a icecastuser) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				313
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				314
			 | 
			
			
				+    data=$(tempfile 2>/dev/null) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				315
			 | 
			
			
				+    trap "rm -f $data" 0 1 2 5 15 
			 | 
		
	
		
			
			| 
				
			 | 
			
				316
			 | 
			
			
				+    dialog --title $"Change Icecast stream visitor login" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				317
			 | 
			
			
				+           --backtitle $"Freedombone Control Panel" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				318
			 | 
			
			
				+           --inputbox $"Enter the new login password for stream visitors" 8 60 "$ICECAST_USER_PASSWORD" 2>$data 
			 | 
		
	
		
			
			| 
				
			 | 
			
				319
			 | 
			
			
				+    sel=$? 
			 | 
		
	
		
			
			| 
				
			 | 
			
				320
			 | 
			
			
				+    case $sel in 
			 | 
		
	
		
			
			| 
				
			 | 
			
				321
			 | 
			
			
				+        0)  ICECAST_USER_PASSWORD=$(<$data) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				322
			 | 
			
			
				+            if [[ "$ICECAST_USER_PASSWORD" != *' '* ]]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				323
			 | 
			
			
				+                if [ ${#ICECAST_USER_PASSWORD} -gt 8 ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				324
			 | 
			
			
				+                    ${PROJECT_NAME}-pass -u $MY_USERNAME -a icecastuser -p $ICECAST_USER_PASSWORD 
			 | 
		
	
		
			
			| 
				
			 | 
			
				325
			 | 
			
			
				+                    dialog --title $"Change Icecast stream visitor login" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				326
			 | 
			
			
				+                           --msgbox $"Password changed to $ICECAST_USER_PASSWORD" 6 75 
			 | 
		
	
		
			
			| 
				
			 | 
			
				327
			 | 
			
			
				+                fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				328
			 | 
			
			
				+            fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				329
			 | 
			
			
				+            ;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				330
			 | 
			
			
				+    esac 
			 | 
		
	
		
			
			| 
				
			 | 
			
				331
			 | 
			
			
				+    rm $data 
			 | 
		
	
		
			
			| 
				
			 | 
			
				332
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				333
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				334
			 | 
			
			
				+function icecast_enable_login { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				335
			 | 
			
			
				+    dialog --title $"Enable Icecast login" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				336
			 | 
			
			
				+           --backtitle $"Freedombone Control Panel" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				337
			 | 
			
			
				+           --defaultno \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				338
			 | 
			
			
				+           --yesno $"\nDo you want to add a login so that random web users can't access your stream?" 10 60 
			 | 
		
	
		
			
			| 
				
			 | 
			
				339
			 | 
			
			
				+    sel=$? 
			 | 
		
	
		
			
			| 
				
			 | 
			
				340
			 | 
			
			
				+    case $sel in 
			 | 
		
	
		
			
			| 
				
			 | 
			
				341
			 | 
			
			
				+        0) if grep -q '#auth_basic' /etc/nginx/sites-available/icecast; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				342
			 | 
			
			
				+               sed -i 's|#auth_basic|auth_basic|g' /etc/nginx/sites-available/icecast 
			 | 
		
	
		
			
			| 
				
			 | 
			
				343
			 | 
			
			
				+               systemctl restart nginx 
			 | 
		
	
		
			
			| 
				
			 | 
			
				344
			 | 
			
			
				+           fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				345
			 | 
			
			
				+           read_config_param $MY_USERNAME 
			 | 
		
	
		
			
			| 
				
			 | 
			
				346
			 | 
			
			
				+           ICECAST_USER_PASSWORD=$(${PROJECT_NAME}-pass -u $MY_USERNAME -a icecastuser) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				347
			 | 
			
			
				+           dialog --title $"Enable Icecast login" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				348
			 | 
			
			
				+                  --msgbox $"Icecast logins are now enabled with the password $ICECAST_USER_PASSWORD" 6 65 
			 | 
		
	
		
			
			| 
				
			 | 
			
				349
			 | 
			
			
				+           ICECAST_USER_PASSWORD= 
			 | 
		
	
		
			
			| 
				
			 | 
			
				350
			 | 
			
			
				+           ;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				351
			 | 
			
			
				+        1) if ! grep -q '#auth_basic' /etc/nginx/sites-available/icecast; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				352
			 | 
			
			
				+               sed -i 's|auth_basic|#auth_basic|g' /etc/nginx/sites-available/icecast 
			 | 
		
	
		
			
			| 
				
			 | 
			
				353
			 | 
			
			
				+               systemctl restart nginx 
			 | 
		
	
		
			
			| 
				
			 | 
			
				354
			 | 
			
			
				+           fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				355
			 | 
			
			
				+           dialog --title $"Disable Icecast login" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				356
			 | 
			
			
				+                  --msgbox $"Icecast logins are now disabled. Anyone can access your stream." 6 65 
			 | 
		
	
		
			
			| 
				
			 | 
			
				357
			 | 
			
			
				+           ;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				358
			 | 
			
			
				+    esac 
			 | 
		
	
		
			
			| 
				
			 | 
			
				359
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				360
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				361
			 | 
			
			
				+function configure_interactive_icecast { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				362
			 | 
			
			
				+    while true 
			 | 
		
	
		
			
			| 
				
			 | 
			
				363
			 | 
			
			
				+    do 
			 | 
		
	
		
			
			| 
				
			 | 
			
				364
			 | 
			
			
				+        data=$(tempfile 2>/dev/null) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				365
			 | 
			
			
				+        trap "rm -f $data" 0 1 2 5 15 
			 | 
		
	
		
			
			| 
				
			 | 
			
				366
			 | 
			
			
				+        dialog --backtitle $"Freedombone Control Panel" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				367
			 | 
			
			
				+               --title $"Icecast" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				368
			 | 
			
			
				+               --radiolist $"Choose an operation:" 15 70 8 \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				369
			 | 
			
			
				+               1 $"Import stream files from directory" off \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				370
			 | 
			
			
				+               2 $"Import stream files from USB drive" off \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				371
			 | 
			
			
				+               3 $"Manually edit playlist" off \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				372
			 | 
			
			
				+               4 $"Export stream files to USB drive" off \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				373
			 | 
			
			
				+               5 $"Format a USB drive for stream file storage" off \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				374
			 | 
			
			
				+               6 $"Enable login for stream visitors" off \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				375
			 | 
			
			
				+               7 $"Change password for stream visitors" off \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				376
			 | 
			
			
				+               8 $"Exit" on 2> $data 
			 | 
		
	
		
			
			| 
				
			 | 
			
				377
			 | 
			
			
				+        sel=$? 
			 | 
		
	
		
			
			| 
				
			 | 
			
				378
			 | 
			
			
				+        case $sel in 
			 | 
		
	
		
			
			| 
				
			 | 
			
				379
			 | 
			
			
				+            1) break;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				380
			 | 
			
			
				+            255) break;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				381
			 | 
			
			
				+        esac 
			 | 
		
	
		
			
			| 
				
			 | 
			
				382
			 | 
			
			
				+        case $(cat $data) in 
			 | 
		
	
		
			
			| 
				
			 | 
			
				383
			 | 
			
			
				+            1) icecast_import_from_directory;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				384
			 | 
			
			
				+            2) icecast_import_from_usb;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				385
			 | 
			
			
				+            3) icecast_edit_playlist;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				386
			 | 
			
			
				+            4) icecast_export_to_usb;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				387
			 | 
			
			
				+            5) icecast_format_drive;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				388
			 | 
			
			
				+            6) icecast_enable_login;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				389
			 | 
			
			
				+            7) icecast_change_login;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				390
			 | 
			
			
				+            8) break;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				391
			 | 
			
			
				+        esac 
			 | 
		
	
		
			
			| 
				
			 | 
			
				392
			 | 
			
			
				+    done 
			 | 
		
	
		
			
			| 
				
			 | 
			
				393
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				394
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				395
			 | 
			
			
				+function upgrade_icecast { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				396
			 | 
			
			
				+    icecast_update_daemon 
			 | 
		
	
		
			
			| 
				
			 | 
			
				397
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				398
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				399
			 | 
			
			
				+function backup_local_icecast { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				400
			 | 
			
			
				+    if [ ! -d $ICECAST_DIR ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				401
			 | 
			
			
				+        return 
			 | 
		
	
		
			
			| 
				
			 | 
			
				402
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				403
			 | 
			
			
				+    systemctl stop icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				404
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				405
			 | 
			
			
				+    cp /etc/nginx/.icepasswd $ICECAST_DIR 
			 | 
		
	
		
			
			| 
				
			 | 
			
				406
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				407
			 | 
			
			
				+    function_check backup_directory_to_usb 
			 | 
		
	
		
			
			| 
				
			 | 
			
				408
			 | 
			
			
				+    backup_directory_to_usb $ICECAST_DIR icecast 
			 | 
		
	
		
			
			| 
				
			 | 
			
				409
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				410
			 | 
			
			
				+    rm $ICECAST_DIR/.icepasswd 
			 | 
		
	
		
			
			| 
				
			 | 
			
				411
			 | 
			
			
				+    systemctl start icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				412
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				413
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				414
			 | 
			
			
				+function restore_local_icecast { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				415
			 | 
			
			
				+    if [ ! -d $ICECAST_DIR ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				416
			 | 
			
			
				+        return 
			 | 
		
	
		
			
			| 
				
			 | 
			
				417
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				418
			 | 
			
			
				+    systemctl stop icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				419
			 | 
			
			
				+    temp_restore_dir=/root/tempicecast 
			 | 
		
	
		
			
			| 
				
			 | 
			
				420
			 | 
			
			
				+    function_check restore_directory_from_usb 
			 | 
		
	
		
			
			| 
				
			 | 
			
				421
			 | 
			
			
				+    restore_directory_from_usb $temp_restore_dir icecast 
			 | 
		
	
		
			
			| 
				
			 | 
			
				422
			 | 
			
			
				+    if [ -d $temp_restore_dir$ICECAST_DIR ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				423
			 | 
			
			
				+        cp -r $temp_restore_dir$ICECAST_DIR $ICECAST_DIR/ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				424
			 | 
			
			
				+    else 
			 | 
		
	
		
			
			| 
				
			 | 
			
				425
			 | 
			
			
				+        cp -r $temp_restore_dir/* $ICECAST_DIR/* 
			 | 
		
	
		
			
			| 
				
			 | 
			
				426
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				427
			 | 
			
			
				+    cp $ICECAST_DIR/.icepasswd /etc/nginx/.icepasswd 
			 | 
		
	
		
			
			| 
				
			 | 
			
				428
			 | 
			
			
				+    rm $ICECAST_DIR/.icepasswd 
			 | 
		
	
		
			
			| 
				
			 | 
			
				429
			 | 
			
			
				+    chown -R icecast2:icecast2 $ICECAST_DIR 
			 | 
		
	
		
			
			| 
				
			 | 
			
				430
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				431
			 | 
			
			
				+    systemctl start icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				432
			 | 
			
			
				+    rm -rf $temp_restore_dir 
			 | 
		
	
		
			
			| 
				
			 | 
			
				433
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				434
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				435
			 | 
			
			
				+function backup_remote_icecast { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				436
			 | 
			
			
				+    if [ ! -d $ICECAST_DIR ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				437
			 | 
			
			
				+        return 
			 | 
		
	
		
			
			| 
				
			 | 
			
				438
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				439
			 | 
			
			
				+    systemctl stop icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				440
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				441
			 | 
			
			
				+    cp /etc/nginx/.icepasswd $ICECAST_DIR 
			 | 
		
	
		
			
			| 
				
			 | 
			
				442
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				443
			 | 
			
			
				+    function_check backup_directory_to_friend 
			 | 
		
	
		
			
			| 
				
			 | 
			
				444
			 | 
			
			
				+    backup_directory_to_friend $ICECAST_DIR icecast 
			 | 
		
	
		
			
			| 
				
			 | 
			
				445
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				446
			 | 
			
			
				+    rm $ICECAST_DIR/.icepasswd 
			 | 
		
	
		
			
			| 
				
			 | 
			
				447
			 | 
			
			
				+    systemctl start icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				448
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				449
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				450
			 | 
			
			
				+function restore_remote_icecast { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				451
			 | 
			
			
				+    if [ ! -d $ICECAST_DIR ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				452
			 | 
			
			
				+        return 
			 | 
		
	
		
			
			| 
				
			 | 
			
				453
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				454
			 | 
			
			
				+    systemctl stop icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				455
			 | 
			
			
				+    temp_restore_dir=/root/tempicecast 
			 | 
		
	
		
			
			| 
				
			 | 
			
				456
			 | 
			
			
				+    function_check restore_directory_from_friend 
			 | 
		
	
		
			
			| 
				
			 | 
			
				457
			 | 
			
			
				+    restore_directory_from_friend $temp_restore_dir icecast 
			 | 
		
	
		
			
			| 
				
			 | 
			
				458
			 | 
			
			
				+    if [ -d $temp_restore_dir$ICECAST_DIR ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				459
			 | 
			
			
				+        cp -r $temp_restore_dir$ICECAST_DIR $ICECAST_DIR/ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				460
			 | 
			
			
				+    else 
			 | 
		
	
		
			
			| 
				
			 | 
			
				461
			 | 
			
			
				+        cp -r $temp_restore_dir/* $ICECAST_DIR/* 
			 | 
		
	
		
			
			| 
				
			 | 
			
				462
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				463
			 | 
			
			
				+    cp $ICECAST_DIR/.icepasswd /etc/nginx/.icepasswd 
			 | 
		
	
		
			
			| 
				
			 | 
			
				464
			 | 
			
			
				+    rm $ICECAST_DIR/.icepasswd 
			 | 
		
	
		
			
			| 
				
			 | 
			
				465
			 | 
			
			
				+    chown -R icecast2:icecast2 $ICECAST_DIR 
			 | 
		
	
		
			
			| 
				
			 | 
			
				466
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				467
			 | 
			
			
				+    systemctl start icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				468
			 | 
			
			
				+    rm -rf $temp_restore_dir 
			 | 
		
	
		
			
			| 
				
			 | 
			
				469
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				470
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				471
			 | 
			
			
				+function remove_icecast { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				472
			 | 
			
			
				+    nginx_dissite icecast 
			 | 
		
	
		
			
			| 
				
			 | 
			
				473
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				474
			 | 
			
			
				+    if [ -f /etc/nginx/sites-available/icecast ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				475
			 | 
			
			
				+        rm /etc/nginx/sites-available/icecast 
			 | 
		
	
		
			
			| 
				
			 | 
			
				476
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				477
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				478
			 | 
			
			
				+    if [ -d /var/www/icecast ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				479
			 | 
			
			
				+        rm -rf /var/www/icecast 
			 | 
		
	
		
			
			| 
				
			 | 
			
				480
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				481
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				482
			 | 
			
			
				+    apt-get -yq remove --purge icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				483
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				484
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				485
			 | 
			
			
				+function install_icecast { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				486
			 | 
			
			
				+    apt-get -yq install software-properties-common debconf-utils 
			 | 
		
	
		
			
			| 
				
			 | 
			
				487
			 | 
			
			
				+    apt-get -yq update 
			 | 
		
	
		
			
			| 
				
			 | 
			
				488
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				489
			 | 
			
			
				+    debconf-set-selections <<< "icecast2 icecast2/icecast-setup boolean false" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				490
			 | 
			
			
				+    apt-get -yq install icecast2 ices2 ffmpeg apache2-utils 
			 | 
		
	
		
			
			| 
				
			 | 
			
				491
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				492
			 | 
			
			
				+    if [ ! -f /etc/icecast2/icecast.xml ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				493
			 | 
			
			
				+        echo $'Icecast not installed' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				494
			 | 
			
			
				+        exit 7923528 
			 | 
		
	
		
			
			| 
				
			 | 
			
				495
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				496
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				497
			 | 
			
			
				+    if [ ! ${ICECAST_PASSWORD} ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				498
			 | 
			
			
				+        if [ -f ${IMAGE_PASSWORD_FILE} ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				499
			 | 
			
			
				+            ICECAST_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				500
			 | 
			
			
				+        else 
			 | 
		
	
		
			
			| 
				
			 | 
			
				501
			 | 
			
			
				+            ICECAST_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				502
			 | 
			
			
				+        fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				503
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				504
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				505
			 | 
			
			
				+    ICECAST_ONION_HOSTNAME=$(add_onion_service icecast ${ICECAST_PORT} ${ICECAST_ONION_PORT}) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				506
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				507
			 | 
			
			
				+    sed -i  -e "s|<source-password>[^<]*</source-password>|<source-password>$ICECAST_PASSWORD</source-password>|" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				508
			 | 
			
			
				+        -e "s|<relay-password>[^<]*</relay-password>|<relay-password>$ICECAST_PASSWORD</relay-password>|" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				509
			 | 
			
			
				+        -e "s|<admin-password>[^<]*</admin-password>|<admin-password>$ICECAST_PASSWORD</admin-password>|" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				510
			 | 
			
			
				+        -e "s|<hostname>[^<]*</hostname>|<hostname>$ICECAST_ONION_HOSTNAME</hostname>|" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				511
			 | 
			
			
				+        /etc/icecast2/icecast.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				512
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				513
			 | 
			
			
				+    sed -i "s|<port>.*|<port>$ICECAST_PORT</port>|g" /etc/icecast2/icecast.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				514
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				515
			 | 
			
			
				+    if [ ! -d /var/www/icecast/htdocs ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				516
			 | 
			
			
				+        mkdir -p /var/www/icecast/htdocs 
			 | 
		
	
		
			
			| 
				
			 | 
			
				517
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				518
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				519
			 | 
			
			
				+    icecast_nginx_site=/etc/nginx/sites-available/icecast 
			 | 
		
	
		
			
			| 
				
			 | 
			
				520
			 | 
			
			
				+    echo 'server {' > $icecast_nginx_site 
			 | 
		
	
		
			
			| 
				
			 | 
			
				521
			 | 
			
			
				+    echo "    listen 127.0.0.1:$ICECAST_ONION_PORT default_server;" >> $icecast_nginx_site 
			 | 
		
	
		
			
			| 
				
			 | 
			
				522
			 | 
			
			
				+    echo "    server_name $ICECAST_ONION_HOSTNAME;" >> $icecast_nginx_site 
			 | 
		
	
		
			
			| 
				
			 | 
			
				523
			 | 
			
			
				+    echo '' >> $icecast_nginx_site 
			 | 
		
	
		
			
			| 
				
			 | 
			
				524
			 | 
			
			
				+    echo '  # Logs' >> $icecast_nginx_site 
			 | 
		
	
		
			
			| 
				
			 | 
			
				525
			 | 
			
			
				+    echo '  access_log /dev/null;' >> $icecast_nginx_site 
			 | 
		
	
		
			
			| 
				
			 | 
			
				526
			 | 
			
			
				+    echo '  error_log /dev/null;' >> $icecast_nginx_site 
			 | 
		
	
		
			
			| 
				
			 | 
			
				527
			 | 
			
			
				+    echo '' >> $icecast_nginx_site 
			 | 
		
	
		
			
			| 
				
			 | 
			
				528
			 | 
			
			
				+    echo '  location / {' >> $icecast_nginx_site 
			 | 
		
	
		
			
			| 
				
			 | 
			
				529
			 | 
			
			
				+    function_check nginx_limits 
			 | 
		
	
		
			
			| 
				
			 | 
			
				530
			 | 
			
			
				+    nginx_limits $ICECAST_ONION_HOSTNAME '15m' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				531
			 | 
			
			
				+    echo "      proxy_pass http://localhost:$ICECAST_PORT;" >> $icecast_nginx_site 
			 | 
		
	
		
			
			| 
				
			 | 
			
				532
			 | 
			
			
				+    echo "      #auth_basic \"${ICECAST_LOGIN_TEXT}\";" >> $icecast_nginx_site 
			 | 
		
	
		
			
			| 
				
			 | 
			
				533
			 | 
			
			
				+    echo '      #auth_basic_user_file /etc/nginx/.icepasswd;' >> $icecast_nginx_site 
			 | 
		
	
		
			
			| 
				
			 | 
			
				534
			 | 
			
			
				+    echo '  }' >> $icecast_nginx_site 
			 | 
		
	
		
			
			| 
				
			 | 
			
				535
			 | 
			
			
				+    echo '}' >> $icecast_nginx_site 
			 | 
		
	
		
			
			| 
				
			 | 
			
				536
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				537
			 | 
			
			
				+    if [ ! -d /var/log/ices ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				538
			 | 
			
			
				+        mkdir -p /var/log/ices 
			 | 
		
	
		
			
			| 
				
			 | 
			
				539
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				540
			 | 
			
			
				+    if [ ! -d /etc/ices2 ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				541
			 | 
			
			
				+        mkdir -p /etc/ices2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				542
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				543
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				544
			 | 
			
			
				+    echo '<?xml version="1.0"?>' > /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				545
			 | 
			
			
				+    echo '<ices>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				546
			 | 
			
			
				+    echo '    <!-- run in background -->' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				547
			 | 
			
			
				+    echo '    <background>1</background>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				548
			 | 
			
			
				+    echo '    <!-- where logs, etc go. -->' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				549
			 | 
			
			
				+    echo '    <logpath>/var/log/ices</logpath>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				550
			 | 
			
			
				+    echo '    <logfile>ices.log</logfile>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				551
			 | 
			
			
				+    echo '    <!-- 1=error,2=warn,3=info,4=debug -->' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				552
			 | 
			
			
				+    echo '    <loglevel>1</loglevel>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				553
			 | 
			
			
				+    echo '    <!-- set this to 1 to log to the console instead of to the file above -->' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				554
			 | 
			
			
				+    echo '    <consolelog>0</consolelog>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				555
			 | 
			
			
				+    echo '' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				556
			 | 
			
			
				+    echo '    <!-- optional filename to write process id to -->' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				557
			 | 
			
			
				+    echo '    <!-- <pidfile>/home/ices/ices.pid</pidfile> -->' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				558
			 | 
			
			
				+    echo '' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				559
			 | 
			
			
				+    echo '    <stream>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				560
			 | 
			
			
				+    echo '        <!-- metadata used for stream listing (not currently used) -->' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				561
			 | 
			
			
				+    echo '        <metadata>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				562
			 | 
			
			
				+    echo '            <name>Example stream name</name>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				563
			 | 
			
			
				+    echo '            <genre>Example genre</genre>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				564
			 | 
			
			
				+    echo '            <description>A short description of your stream</description>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				565
			 | 
			
			
				+    echo '        </metadata>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				566
			 | 
			
			
				+    echo '' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				567
			 | 
			
			
				+    echo '        <!-- input module' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				568
			 | 
			
			
				+    echo '' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				569
			 | 
			
			
				+    echo '            The module used here is the playlist module - it has ' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				570
			 | 
			
			
				+    echo '            "submodules" for different types of playlist. There are' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				571
			 | 
			
			
				+    echo '            two currently implemented, "basic", which is a simple' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				572
			 | 
			
			
				+    echo '            file-based playlist, and "script" which invokes a command' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				573
			 | 
			
			
				+    echo '            to returns a filename to start playing. -->' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				574
			 | 
			
			
				+    echo '' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				575
			 | 
			
			
				+    echo '        <input>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				576
			 | 
			
			
				+    echo '            <module>playlist</module>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				577
			 | 
			
			
				+    echo '            <param name="type">basic</param>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				578
			 | 
			
			
				+    echo '            <param name="file">playlist.txt</param>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				579
			 | 
			
			
				+    echo '            <!-- random play -->' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				580
			 | 
			
			
				+    echo '            <param name="random">0</param>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				581
			 | 
			
			
				+    echo '            <!-- if the playlist get updated that start at the beginning -->' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				582
			 | 
			
			
				+    echo '            <param name="restart-after-reread">0</param>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				583
			 | 
			
			
				+    echo '            <!-- if set to 1 , plays once through, then exits. -->' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				584
			 | 
			
			
				+    echo '            <param name="once">0</param>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				585
			 | 
			
			
				+    echo '        </input>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				586
			 | 
			
			
				+    echo '' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				587
			 | 
			
			
				+    echo '            <!-- Stream instance' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				588
			 | 
			
			
				+    echo '            You may have one or more instances here. This allows you to ' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				589
			 | 
			
			
				+    echo '            send the same input data to one or more servers (or to different' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				590
			 | 
			
			
				+    echo '            mountpoints on the same server). Each of them can have different' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				591
			 | 
			
			
				+    echo '            parameters. This is primarily useful for a) relaying to multiple' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				592
			 | 
			
			
				+    echo '            independent servers, and b) encoding/reencoding to multiple' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				593
			 | 
			
			
				+    echo '            bitrates.' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				594
			 | 
			
			
				+    echo '            If one instance fails (for example, the associated server goes' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				595
			 | 
			
			
				+    echo '            down, etc), the others will continue to function correctly.' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				596
			 | 
			
			
				+    echo '            This example defines two instances as two mountpoints on the' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				597
			 | 
			
			
				+    echo '            same server.  -->' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				598
			 | 
			
			
				+    echo '        <instance>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				599
			 | 
			
			
				+    echo '            <!-- Server details:' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				600
			 | 
			
			
				+    echo '                You define hostname and port for the server here, along with' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				601
			 | 
			
			
				+    echo '                the source password and mountpoint.  -->' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				602
			 | 
			
			
				+    echo '            <hostname>localhost</hostname>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				603
			 | 
			
			
				+    echo "            <port>$ICECAST_PORT</port>" >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				604
			 | 
			
			
				+    echo "            <password>$ICECAST_PASSWORD</password>" >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				605
			 | 
			
			
				+    echo '            <mount>/example1.ogg</mount>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				606
			 | 
			
			
				+    echo '            <!-- Reconnect parameters:' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				607
			 | 
			
			
				+    echo '                When something goes wrong (e.g. the server crashes, or the' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				608
			 | 
			
			
				+    echo '                network drops) and ices disconnects from the server, these' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				609
			 | 
			
			
				+    echo '                control how often it tries to reconnect, and how many times' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				610
			 | 
			
			
				+    echo '                it tries to reconnect. Delay is in seconds.' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				611
			 | 
			
			
				+    echo '                If you set reconnectattempts to -1, it will continue ' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				612
			 | 
			
			
				+    echo '                indefinately. Suggest setting reconnectdelay to a large value' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				613
			 | 
			
			
				+    echo '                if you do this.' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				614
			 | 
			
			
				+    echo '            -->' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				615
			 | 
			
			
				+    echo '            <reconnectdelay>2</reconnectdelay>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				616
			 | 
			
			
				+    echo '            <reconnectattempts>5</reconnectattempts> ' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				617
			 | 
			
			
				+    echo '' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				618
			 | 
			
			
				+    echo '            <!-- maxqueuelength:' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				619
			 | 
			
			
				+    echo '                This describes how long the internal data queues may be. This' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				620
			 | 
			
			
				+    echo '                basically lets you control how much data gets buffered before' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				621
			 | 
			
			
				+    echo '                ices decides it cant send to the server fast enough, and ' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				622
			 | 
			
			
				+    echo '                either shuts down or flushes the queue (dropping the data)' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				623
			 | 
			
			
				+    echo '                and continues. ' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				624
			 | 
			
			
				+    echo '                For advanced users only.' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				625
			 | 
			
			
				+    echo '            -->' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				626
			 | 
			
			
				+    echo '            <maxqueuelength>80</maxqueuelength>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				627
			 | 
			
			
				+    echo '' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				628
			 | 
			
			
				+    echo '            <!-- Live encoding/reencoding:' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				629
			 | 
			
			
				+    echo '                Currrently, the parameters given here for encoding MUST' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				630
			 | 
			
			
				+    echo '                match the input data for channels and sample rate. That ' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				631
			 | 
			
			
				+    echo '                restriction will be relaxed in the future.' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				632
			 | 
			
			
				+    echo '                Remove this section if you dont want your files getting reencoded.' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				633
			 | 
			
			
				+    echo '            -->' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				634
			 | 
			
			
				+    echo '            <encode>  ' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				635
			 | 
			
			
				+    echo '                <nominal-bitrate>64000</nominal-bitrate> <!-- bps. e.g. 64000 for 64 kbps -->' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				636
			 | 
			
			
				+    echo '                <samplerate>44100</samplerate>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				637
			 | 
			
			
				+    echo '                <channels>2</channels>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				638
			 | 
			
			
				+    echo '            </encode>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				639
			 | 
			
			
				+    echo '        </instance>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				640
			 | 
			
			
				+    echo '' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				641
			 | 
			
			
				+    echo '        </stream>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				642
			 | 
			
			
				+    echo '</ices>' >> /etc/ices2/ices-playlist.xml 
			 | 
		
	
		
			
			| 
				
			 | 
			
				643
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				644
			 | 
			
			
				+    sed -i 's|ENABLE=.*|ENABLE=true|g' /etc/default/icecast2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				645
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				646
			 | 
			
			
				+    if [ ! -d $ICECAST_DIR ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				647
			 | 
			
			
				+        mkdir $ICECAST_DIR 
			 | 
		
	
		
			
			| 
				
			 | 
			
				648
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				649
			 | 
			
			
				+    chown -R icecast2:icecast2 $ICECAST_DIR 
			 | 
		
	
		
			
			| 
				
			 | 
			
				650
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				651
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				652
			 | 
			
			
				+    # create a password for users 
			 | 
		
	
		
			
			| 
				
			 | 
			
				653
			 | 
			
			
				+    ICECAST_USER_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				654
			 | 
			
			
				+    if grep -q "$MY_USERNAME:" /etc/nginx/.icepasswd; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				655
			 | 
			
			
				+        sed -i "/$MY_USERNAME:/d" /etc/nginx/.icepasswd 
			 | 
		
	
		
			
			| 
				
			 | 
			
				656
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				657
			 | 
			
			
				+    echo "$ICECAST_USER_PASSWORD" | htpasswd -i -s -c /etc/nginx/.icepasswd $MY_USERNAME 
			 | 
		
	
		
			
			| 
				
			 | 
			
				658
			 | 
			
			
				+    if [ ! -f /etc/nginx/.icepasswd ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				659
			 | 
			
			
				+        echo $'/etc/nginx/.icepasswd not found' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				660
			 | 
			
			
				+        exit 73528235 
			 | 
		
	
		
			
			| 
				
			 | 
			
				661
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				662
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				663
			 | 
			
			
				+    ${PROJECT_NAME}-pass -u $MY_USERNAME -a icecast -p "$ICECAST_PASSWORD" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				664
			 | 
			
			
				+    ${PROJECT_NAME}-pass -u $MY_USERNAME -a icecastuser -p "$ICECAST_USER_PASSWORD" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				665
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				666
			 | 
			
			
				+    icecast_update_daemon 
			 | 
		
	
		
			
			| 
				
			 | 
			
				667
			 | 
			
			
				+    nginx_ensite icecast 
			 | 
		
	
		
			
			| 
				
			 | 
			
				668
			 | 
			
			
				+    systemctl restart nginx 
			 | 
		
	
		
			
			| 
				
			 | 
			
				669
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				670
			 | 
			
			
				+    APP_INSTALLED=1 
			 | 
		
	
		
			
			| 
				
			 | 
			
				671
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				672
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				673
			 | 
			
			
				+function install_interactive_icecast { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				674
			 | 
			
			
				+    install_icecast 
			 | 
		
	
		
			
			| 
				
			 | 
			
				675
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				676
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				677
			 | 
			
			
				+# NOTE: deliberately no exit 0 
			 |