Update install.sh
This commit is contained in:
parent
b47108d242
commit
d91cd26b49
24
install.sh
24
install.sh
|
@ -3,6 +3,8 @@
|
||||||
# Define plugin details
|
# Define plugin details
|
||||||
PLUGIN_URL="https://git.nixc.us/colin/SimpleOtel/raw/branch/main/simple-otel.php"
|
PLUGIN_URL="https://git.nixc.us/colin/SimpleOtel/raw/branch/main/simple-otel.php"
|
||||||
PLUGIN_DIR="./wp-content/plugins/simple-otel"
|
PLUGIN_DIR="./wp-content/plugins/simple-otel"
|
||||||
|
CONFIG_FILE="$PLUGIN_DIR/config.php"
|
||||||
|
VENDOR_URL="https://git.nixc.us/colin/SimpleOtel/raw/branch/main/vendor.zip"
|
||||||
|
|
||||||
# Create plugin directory if it doesn't exist
|
# Create plugin directory if it doesn't exist
|
||||||
mkdir -p "$PLUGIN_DIR"
|
mkdir -p "$PLUGIN_DIR"
|
||||||
|
@ -10,20 +12,28 @@ mkdir -p "$PLUGIN_DIR"
|
||||||
# Download the plugin file
|
# Download the plugin file
|
||||||
curl -o "$PLUGIN_DIR/simple-otel.php" "$PLUGIN_URL"
|
curl -o "$PLUGIN_DIR/simple-otel.php" "$PLUGIN_URL"
|
||||||
|
|
||||||
|
# Download the vendor directory zip file
|
||||||
|
curl -o "$PLUGIN_DIR/vendor.zip" "$VENDOR_URL"
|
||||||
|
|
||||||
|
# Unzip the vendor directory
|
||||||
|
unzip -o "$PLUGIN_DIR/vendor.zip" -d "$PLUGIN_DIR"
|
||||||
|
rm "$PLUGIN_DIR/vendor.zip"
|
||||||
|
|
||||||
# Create a blank config.php file if it doesn't exist
|
# Create a blank config.php file if it doesn't exist
|
||||||
if [ ! -f "$PLUGIN_DIR/config.php" ]; then
|
if [ ! -f "$CONFIG_FILE" ]; then
|
||||||
touch "$PLUGIN_DIR/config.php"
|
touch "$CONFIG_FILE"
|
||||||
echo "<?php" > "$PLUGIN_DIR/config.php"
|
echo "<?php" > "$CONFIG_FILE"
|
||||||
echo "// Configuration for Simple Otel plugin" >> "$PLUGIN_DIR/config.php"
|
echo "// Configuration for Simple Otel plugin" >> "$CONFIG_FILE"
|
||||||
echo "// Add your configurations here" >> "$PLUGIN_DIR/config.php"
|
echo "// Set default values using environment variables or fallback to manual configuration" >> "$CONFIG_FILE"
|
||||||
echo "Configuration file created at wp-content/plugins/simple-otel/config.php."
|
echo "\$otel_service_name = getenv('OTEL_SERVICE_NAME') ?: 'default-service-name';" >> "$CONFIG_FILE"
|
||||||
|
echo "\$otel_exporter_otlp_endpoint = getenv('OTEL_EXPORTER_OTLP_ENDPOINT') ?: 'http://localhost:4317';" >> "$CONFIG_FILE"
|
||||||
else
|
else
|
||||||
echo "config.php already exists."
|
echo "config.php already exists."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set correct permissions
|
# Set correct permissions
|
||||||
chmod 644 "$PLUGIN_DIR/simple-otel.php"
|
chmod 644 "$PLUGIN_DIR/simple-otel.php"
|
||||||
chmod 644 "$PLUGIN_DIR/config.php"
|
chmod 644 "$CONFIG_FILE"
|
||||||
|
|
||||||
# Inform user
|
# Inform user
|
||||||
echo "Simple Otel plugin installed/updated successfully."
|
echo "Simple Otel plugin installed/updated successfully."
|
||||||
|
|
Loading…
Reference in New Issue