2
0
mirror of https://github.com/spritsail/plex-media-server.git synced 2024-12-20 11:34:36 +00:00
plex-media-server/plex-util.sh
Joe Groocock 4579290641
Build multiarch amd64/arm64 Plex images
Signed-off-by: Adam Dodman <adam@adam-ant.co.uk>
Signed-off-by: Joe Groocock <me@frebib.net>
2022-06-19 15:03:35 +00:00

15 lines
529 B
Bash

CONFIG_DIR="${CONFIG_DIR:-/config}"
PREF_FILE="${PREF_FILE:-"$CONFIG_DIR/Preferences.xml"}"
getPref() {
xmlstarlet sel -T -t -m "/Preferences" -v "@$1" -n "${PREF_FILE}"
}
setPref() {
count="$(xmlstarlet sel -t -v "count(/Preferences/@$1)" "${PREF_FILE}")"
if [ $((count + 0)) -gt 0 ]; then
xmlstarlet ed --inplace --update "/Preferences/@$1" -v "$2" "${PREF_FILE}" 2>/dev/null
else
xmlstarlet ed --inplace --insert "/Preferences" --type attr -n "$1" -v "$2" "${PREF_FILE}" 2>/dev/null
fi
}