feat: Add setup script and README for Invoice Ninja integration with CasaOS, including file downloads and verification steps

This commit is contained in:
Christopher
2024-08-11 21:10:52 -05:00
parent 782fa54d87
commit 237d52aae2
2 changed files with 95 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
# Run command
```bash
bash -c "$(wget -qLO - https://raw.githubusercontent.com/bigbeartechworld/big-bear-scripts/master/setup-invoice-ninja-for-casaos-step-1/run.sh)"
```

View File

@@ -0,0 +1,90 @@
#!/bin/bash
# Define a message for branding purposes
MESSAGE="Made by BigBearTechWorld"
# Function to print a decorative line
print_decorative_line() {
# Prints a line of dashes to the console
printf "%s\n" "------------------------------------------------------"
}
# Print the introduction message with decorations
echo
print_decorative_line
echo "Setup Invoice Ninja for CasaOS Step 1"
print_decorative_line
echo
echo "$MESSAGE"
echo
print_decorative_line
echo
echo "If this is useful, please consider supporting my work at: https://ko-fi.com/bigbeartechworld"
echo
print_decorative_line
# Define base directory for the AppData
BASE_DIR="/DATA/AppData/big-bear-invoice-ninja/data"
# Define the URLs for the files
URLS=(
"https://github.com/bigbeartechworld/big-bear-casaos/raw/master/Apps/invoice-ninja/data/init/init.sh"
"https://github.com/bigbeartechworld/big-bear-casaos/raw/master/Apps/invoice-ninja/data/nginx/invoice-ninja.conf"
"https://github.com/bigbeartechworld/big-bear-casaos/raw/master/Apps/invoice-ninja/data/php/php-cli.ini"
"https://github.com/bigbeartechworld/big-bear-casaos/raw/master/Apps/invoice-ninja/data/php/php.ini"
)
# Define the local paths where the files will be saved
PATHS=(
"$BASE_DIR/init/init.sh"
"$BASE_DIR/nginx/invoice-ninja.conf"
"$BASE_DIR/php/php-cli.ini"
"$BASE_DIR/php/php.ini"
)
# Create necessary directories
mkdir -p "$BASE_DIR/init"
mkdir -p "$BASE_DIR/nginx"
mkdir -p "$BASE_DIR/php"
mkdir -p "$BASE_DIR/public"
mkdir -p "$BASE_DIR/storage"
mkdir -p "$BASE_DIR/mysql"
# Download and place each file
for i in "${!URLS[@]}"; do
echo "Downloading ${URLS[i]}..."
if curl -L "${URLS[i]}" -o "${PATHS[i]}" --fail --silent --show-error; then
if [ -f "${PATHS[i]}" ]; then
chmod +x "${PATHS[i]}" # Make file executable
echo "Successfully saved to ${PATHS[i]}"
else
echo "Error: ${PATHS[i]} is not a file. It might be a directory."
fi
else
echo "Error downloading ${URLS[i]}"
fi
done
echo "All files have been downloaded and placed in the bind paths."
echo "Setup complete."
# Verification step
echo
print_decorative_line
echo "Verifying downloaded files:"
print_decorative_line
for path in "${PATHS[@]}"; do
if [ -f "$path" ]; then
echo "$path exists and is a file."
elif [ -d "$path" ]; then
echo "❌ Error: $path is a directory, not a file."
else
echo "❌ Error: $path does not exist."
fi
done
print_decorative_line
echo "Verification complete."
print_decorative_line