From 55312ac21b52172ea48a79817b23e4099ec0ed92 Mon Sep 17 00:00:00 2001 From: currenjin Date: Fri, 6 Dec 2024 23:34:00 +0900 Subject: [PATCH] Chore: fix install.sh --- install.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index f946c25..96d80a6 100644 --- a/install.sh +++ b/install.sh @@ -11,11 +11,20 @@ fi DOWNLOAD_URL="https://github.com/currenjin/wharf/releases/download/${LATEST_VERSION}/${BINARY_NAME}" INSTALL_DIR="/usr/local/bin" -mkdir -p "$INSTALL_DIR" -echo "♻️ Downloading wharf..." -curl -L "$DOWNLOAD_URL" -o "$INSTALL_DIR/wharf" -chmod +x "$INSTALL_DIR/wharf" +echo "⚙️ Installing wharf..." +echo "📥 Downloading latest version..." + +if [[ $EUID -ne 0 ]]; then + echo "🔒 This script needs sudo privileges to install to $INSTALL_DIR" + sudo mkdir -p "$INSTALL_DIR" + sudo curl -L "$DOWNLOAD_URL" -o "$INSTALL_DIR/wharf" + sudo chmod +x "$INSTALL_DIR/wharf" +else + mkdir -p "$INSTALL_DIR" + curl -L "$DOWNLOAD_URL" -o "$INSTALL_DIR/wharf" + chmod +x "$INSTALL_DIR/wharf" +fi echo "✅ Wharf has been installed to $INSTALL_DIR/wharf" echo "🎉 You can now use 'wharf' command from anywhere." \ No newline at end of file