From f2ab5b33ff8a122e0f6db09f3f799eec5aa322e0 Mon Sep 17 00:00:00 2001 From: Pierre beucher Date: Sat, 11 May 2024 14:13:48 +0200 Subject: [PATCH 1/3] fix: MacOS install script OS name --- install.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 666db81..f23afdc 100755 --- a/install.sh +++ b/install.sh @@ -107,6 +107,19 @@ fi # Detect OS and Architecture OS=$(uname | tr '[:upper:]' '[:lower:]') +case $OS in + darwin) + OS_RELEASE="macos" + ;; + linux) + OS_RELEASE="linux" + ;; + *) + echo "Unsupported OS: $OS" + exit 1 + ;; +esac + ARCH=$(uname -m) case $ARCH in x86_64) @@ -125,7 +138,7 @@ case $ARCH in esac # Define installation directory and zip file -RELEASE_FILE_PREFIX="novops_${OS}_${ARCH}" +RELEASE_FILE_PREFIX="novops_${OS_RELEASE}_${ARCH}" ZIP_NAME="${RELEASE_FILE_PREFIX}.zip" ZIP_PATH="${TMP_INSTALL_DIR}/${ZIP_NAME}" @@ -156,12 +169,14 @@ else exit 1 fi -echo "Copying to ${INSTALL_DIR}..." - # Only need sudo to copy to install dir if [ "$(id -u)" -eq 0 ]; then + echo "Copying to ${INSTALL_DIR}..." + mkdir -p $INSTALL_DIR mv "${NOVOPS_BIN_TMP_PATH}" "${INSTALL_DIR}" else + echo "Copying to ${INSTALL_DIR}... (you may be prompted for sudo password)" + sudo mkdir -p $INSTALL_DIR sudo mv "${NOVOPS_BIN_TMP_PATH}" "${INSTALL_DIR}" fi From 4829bba3999b9535cc731e2f724f89a4769bea46 Mon Sep 17 00:00:00 2001 From: Pierre beucher Date: Sat, 11 May 2024 15:43:16 +0200 Subject: [PATCH 2/3] doc: getting started use install.sh --- docs/src/getting-started.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/src/getting-started.md b/docs/src/getting-started.md index d7f1c44..4d51d83 100644 --- a/docs/src/getting-started.md +++ b/docs/src/getting-started.md @@ -19,9 +19,7 @@ ## Install ```sh -curl -L "https://github.com/PierreBeucher/novops/releases/latest/download/novops-X64-Linux.zip" -o novops.zip -unzip novops.zip -sudo mv novops /usr/local/bin/novops +sh -c "$(curl --location https://raw.githubusercontent.com/PierreBeucher/novops/main/install.sh)" ``` See [installation](install.md) for more installation methods. From 911127fa746a926f0a55e66c9182fad69a6d9bd2 Mon Sep 17 00:00:00 2001 From: Pierre beucher Date: Sat, 11 May 2024 15:45:36 +0200 Subject: [PATCH 3/3] chore: more portable install script with shellcheck --- flake.nix | 1 + install.sh | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index bf3d4cc..2937257 100644 --- a/flake.nix +++ b/flake.nix @@ -62,6 +62,7 @@ cachix python311 python311Packages.pip + shellcheck # Module testing podman diff --git a/install.sh b/install.sh index f23afdc..1a1e1bd 100755 --- a/install.sh +++ b/install.sh @@ -153,7 +153,7 @@ CHECKSUM_URL="https://github.com/PierreBeucher/novops/releases/latest/download/$ echo "Downloading Novops release..." -mkdir -p $TMP_INSTALL_DIR +mkdir -p "$TMP_INSTALL_DIR" curl -s -L "${ZIP_URL}" -o "${ZIP_PATH}" curl -s -L "${CHECKSUM_URL}" -o "${CHECKSUM_PATH}" @@ -172,11 +172,11 @@ fi # Only need sudo to copy to install dir if [ "$(id -u)" -eq 0 ]; then echo "Copying to ${INSTALL_DIR}..." - mkdir -p $INSTALL_DIR + mkdir -p "$INSTALL_DIR" mv "${NOVOPS_BIN_TMP_PATH}" "${INSTALL_DIR}" else echo "Copying to ${INSTALL_DIR}... (you may be prompted for sudo password)" - sudo mkdir -p $INSTALL_DIR + sudo mkdir -p "$INSTALL_DIR" sudo mv "${NOVOPS_BIN_TMP_PATH}" "${INSTALL_DIR}" fi