2
0
mirror of https://github.com/spritsail/plex-media-server.git synced 2024-12-20 11:34:36 +00:00
plex-media-server/gen-config.sh

37 lines
1.4 KiB
Bash
Raw Normal View History

2018-08-19 19:27:47 +00:00
#!/bin/sh
set -e
2018-10-04 11:48:52 +00:00
# Contains getPref/setPref and PREF_FILE vars
. plex-util.sh
2018-08-19 19:27:47 +00:00
# Create a default config file allowing external access
printf "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Preferences />" > "${PREF_FILE}"
2018-08-19 19:27:47 +00:00
# Enforced defaults. These can be changed manually afterwards.
2019-02-07 22:51:44 +00:00
setPref "EnableIPv6" "1"
2018-08-19 19:27:47 +00:00
setPref "AcceptedEULA" "1"
setPref "TranscoderTempDirectory" "/transcode"
# The following below is ripped directly from the official (inferior) Plex container:
# https://github.com/plexinc/pms-docker/blob/155f00c71b50f94c73ffea0aae16cc61ef957df7/root/etc/cont-init.d/40-plex-first-run
# Setup Server's client identifier
serial="$(getPref "MachineIdentifier")"
if [ -z "${serial}" ]; then
serial="$(cat /proc/sys/kernel/random/uuid)"
setPref "MachineIdentifier" "${serial}"
fi
clientId="$(getPref "ProcessedMachineIdentifier")"
if [ -z "${clientId}" ]; then
clientId="$(printf %s "${serial}- Plex Media Server" | sha1sum | cut -b 1-40)"
2018-08-19 19:27:47 +00:00
setPref "ProcessedMachineIdentifier" "${clientId}"
fi
2018-10-04 11:48:52 +00:00
# Claiming the PlexOnlineToken is now done in entrypoint on every boot
# It can also be triggered manually at any time by running
# $ claim-server.sh --load-client-id --save
2018-08-19 19:27:47 +00:00
if [ -n "${ADVERTISE_IP}" ]; then setPref "customConnections" "${ADVERTISE_IP}"; fi
if [ -n "${ALLOWED_NETWORKS}" ]; then setPref "allowedNetworks" "${ALLOWED_NETWORKS}"; fi
if [ -n "${DISABLE_REMOTE_SEC}" ]; then setPref "disableRemoteSecurity" "1"; fi