MediaManager: add check for config.example.toml

This commit is contained in:
vhsdream 2025-07-27 12:42:41 -04:00
parent 2b6757fca9
commit a706d1d59d

View File

@ -67,6 +67,10 @@ fi
msg_info "Creating config and start script" msg_info "Creating config and start script"
LOCAL_IP="$(hostname -I | awk '{print $1}')" LOCAL_IP="$(hostname -I | awk '{print $1}')"
SECRET="$(openssl rand -hex 32)" SECRET="$(openssl rand -hex 32)"
config_file="config.example.toml"
if [[ ! -f /opt/mediamanager/"$config_file" ]]; then
config_file="config.toml"
fi
sed -e "s/localhost:8/$LOCAL_IP:8/g" \ sed -e "s/localhost:8/$LOCAL_IP:8/g" \
-e "s|/data/|$CONFIG_DIR|g" \ -e "s|/data/|$CONFIG_DIR|g" \
-e 's/"db"/"localhost"/' \ -e 's/"db"/"localhost"/' \
@ -76,7 +80,7 @@ sed -e "s/localhost:8/$LOCAL_IP:8/g" \
-e "/^token_secret/s/=.*/= \"$SECRET\"/" \ -e "/^token_secret/s/=.*/= \"$SECRET\"/" \
-e "s/admin@example.com/$EMAIL/" \ -e "s/admin@example.com/$EMAIL/" \
-e '/^admin_emails/s/, .*/]/' \ -e '/^admin_emails/s/, .*/]/' \
/opt/mediamanager/config.example.toml >/opt/mm_data/config.toml /opt/mediamanager/"$config_file" >/opt/mm_data/config.toml
mkdir -p "$CONFIG_DIR"/{images,tv,movies,torrents} mkdir -p "$CONFIG_DIR"/{images,tv,movies,torrents}