|
1 | 1 | #!/bin/sh
|
2 | 2 |
|
3 |
| -xml_edit() { |
4 |
| - tag="$1" |
5 |
| - value="$2" |
6 |
| - RESULT=$(sed -e "s|<${tag}>[^<]*</${tag}>|<${tag}>${value}</${tag}>|g" /etc/icecast.xml) && |
7 |
| - echo "$RESULT" > /etc/icecast.xml |
| 3 | +edit_icecast_config() { |
| 4 | + xml-edit "$@" /etc/icecast.xml |
8 | 5 | }
|
9 | 6 |
|
10 | 7 | if [ -n "$ICECAST_SOURCE_PASSWORD" ]; then
|
11 |
| - xml_edit source-password "$ICECAST_SOURCE_PASSWORD" |
| 8 | + edit_icecast_config source-password "$ICECAST_SOURCE_PASSWORD" |
12 | 9 | fi
|
13 | 10 | if [ -n "$ICECAST_RELAY_PASSWORD" ]; then
|
14 |
| - xml_edit relay-password "$ICECAST_RELAY_PASSWORD" |
| 11 | + edit_icecast_config relay-password "$ICECAST_RELAY_PASSWORD" |
15 | 12 | fi
|
16 | 13 | if [ -n "$ICECAST_ADMIN_PASSWORD" ]; then
|
17 |
| - xml_edit admin-password "$ICECAST_ADMIN_PASSWORD" |
| 14 | + edit_icecast_config admin-password "$ICECAST_ADMIN_PASSWORD" |
18 | 15 | fi
|
19 | 16 | if [ -n "$ICECAST_ADMIN_USERNAME" ]; then
|
20 |
| - xml_edit admin-user "$ICECAST_ADMIN_USERNAME" |
| 17 | + edit_icecast_config admin-user "$ICECAST_ADMIN_USERNAME" |
21 | 18 | fi
|
22 | 19 | if [ -n "$ICECAST_ADMIN_EMAIL" ]; then
|
23 |
| - xml_edit admin "$ICECAST_ADMIN_EMAIL" |
| 20 | + edit_icecast_config admin "$ICECAST_ADMIN_EMAIL" |
24 | 21 | fi
|
25 | 22 | if [ -n "$ICECAST_LOCATION" ]; then
|
26 |
| - xml_edit location "$ICECAST_LOCATION" |
| 23 | + edit_icecast_config location "$ICECAST_LOCATION" |
27 | 24 | fi
|
28 | 25 | if [ -n "$ICECAST_HOSTNAME" ]; then
|
29 |
| - xml_edit hostname "$ICECAST_HOSTNAME" |
| 26 | + edit_icecast_config hostname "$ICECAST_HOSTNAME" |
30 | 27 | fi
|
31 | 28 | if [ -n "$ICECAST_MAX_CLIENTS" ]; then
|
32 |
| - xml_edit clients "$ICECAST_MAX_CLIENTS" |
| 29 | + edit_icecast_config clients "$ICECAST_MAX_CLIENTS" |
33 | 30 | fi
|
34 | 31 | if [ -n "$ICECAST_MAX_SOURCES" ]; then
|
35 |
| - xml_edit sources "$ICECAST_MAX_SOURCES" |
| 32 | + edit_icecast_config sources "$ICECAST_MAX_SOURCES" |
36 | 33 | fi
|
37 | 34 |
|
38 | 35 | exec "$@"
|
0 commit comments