21 lines
		
	
	
		
			698 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			698 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
#!/command/with-contenv bash
 | 
						|
set -euo pipefail
 | 
						|
OPTIONS_FILE=/data/options.json
 | 
						|
if [ ! -f "$OPTIONS_FILE" ]; then
 | 
						|
  echo "[cont-init] No options.json, skipping plugin install"
 | 
						|
  exit 0
 | 
						|
fi
 | 
						|
if ! jq -e '.plugins // [] | length > 0' "$OPTIONS_FILE" >/dev/null 2>&1; then
 | 
						|
  echo "[cont-init] No plugins configured, skipping"
 | 
						|
  exit 0
 | 
						|
fi
 | 
						|
echo "[cont-init] Installing plugins from options.json"
 | 
						|
jq -r '.plugins[]' "$OPTIONS_FILE" | while read -r plugin; do
 | 
						|
  echo "[cont-init] Installing plugin: $plugin"
 | 
						|
  if /usr/share/opensearch/bin/opensearch-plugin install --batch "$plugin"; then
 | 
						|
    echo "[cont-init] Installed $plugin"
 | 
						|
  else
 | 
						|
    echo "[cont-init] Failed to install $plugin (continuing)"
 | 
						|
  fi
 | 
						|
done
 |