Skip to content

Commit

Permalink
Merge pull request #116 from PierreBeucher/fix-macos-install
Browse files Browse the repository at this point in the history
Fix macos install.sh
  • Loading branch information
PierreBeucher authored May 12, 2024
2 parents 2fd50bc + 911127f commit b7dccdf
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
4 changes: 1 addition & 3 deletions docs/src/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
cachix
python311
python311Packages.pip
shellcheck

# Module testing
podman
Expand Down
23 changes: 19 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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}"
Expand All @@ -140,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}"

Expand All @@ -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

Expand Down

0 comments on commit b7dccdf

Please sign in to comment.