check installed plugins
This commit is contained in:
@@ -132,26 +132,41 @@ in {
|
||||
echo "ERROR: Authentication failed."
|
||||
exit 1
|
||||
fi
|
||||
if ${pkgs.curl}/bin/curl -sSf -H "Authorization: MediaBrowser Token=\"$JELLYFIN_TOKEN\"" \
|
||||
"$JELLYFIN_URL/Plugins" | ${pkgs.grep}/bin/grep -q "958aad6637844d2ab89aa7b6fab6e25c"; then
|
||||
echo "LDAP Plugin is already installed. Skipping setup."
|
||||
else
|
||||
if ! ${pkgs.curl}/bin/curl -sSf -X POST "$JELLYFIN_URL/Packages/Installed/LDAP%20Authentication?assemblyGuid=958aad6637844d2ab89aa7b6fab6e25c" \
|
||||
-H "Authorization: MediaBrowser Token=\"$JELLYFIN_TOKEN\"" \
|
||||
-H "Content-Length: 0"; then
|
||||
echo "ERROR: LDAP Plugin Setup Failed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! ${pkgs.curl}/bin/curl -sSf -X POST "$JELLYFIN_URL/Packages/Installed/LDAP%20Authentication?assemblyGuid=958aad6637844d2ab89aa7b6fab6e25c" \
|
||||
-H "Authorization: MediaBrowser Token=\"$JELLYFIN_TOKEN\"" \
|
||||
-H "Content-Length: 0"; then
|
||||
echo "ERROR: LDAP Plugin Setup Failed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! ${pkgs.curl}/bin/curl -sSf -X POST "$JELLYFIN_URL/System/Restart" \
|
||||
-H "Authorization: MediaBrowser Token=\"$JELLYFIN_TOKEN\"" \
|
||||
-H "Content-Length: 0"; then
|
||||
echo "ERROR: Server failed to accept restart command."
|
||||
exit 1
|
||||
fi
|
||||
sleep 5
|
||||
until [ "$(${pkgs.curl}/bin/curl -sf "$JELLYFIN_URL/health")" = "Healthy" ]; do
|
||||
if ! ${pkgs.curl}/bin/curl -sSf -X POST "$JELLYFIN_URL/System/Restart" \
|
||||
-H "Authorization: MediaBrowser Token=\"$JELLYFIN_TOKEN\"" \
|
||||
-H "Content-Length: 0"; then
|
||||
echo "ERROR: Server failed to accept restart command."
|
||||
exit 1
|
||||
fi
|
||||
sleep 5
|
||||
done
|
||||
echo "Jellyfin is up. Sleeping for 20 seconds..."
|
||||
sleep 20
|
||||
until [ "$(${pkgs.curl}/bin/curl -sf "$JELLYFIN_URL/health")" = "Healthy" ]; do
|
||||
sleep 5
|
||||
done
|
||||
echo "Jellyfin is up. Sleeping for 20 seconds..."
|
||||
sleep 20
|
||||
fi
|
||||
JELLYFIN_TOKEN=$(${pkgs.curl}/bin/curl -sSf -X POST "$JELLYFIN_URL/Users/AuthenticateByName" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: MediaBrowser Client=\"Bash Script\", Device=\"Server Terminal\", DeviceId=\"script-12345\", Version=\"1.0.0\"" \
|
||||
-d "{\"Username\": \"$DEFAULT_ADMIN_USERNAME\", \"Pw\": \"$DEFAULT_ADMIN_PASSWORD\"}" \
|
||||
| ${pkgs.jq}/bin/jq -r '.AccessToken')
|
||||
|
||||
# Verify we got a token
|
||||
if [ "$JELLYFIN_TOKEN" = "null" ] || [ -z "$JELLYFIN_TOKEN" ]; then
|
||||
echo "ERROR: Authentication failed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SETUP_LDAP_PAYLOAD=$(${pkgs.jq}/bin/jq -n \
|
||||
--arg ldap_pass "$DEFAULT_LDAP_PASSWORD" \
|
||||
|
||||
Reference in New Issue
Block a user