From 9b3038c2271904edf4e5b9e354c562e32d4829a4 Mon Sep 17 00:00:00 2001 From: Byson94 Date: Tue, 26 Aug 2025 10:01:25 +0530 Subject: [PATCH] feat: added install.sh for easy isntall of eiipm --- CHANGELOG.md | 1 + docs/src/introduction.md | 22 ++++++++++++-- install.sh | 66 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 2 deletions(-) create mode 100755 install.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index ccf8ab5..6921438 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/). ### Added - Added commit hash based install/update for security reasons. +- `install.sh` file for easy install in Linux. ## [0.3.0] - 2025-08-22 diff --git a/docs/src/introduction.md b/docs/src/introduction.md index 5b87d75..c15a090 100644 --- a/docs/src/introduction.md +++ b/docs/src/introduction.md @@ -6,7 +6,25 @@ Eiipm is a fast and eligant package manager made in rust for [Ewwii](https://git You can install **eiipm** using the same [methods we discussed](https://ewwii-sh.github.io/ewwii/installation.html) of in Ewwii: -#### 1. From source +#### 1. From installer (fastest) + +```bash +curl -sSL https://raw.githubusercontent.com/Ewwii-sh/eiipm/main/install.sh -o install.sh +less install.sh # inspect installer code (optional) +sh install.sh # run the installer +``` + +After, after the installation, verify it works: + +```bash +eiipm --version +``` + +> The installer installs the binary to `/usr/local/bin` +> +> If eiipm doesn't work after the installation, make sure that `/usr/local/bin` is in path. + +#### 2. From source ```bash git clone https://github.com/Ewwii-sh/eiipm @@ -16,7 +34,7 @@ cargo build --release This will generate the `eiipm` binary in `target/release`. -#### 2. Using Cargo +#### 3. Using Cargo ```bash cargo install --git https://github.com/Ewwii-sh/eiipm diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..0573f83 --- /dev/null +++ b/install.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env sh +set -e + +INSTALLER_VERSION="1.0.0" + +# --- Colors --- +RED=$(printf '\033[31m') +GREEN=$(printf '\033[32m') +YELLOW=$(printf '\033[33m') +BLUE=$(printf '\033[34m') +BOLD=$(printf '\033[1m') +RESET=$(printf '\033[0m') + +# --- Banner --- +echo "${BLUE}${BOLD}" +echo "=============================================" +echo " eiipm Installer (v$INSTALLER_VERSION)" +echo "=============================================" +echo "${RESET}" + +# --- Ask OS --- +echo "${YELLOW}Which OS are you installing on?${RESET}" +echo " [1] Linux" +echo " [2] macOS" +printf "Enter choice [1/2]: " +read choice + +if [ "$choice" = "2" ]; then + echo "${RED}Sorry, macOS is not yet supported by this installer.${RESET}" + echo + echo "${YELLOW}Build from source instructions:${RESET}" + echo " 1. Install Rust (https://www.rust-lang.org/)" + echo " 2. Clone the repo:" + echo " git clone https://github.com/Ewwii-sh/eiipm.git" + echo " 3. Build:" + echo " cd eiipm && cargo build --release" + echo " 4. Move binary into PATH:" + echo " mv ./target/release/eiipm /usr/local/bin/" + exit 1 +fi + +# --- Continue for Linux --- +echo "${GREEN}Great! Proceeding with Linux installation...${RESET}" + +REPO="Ewwii-sh/eiipm" +LATEST_URL="https://github.com/$REPO/releases/latest" +DOWNLOAD_URL=$(curl -sL -o /dev/null -w '%{url_effective}' "$LATEST_URL" | sed 's/tag/download/') +BIN_NAME="eiipm" + +# Create temp dir +TMP_DIR=$(mktemp -d) +cd "$TMP_DIR" + +echo "${BLUE}Downloading latest $BIN_NAME release...${RESET}" +curl -sL "$DOWNLOAD_URL/eiipm" -o "$BIN_NAME" + +echo "${BLUE}Granting eiipm executable permission...${RESET}" +chmod +x "$BIN_NAME" + +echo "${BLUE}Installing to /usr/local/bin (requires sudo)...${RESET}" +sudo mv "$BIN_NAME" /usr/local/bin/ + +echo "" +echo "${GREEN}${BOLD}⭐✨ Installation complete! ✨⭐${RESET}" +echo "" +echo "Run '${BOLD}eiipm${RESET}' to get started."