23 lines
744 B
Bash
23 lines
744 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
installer_url="https://github.com/stalwartlabs/cli/releases/latest/download/stalwart-cli-installer.sh"
|
|
|
|
if ! command -v curl >/dev/null 2>&1; then
|
|
printf '%s\n' 'curl is required to install stalwart-cli.' >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ "${EUID}" -eq 0 ]]; then
|
|
curl --fail --silent --show-error --location --proto '=https' --tlsv1.2 "$installer_url" | sh
|
|
else
|
|
if ! command -v sudo >/dev/null 2>&1; then
|
|
printf '%s\n' 'Run this script as root or install sudo for a system-wide installation.' >&2
|
|
exit 1
|
|
fi
|
|
|
|
curl --fail --silent --show-error --location --proto '=https' --tlsv1.2 "$installer_url" | sudo sh
|
|
fi
|
|
|
|
command -v stalwart-cli >/dev/null 2>&1 && stalwart-cli --version
|