diff --git a/README.md b/README.md new file mode 100644 index 0000000..ff4f111 --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +# Sitemapper Installation Guide + +Welcome to the installation guide for Sitemapper, a tool for parsing and analyzing sitemaps. + +## Installation + +Install Sitemapper by executing the following command in your terminal: + +```bash +curl -sSL https://git.nixc.us/Nixius/sitemapper/raw/branch/main/install.sh | sudo bash +``` + +This command fetches the `install.sh` script directly and runs it, handling the installation of the correct binary for your system's architecture. + +## Usage + +Once installed, you can use Sitemapper to analyze a sitemap by providing the URL of the sitemap or just the root URL of the website. Sitemapper will attempt to find the sitemap at the root of the URL if not explicitly specified. + +### Example Usage + +1. **Specify the Sitemap URL**: + ```bash + sitemapper --url=https://www.improvingmipractices.org/sitemap.xml --csv + ``` + +2. **Specify the Root URL**: + ```bash + sitemapper --url=https://www.improvingmipractices.org --csv + ``` + +In both cases, Sitemapper will fetch the sitemap, parse it, and output the results in CSV format if the `--csv` flag is provided. + +## Note + +This installation is intended as a one-off setup. No updates or maintenance will be provided. + diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..a371e4f --- /dev/null +++ b/install.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +INSTALL_DIR="/usr/local/bin" +BINARY_NAME="sitemapper" +BASE_URL="https://git.nixc.us/Nixius/sitemapper/raw/branch/main/dist" + +declare -A binaries +binaries["linux/amd64"]="sitemapper" +binaries["linux/arm64"]="sitemapper_linux_arm64" +binaries["linux/arm/v7"]="sitemapper_linux_arm" +binaries["darwin/amd64"]="sitemapper_darwin_amd64" +binaries["darwin/arm64"]="sitemapper_darwin_arm64" + +OS="$(uname -s | tr '[:upper:]' '[:lower:]')" +ARCH="$(uname -m)" + +case $ARCH in + x86_64) ARCH="amd64" ;; + arm64 | aarch64) ARCH="arm64" ;; + arm*) ARCH="arm/v7" ;; + *) echo "Unsupported architecture: $ARCH"; exit 1 ;; +esac + +KEY="${OS}/${ARCH}" + +if [[ -z "${binaries[$KEY]}" ]]; then + echo "No pre-built binary for your system architecture ($KEY)." + exit 1 +fi + +BINARY_URL="${BASE_URL}/${binaries[$KEY]}" + +echo "Downloading and installing $BINARY_NAME from $BINARY_URL..." +sudo curl -sSL "$BINARY_URL" -o "${INSTALL_DIR}/${BINARY_NAME}" + +sudo chmod +x "${INSTALL_DIR}/${BINARY_NAME}" +echo "Installed $BINARY_NAME to $INSTALL_DIR" +