fix: Use head/cat instead of sed for multi-line YP snippet insertion

This commit is contained in:
glenneth 2026-01-02 13:55:46 +03:00 committed by Brian O'Reilly
parent a52602afda
commit be0b622901
1 changed files with 5 additions and 1 deletions

View File

@ -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