test
This commit is contained in:
@@ -68,19 +68,19 @@ in {
|
||||
envFile = config.sops.secrets."CUSTOM".path;
|
||||
script = pkgs.writeShellScript "setup" ''
|
||||
JELLYFIN_URL="http://jellyfin-server:8096"
|
||||
until ${pkgs.curl} -sf "\${JELLYFIN_URL}/health" > /dev/null 2>&1; do
|
||||
until ${pkgs.curl} -sf "$JELLYFIN_URL/health" > /dev/null 2>&1; do
|
||||
sleep 5
|
||||
done
|
||||
echo "Jellyfin is up. Sleeping for 20 seconds..."
|
||||
sleep 20
|
||||
WIZARD_COMPLETE=$(${pkgs.curl}/bin/curl -sSf "\${JELLYFIN_URL}/System/Info/Public" 2>/dev/null | \
|
||||
WIZARD_COMPLETE=$(${pkgs.curl}/bin/curl -sSf "$JELLYFIN_URL/System/Info/Public" 2>/dev/null | \
|
||||
${pkgs.jq}/bin/jq -r '.StartupWizardCompleted // false')
|
||||
if [ "$WIZARD_COMPLETE" = "true" ]; then
|
||||
echo "Jellyfin wizard already completed. Exiting cleanly."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! ${pkgs.curl}/bin/curl -sSf -X POST "''\${JELLYFIN_URL}/Startup/Configuration" \
|
||||
if ! ${pkgs.curl}/bin/curl -sSf -X POST "''$JELLYFIN_URL/Startup/Configuration" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"ServerName":"jellyfin","UICulture":"en-US","MetadataCountryCode":"US","PreferredMetadataLanguage":"en"}'; then
|
||||
echo "ERROR: Failed to set startup configuration."
|
||||
@@ -92,9 +92,9 @@ in {
|
||||
--arg pass "''\${DEFAULT_ADMIN_PASSWORD}" \
|
||||
'{"Name": $name, "Password": $pass}')
|
||||
|
||||
echo "Payload to be sent to /Startup/User: ''${SETUP_USER_PAYLOAD}"
|
||||
echo "Payload to be sent to /Startup/User: ''$SETUP_USER_PAYLOAD"
|
||||
|
||||
if ! ${pkgs.curl}/bin/curl -sSf -X POST "''${JELLYFIN_URL}/Startup/User" \
|
||||
if ! ${pkgs.curl}/bin/curl -sSf -X POST "''$JELLYFIN_URL/Startup/User" \
|
||||
-H 'accept: */*' \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "''${SETUP_USER_PAYLOAD}"; then
|
||||
@@ -103,7 +103,7 @@ in {
|
||||
fi
|
||||
|
||||
# Enable remote access, disable UPnP auto-mapping
|
||||
if ! ${pkgs.curl}/bin/curl -sSf -X POST "''\${JELLYFIN_URL}/Startup/RemoteAccess" \
|
||||
if ! ${pkgs.curl}/bin/curl -sSf -X POST "''$JELLYFIN_URL/Startup/RemoteAccess" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"EnableRemoteAccess":true,"EnableAutomaticPortMapping":false}'; then
|
||||
echo "ERROR: Failed to configure remote access."
|
||||
@@ -111,7 +111,7 @@ in {
|
||||
fi
|
||||
|
||||
# Complete the wizard
|
||||
if ! ${pkgs.curl}/bin/curl -sSf -X POST "''\${JELLYFIN_URL}/Startup/Complete"; then
|
||||
if ! ${pkgs.curl}/bin/curl -sSf -X POST "''$JELLYFIN_URL/Startup/Complete"; then
|
||||
echo "ERROR: Failed to complete wizard."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user