diff --git a/README.adoc b/README.adoc index 4253a2257..c6d2c3fcf 100644 --- a/README.adoc +++ b/README.adoc @@ -41,7 +41,14 @@ We surely try to fix bugs as soon as possible but we do not work extra shifts or All you need before installing IDEasy is https://git-scm.com/download/[git]. -=== Install +=== Quick Install (One-Liner) + +The fastest way to install IDEasy - auto-detects your OS and architecture, downloads the latest release, and runs setup. + +```bash +bash -c "$(curl -fsSL https://raw.githubusercontent.com/devonfw/IDEasy/main/install.sh)" +``` +=== Manual Install Download the latest version of `IDEasy` from https://github.com/devonfw/IDEasy/releases[here] and install it. diff --git a/install.sh b/install.sh new file mode 100755 index 000000000..fbc3d7a84 --- /dev/null +++ b/install.sh @@ -0,0 +1,109 @@ +#!/bin/bash +# One-liner installer for IDEasy. +# Usage: bash -c "$(curl -fsSL https://raw.githubusercontent.com/devonfw/IDEasy/main/install.sh)" +# +# What it does: +# 1. Detects your OS (mac/linux) and architecture (x64/arm64) +# 2. Fetches the latest release version from GitHub +# 3. Downloads and extracts the correct archive to a temp directory +# 4. Runs the setup script +# 5. Cleans up the temp directory +# +# On Windows use Git Bash (comes with Git for Windows). +# Prerequisites: git, curl, tar + +set -eu + +GITHUB_REPO="devonfw/IDEasy" + +# colored output helpers +red() { printf '\033[1;31m%s\033[0m\n' "$1"; } +green() { printf '\033[1;32m%s\033[0m\n' "$1"; } +blue() { printf '\033[1;34m%s\033[0m\n' "$1"; } + +abort() { red "Error: $1" >&2; exit 1; } + +detect_os() { + case "$(uname -s)" in + Linux*) echo "linux" ;; + Darwin*) echo "mac" ;; + *) abort "Unsupported operating system: $(uname -s). Use the PowerShell installer on Windows." ;; + esac +} + +detect_arch() { + case "$(uname -m)" in + x86_64|amd64) echo "x64" ;; + arm64|aarch64) echo "arm64" ;; + *) abort "Unsupported architecture: $(uname -m)" ;; + esac +} + +# gets the latest release tag from GitHub API and strips the "release/" prefix +fetch_latest_version() { + local url="https://api.github.com/repos/${GITHUB_REPO}/releases/latest" + local tag + tag=$(curl -fsSL "${url}" | grep '"tag_name"' | cut -d '"' -f 4) + if [ -z "${tag}" ]; then + abort "Failed to determine latest release version." + fi + echo "${tag#release/}" +} + +check_prerequisites() { + if ! command -v git >/dev/null 2>&1; then + abort "git is required but not installed. See https://git-scm.com/downloads" + fi + if ! command -v curl >/dev/null 2>&1; then + abort "curl is required but not installed." + fi + if ! command -v tar >/dev/null 2>&1; then + abort "tar is required but not installed." + fi +} + +main() { + blue "Installing IDEasy..." + + check_prerequisites + + local os arch version download_url archive + os=$(detect_os) + arch=$(detect_arch) + version=$(fetch_latest_version) + archive="ide-cli-${version}-${os}-${arch}.tar.gz" + download_url="https://github.com/${GITHUB_REPO}/releases/download/release/${version}/${archive}" + + blue "Detected: ${os} ${arch}" + blue "Latest version: ${version}" + + # download to a temp dir that gets cleaned up on exit + TMPDIR_CLEANUP=$(mktemp -d) + trap 'rm -rf "${TMPDIR_CLEANUP}"' EXIT + local tmpdir="${TMPDIR_CLEANUP}" + + blue "Downloading ${archive}..." + curl -fSL --progress-bar -o "${tmpdir}/${archive}" "${download_url}" + + blue "Extracting..." + tar xzf "${tmpdir}/${archive}" -C "${tmpdir}" + + # on macOS remove quarantine flag so the binary can run without gatekeeper issues + if [ "${os}" = "mac" ]; then + xattr -r -d com.apple.quarantine "${tmpdir}" 2>/dev/null || true + fi + + blue "Running setup..." + cd "${tmpdir}" + bash setup # set up a new project" + echo " ide --help # see all commands" + echo "" +} + +main