fix: Use head/cat instead of sed for multi-line YP snippet insertion
This commit is contained in:
parent
e9d243439f
commit
09edb0a8e6
|
|
@ -14,7 +14,11 @@ sed -i "s|<hostname>localhost</hostname>|<hostname>$ICECAST_HOSTNAME</hostname>|
|
||||||
if [ "$ICECAST_ENABLE_YP" = "true" ]; then
|
if [ "$ICECAST_ENABLE_YP" = "true" ]; then
|
||||||
echo "YP directory publishing ENABLED"
|
echo "YP directory publishing ENABLED"
|
||||||
# Insert YP config before closing </icecast> tag
|
# Insert YP config before closing </icecast> tag
|
||||||
sed -i 's|</icecast>|'"$(cat /etc/icecast-yp-snippet.xml)"'\n</icecast>|' /etc/icecast.xml
|
# Use sed with a temp file to handle multi-line insertion
|
||||||
|
head -n -1 /etc/icecast.xml > /tmp/icecast-temp.xml
|
||||||
|
cat /etc/icecast-yp-snippet.xml >> /tmp/icecast-temp.xml
|
||||||
|
echo "</icecast>" >> /tmp/icecast-temp.xml
|
||||||
|
mv /tmp/icecast-temp.xml /etc/icecast.xml
|
||||||
else
|
else
|
||||||
echo "YP directory publishing DISABLED (dev mode)"
|
echo "YP directory publishing DISABLED (dev mode)"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue