Skip to content

Commit

Permalink
Merge pull request #75 from hmrc/BDOG-2696
Browse files Browse the repository at this point in the history
BDOG-2696 add install script
  • Loading branch information
jordanrowe authored Jul 11, 2023
2 parents 21840d4 + 54de7e4 commit 8dbbb91
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 5 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,34 @@ It's based on the the original [service-manager](https://github.com/hmrc/service
## Installing Service Manager

### Installing From Binary
The simplest way to install sm2 is by utilising the `install.sh` script. Run the following in your terminal:
```shell
bash <(curl -fksSL https://raw.githubusercontent.com/hmrc/sm2/main/install.sh)
```

If you'd prefer to carry out these steps manually, then follow these steps:

1. Run the following command in your terminal for your operating system/cpu:

**Linux Intel**
```base
```shell
curl -L -O https://github.com/hmrc/sm2/releases/download/v1.0.9/sm2-1.0.9-linux-intel.zip && unzip sm2-1.0.9-linux-intel.zip && rm sm2-1.0.9-linux-intel.zip && chmod +x sm2
```

**Linux Arm64**
```base
```shell
curl -L -O https://github.com/hmrc/sm2/releases/download/v1.0.9/sm2-1.0.9-linux-arm64.zip && unzip sm2-1.0.9-linux-arm64.zip && rm sm2-1.0.9-linux-arm64.zip && chmod +x sm2
```

**OSX/Apple (latest M1/M2 cpus)**

```base
```shell
curl -L -O https://github.com/hmrc/sm2/releases/download/v1.0.9/sm2-1.0.9-apple-arm64.zip && unzip sm2-1.0.9-apple-arm64.zip && rm sm2-1.0.9-apple-arm64.zip && chmod +x sm2
```

**OSX/Apple (older Intel cpus)**

```base
```shell
curl -L -O https://github.com/hmrc/sm2/releases/download/v1.0.9/sm2-1.0.9-apple-intel.zip && unzip sm2-1.0.9-apple-intel.zip && rm sm2-1.0.9-apple-intel.zip && chmod +x sm2
```

Expand Down
38 changes: 38 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

TARGET_OS="linux"
TARGET_ARCH="intel"
TARGET_VERSION="1.0.9"

if [[ "$(uname)" == "Darwin" ]]; then
TARGET_OS="apple"
fi

if [[ "$(uname -p)" == "arm" ]]; then
TARGET_ARCH="arm64"
fi

echo "Downloading sm2 v$TARGET_VERSION..."

cd &&
curl -s -L -O "https://github.com/hmrc/sm2/releases/download/v$TARGET_VERSION/sm2-$TARGET_VERSION-$TARGET_OS-$TARGET_ARCH.zip" &&
unzip sm2-$TARGET_VERSION-$TARGET_OS-$TARGET_ARCH.zip && rm sm2-$TARGET_VERSION-$TARGET_OS-$TARGET_ARCH.zip &&
chmod +x sm2

echo "Moving sm2 to /usr/local/bin..."

sudo mv ~/sm2 /usr/local/bin/sm2

echo "Successfully installed!"

sm2 --version

echo "Running sm2 --update..."

sm2 --update

if [[ -z "${WORKSPACE}" ]]; then
# shellcheck disable=SC2016
echo 'Note: Your $WORKSPACE environment variable is not set. Instructions can be found in the user guide:'
echo 'https://github.com/hmrc/sm2/blob/main/USERGUIDE.md#setup'
fi
2 changes: 1 addition & 1 deletion servicemanager/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func update(workspaceInstallPath string) error {

if currentVersion == latestVersion {
// already on latest, short-circuit
fmt.Printf("Already up to date.")
fmt.Printf("Already up to date.\n")
return nil
}

Expand Down

0 comments on commit 8dbbb91

Please sign in to comment.