all-smi 추가
This commit is contained in:
1 parent
0757f0c33d
commit
0eafe509d7
4 files changed
+373
-1
No files matched your search
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
### 🐳 2. 시스템 & 컨테이너 DevOps
|
### 🐳 2. 시스템 & 컨테이너 DevOps
|
||||||
* **[bottom](https://github.com/ClementTsang/bottom)** - CPU, 메모리, 네트워크 등을 실시간 모니터링하는 TUI
|
* **[bottom](https://github.com/ClementTsang/bottom)** - CPU, 메모리, 네트워크 등을 실시간 모니터링하는 TUI
|
||||||
|
* **[all-smi](https://github.com/lablup/all-smi)** - 이종 GPU/NPU 가속기 및 리소스를 실시간 모니터링하는 통합 TUI
|
||||||
* **[Docker](https://www.docker.com/)** - 컨테이너 플랫폼 (Linux 자동 설치 지원, Mac/Windows 가이드 제공)
|
* **[Docker](https://www.docker.com/)** - 컨테이너 플랫폼 (Linux 자동 설치 지원, Mac/Windows 가이드 제공)
|
||||||
* **[lazydocker](https://github.com/jesseduffield/lazydocker)** - 도커 컨테이너, 이미지, 볼륨을 시각적으로 제어하는 TUI
|
* **[lazydocker](https://github.com/jesseduffield/lazydocker)** - 도커 컨테이너, 이미지, 볼륨을 시각적으로 제어하는 TUI
|
||||||
* **[ctop](https://github.com/bcicen/ctop)** - 실시간 컨테이너 메트릭 및 자원 모니터링 TUI
|
* **[ctop](https://github.com/bcicen/ctop)** - 실시간 컨테이너 메트릭 및 자원 모니터링 TUI
|
||||||
@@ -75,6 +76,11 @@
|
|||||||
curl -fsSL "https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-bottom.sh?ref_type=heads" | bash
|
curl -fsSL "https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-bottom.sh?ref_type=heads" | bash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* **all-smi:**
|
||||||
|
```bash
|
||||||
|
curl -fsSL "https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-all-smi.sh?ref_type=heads" | bash
|
||||||
|
```
|
||||||
|
|
||||||
* **ctop:**
|
* **ctop:**
|
||||||
```bash
|
```bash
|
||||||
curl -fsSL "https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-ctop.sh?ref_type=heads" | bash
|
curl -fsSL "https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-ctop.sh?ref_type=heads" | bash
|
||||||
@@ -202,6 +208,20 @@
|
|||||||
$t="$env:TEMP\install-bottom.ps1"; iwr -useb 'https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-bottom.ps1' -OutFile $t; powershell -ExecutionPolicy Bypass -File $t
|
$t="$env:TEMP\install-bottom.ps1"; iwr -useb 'https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-bottom.ps1' -OutFile $t; powershell -ExecutionPolicy Bypass -File $t
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* **all-smi:**
|
||||||
|
* **CMD 창에서 설치 시 (.ps1 실행 또는 .bat 실행):**
|
||||||
|
```cmd
|
||||||
|
powershell -ExecutionPolicy Bypass -c "[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; $t=\"$env:TEMP\install-all-smi.ps1\"; iwr -useb 'https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-all-smi.ps1' -OutFile $t; & $t"
|
||||||
|
```
|
||||||
|
배치 파일(.bat) 다운로드 및 실행:
|
||||||
|
```cmd
|
||||||
|
curl -fsSL "https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-all-smi.bat" -o "%TEMP%\install-all-smi.bat" && "%TEMP%\install-all-smi.bat"
|
||||||
|
```
|
||||||
|
* **파워쉘 창에서 설치 시:**
|
||||||
|
```powershell
|
||||||
|
$t="$env:TEMP\install-all-smi.ps1"; iwr -useb 'https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-all-smi.ps1' -OutFile $t; powershell -ExecutionPolicy Bypass -File $t
|
||||||
|
```
|
||||||
|
|
||||||
* **ctop:**
|
* **ctop:**
|
||||||
* **CMD 창에서 설치 시:**
|
* **CMD 창에서 설치 시:**
|
||||||
```cmd
|
```cmd
|
||||||
@@ -457,7 +477,19 @@ btm # 실행 명령어
|
|||||||
| `k` | 선택한 대상 프로세스 강제 종료 (Kill) |
|
| `k` | 선택한 대상 프로세스 강제 종료 (Kill) |
|
||||||
| `/` | 실시간 프로세스명 검색 필터링 |
|
| `/` | 실시간 프로세스명 검색 필터링 |
|
||||||
|
|
||||||
#### 2.2. Docker
|
#### 2.2. all-smi
|
||||||
|
Lablup에서 개발한 이종(Heterogeneous) 가속기 및 GPU/NPU 자원 통합 모니터링 CLI/TUI 도구입니다. `nvidia-smi`를 대체/확장하여 다양한 AI 가속기 및 클러스터 노드 관제를 지원합니다.
|
||||||
|
|
||||||
|
* **이종 가속기 지원** — NVIDIA GPU, Apple Silicon, Intel Gaudi, Google TPU, Rebellions NPU, Furiosa NPU, Tenstorrent NPU 등 모니터링 지원
|
||||||
|
* **실시간 인터랙티브 TUI** — GPU/NPU 사용률, 메모리, 온도, 전력 소모량 실시간 그래프 시각화
|
||||||
|
* **클러스터 메트릭 관제** — 원격 시스템 관제 및 프로메테우스(Prometheus) 메트릭 추출 기능 연동 지원
|
||||||
|
|
||||||
|
```bash
|
||||||
|
all-smi # 인터랙티브 모니터링 TUI 세션 시작
|
||||||
|
all-smi --help # 도움말 및 사용 가능 옵션 확인
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 2.3. Docker
|
||||||
컨테이너 기반 애플리케이션 가상화 플랫폼입니다.
|
컨테이너 기반 애플리케이션 가상화 플랫폼입니다.
|
||||||
|
|
||||||
* **자동 설치 지원:** `install-docker.sh`는 Linux 환경에 필수적인 Docker Engine 및 Compose를 무인 설치합니다.
|
* **자동 설치 지원:** `install-docker.sh`는 Linux 환경에 필수적인 Docker Engine 및 Compose를 무인 설치합니다.
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
@echo off
|
||||||
|
rem Lablup all-smi (Cross-platform Unified GPU/NPU Monitor) Windows 배치 설치 스크립트
|
||||||
|
rem PowerShell 스크립트(install-all-smi.ps1)를 호출하여 바이너리를 다운로드하고 설치합니다.
|
||||||
|
|
||||||
|
setlocal
|
||||||
|
|
||||||
|
echo [INFO] Starting Lablup all-smi installation...
|
||||||
|
|
||||||
|
rem 스크립트 위치 확인 및 ps1 파일 탐색
|
||||||
|
set "SCRIPT_DIR=%~dp0"
|
||||||
|
set "PS1_FILE=%SCRIPT_DIR%install-all-smi.ps1"
|
||||||
|
|
||||||
|
if exist "%PS1_FILE%" (
|
||||||
|
echo [INFO] Running local install-all-smi.ps1 script...
|
||||||
|
powershell -NoProfile -ExecutionPolicy Bypass -Command "[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; & '%PS1_FILE%'"
|
||||||
|
) else (
|
||||||
|
echo [INFO] Local install-all-smi.ps1 not found. Downloading and executing remote installer...
|
||||||
|
powershell -NoProfile -ExecutionPolicy Bypass -Command "[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; $t=\"%TEMP%\install-all-smi.ps1\"; iwr -useb 'https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-all-smi.ps1' -OutFile $t; & $t"
|
||||||
|
)
|
||||||
|
|
||||||
|
if %ERRORLEVEL% NEQ 0 (
|
||||||
|
echo [ERROR] all-smi installation failed with error code %ERRORLEVEL%.
|
||||||
|
exit /b %ERRORLEVEL%
|
||||||
|
)
|
||||||
|
|
||||||
|
echo [OK] Installation completed successfully.
|
||||||
|
endlocal
|
||||||
@@ -0,0 +1,151 @@
|
|||||||
|
#Requires -Version 5.1
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Installs Lablup all-smi (Cross-platform Unified GPU/NPU Monitor) for Windows.
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
GitHub Releases에서 제공하는 Windows용 네이티브 바이너리(.zip)를
|
||||||
|
다운로드하고 $env:USERPROFILE\.local\bin\all-smi.exe 경로에 설치합니다.
|
||||||
|
공식 레포지토리: https://github.com/lablup/all-smi
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
.\install-all-smi.ps1
|
||||||
|
#>
|
||||||
|
|
||||||
|
Set-StrictMode -Version Latest
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
|
# HTTPS 다운로드를 위해 TLS 1.2+ 강제 설정
|
||||||
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# 상수 정의
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
$REPO = "lablup/all-smi"
|
||||||
|
$API_URL = "https://api.github.com/repos/$REPO/releases/latest"
|
||||||
|
$INSTALL_DIR = Join-Path $env:USERPROFILE ".local\bin"
|
||||||
|
$FALLBACK_VERSION = "v0.25.0"
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# 유틸리티 함수 (영문 메시지 출력, 인코딩 문제 차단)
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
function Info { Write-Host "[INFO] $args" -ForegroundColor Cyan }
|
||||||
|
function Warn { Write-Host "[WARN] $args" -ForegroundColor Yellow }
|
||||||
|
function Success { Write-Host "[OK] $args" -ForegroundColor Green }
|
||||||
|
function ErrExit { Write-Host "[ERROR] $args" -ForegroundColor Red; exit 1 }
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# 아키텍처 감지
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
$arch = $env:PROCESSOR_ARCHITECTURE
|
||||||
|
Info "Detected CPU Architecture: $arch"
|
||||||
|
|
||||||
|
$assetName = "all-smi-windows-x86_64.zip"
|
||||||
|
if ($arch -ne "AMD64" -and $arch -ne "ARM64") {
|
||||||
|
Warn "Architecture '$arch' may not be fully supported. Attempting installation with x86_64 binary."
|
||||||
|
}
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# 최신 릴리즈 태그 가져오기
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
$tag = $null
|
||||||
|
try {
|
||||||
|
Info "Fetching latest release tag from GitHub API..."
|
||||||
|
$response = Invoke-RestMethod -Uri $API_URL -TimeoutSec 10
|
||||||
|
$tag = $response.tag_name
|
||||||
|
} catch {
|
||||||
|
Warn "Failed to retrieve the latest version from GitHub API. Using fallback version: $FALLBACK_VERSION"
|
||||||
|
$tag = $FALLBACK_VERSION
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not $tag) {
|
||||||
|
$tag = $FALLBACK_VERSION
|
||||||
|
}
|
||||||
|
|
||||||
|
$downloadUrl = "https://github.com/$REPO/releases/download/$tag/$assetName"
|
||||||
|
Info "Resolved download URL: $downloadUrl"
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# 다운로드, 압축 해제 및 설치
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# 설치 폴더 생성
|
||||||
|
if (-not (Test-Path $INSTALL_DIR)) {
|
||||||
|
New-Item -ItemType Directory -Path $INSTALL_DIR | Out-Null
|
||||||
|
Info "Created installation directory: $INSTALL_DIR"
|
||||||
|
}
|
||||||
|
|
||||||
|
$tempZip = Join-Path $env:TEMP "all_smi_temp.zip"
|
||||||
|
$tempExtractDir = Join-Path $env:TEMP "all_smi_temp_extract"
|
||||||
|
$destFile = Join-Path $INSTALL_DIR "all-smi.exe"
|
||||||
|
|
||||||
|
try {
|
||||||
|
Info "Downloading binary archive..."
|
||||||
|
Invoke-WebRequest -Uri $downloadUrl -OutFile $tempZip -UseBasicParsing
|
||||||
|
|
||||||
|
if (Test-Path $tempExtractDir) {
|
||||||
|
Remove-Item $tempExtractDir -Recurse -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
Info "Extracting archive..."
|
||||||
|
Expand-Archive -Path $tempZip -DestinationPath $tempExtractDir -Force
|
||||||
|
|
||||||
|
$extractedBin = Get-ChildItem -Path $tempExtractDir -Recurse -Filter "all-smi.exe" | Select-Object -First 1
|
||||||
|
if (-not $extractedBin) {
|
||||||
|
ErrExit "Could not find 'all-smi.exe' in extracted files."
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Test-Path $destFile) {
|
||||||
|
Remove-Item $destFile -Force
|
||||||
|
}
|
||||||
|
Move-Item -Path $extractedBin.FullName -Destination $destFile -Force
|
||||||
|
Success "Binary installed to $destFile"
|
||||||
|
} catch {
|
||||||
|
ErrExit "Failed to download or install the binary: $_"
|
||||||
|
} finally {
|
||||||
|
if (Test-Path $tempZip) { Remove-Item $tempZip -ErrorAction SilentlyContinue }
|
||||||
|
if (Test-Path $tempExtractDir) { Remove-Item $tempExtractDir -Recurse -ErrorAction SilentlyContinue }
|
||||||
|
}
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# PATH 환경 변수 설정
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
$userPath = [System.Environment]::GetEnvironmentVariable('Path', 'User')
|
||||||
|
$normalizedInstallDir = $INSTALL_DIR.TrimEnd('\')
|
||||||
|
|
||||||
|
# 현재 세션 PATH 확인 및 반영
|
||||||
|
if ($env:Path -notlike "*$normalizedInstallDir*") {
|
||||||
|
$env:Path = "$normalizedInstallDir;$env:Path"
|
||||||
|
Info "Added $normalizedInstallDir to current session PATH."
|
||||||
|
}
|
||||||
|
|
||||||
|
# 사용자 PATH 레지스트리 영구 등록 확인
|
||||||
|
$pathList = $userPath -split ';'
|
||||||
|
$alreadyInPath = $false
|
||||||
|
foreach ($p in $pathList) {
|
||||||
|
if ($p.Trim().TrimEnd('\') -eq $normalizedInstallDir) {
|
||||||
|
$alreadyInPath = $true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not $alreadyInPath) {
|
||||||
|
$newUserPath = "$normalizedInstallDir;$userPath"
|
||||||
|
[System.Environment]::SetEnvironmentVariable('Path', $newUserPath, 'User')
|
||||||
|
Success "Added $normalizedInstallDir to User PATH environment variable permanently."
|
||||||
|
Info "Note: You need to restart your terminal/IDE to apply PATH changes."
|
||||||
|
} else {
|
||||||
|
Info "$normalizedInstallDir is already in User PATH."
|
||||||
|
}
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# 설치 완료 정보 출력
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
Info ""
|
||||||
|
Info "=================================================="
|
||||||
|
Success "Lablup all-smi installation complete!"
|
||||||
|
Info "=================================================="
|
||||||
|
Info ""
|
||||||
|
Info "How to run:"
|
||||||
|
Info " all-smi"
|
||||||
|
Info ""
|
||||||
|
Info "For more information, visit: https://github.com/lablup/all-smi"
|
||||||
@@ -0,0 +1,162 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
|
||||||
|
# Lablup all-smi (Cross-platform Unified GPU/NPU Monitor) 설치 스크립트
|
||||||
|
#
|
||||||
|
# macOS, Linux 환경에서 GitHub Releases에 배포된 최신 바이너리를 다운로드하여 설치합니다.
|
||||||
|
# 공식 가이드: https://github.com/lablup/all-smi
|
||||||
|
#
|
||||||
|
# 지원 아키텍처:
|
||||||
|
# macOS : Apple Silicon (arm64), Intel (x86_64)
|
||||||
|
# Linux : x86_64 (amd64), ARM64 (aarch64)
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# 상수 정의
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
REPO="lablup/all-smi"
|
||||||
|
API_URL="https://api.github.com/repos/${REPO}/releases/latest"
|
||||||
|
INSTALL_DIR="${HOME}/.local/bin"
|
||||||
|
FALLBACK_VERSION="v0.25.0"
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# 유틸리티 함수 (모두 stderr 출력)
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
info() { echo "[INFO] $*" >&2; }
|
||||||
|
warn() { echo "[WARN] $*" >&2; }
|
||||||
|
error() { echo "[ERROR] $*" >&2; exit 1; }
|
||||||
|
success() { echo "[OK] $*" >&2; }
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# 필수 명령어 확인
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
for cmd in curl uname; do
|
||||||
|
command -v "$cmd" &>/dev/null || error "'$cmd' 명령어가 필요합니다."
|
||||||
|
done
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# OS / 아키텍처 감지 및 파일명 결정
|
||||||
|
# 반환값 형식: "<에셋파일명>:<압축포맷>"
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
detect_platform() {
|
||||||
|
local os arch
|
||||||
|
os="$(uname -s)"
|
||||||
|
arch="$(uname -m)"
|
||||||
|
|
||||||
|
case "$os" in
|
||||||
|
Darwin)
|
||||||
|
case "$arch" in
|
||||||
|
arm64|x86_64) echo "all-smi-macos-aarch64.zip:zip" ;;
|
||||||
|
*) error "지원하지 않는 macOS 아키텍처: $arch" ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
Linux)
|
||||||
|
case "$arch" in
|
||||||
|
x86_64|amd64) echo "all-smi-linux-x86_64.tar.gz:tar.gz" ;;
|
||||||
|
aarch64|arm64) echo "all-smi-linux-aarch64.tar.gz:tar.gz" ;;
|
||||||
|
*) error "지원하지 않는 Linux 아키텍처: $arch" ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
error "지원하지 않는 OS입니다: $os. Windows인 경우 install-all-smi.ps1 또는 install-all-smi.bat을 사용하세요."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# 최신 릴리즈 태그 가져오기
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
get_latest_tag() {
|
||||||
|
local json tag
|
||||||
|
info "GitHub API에서 all-smi 최신 릴리즈 정보를 가져오는 중..."
|
||||||
|
|
||||||
|
if json=$(curl -fsSL --connect-timeout 10 "${API_URL}" 2>/dev/null); then
|
||||||
|
if command -v jq &>/dev/null; then
|
||||||
|
tag=$(echo "$json" | jq -r '.tag_name')
|
||||||
|
else
|
||||||
|
# jq가 없는 경우 grep & sed 사용
|
||||||
|
tag=$(echo "$json" | grep '"tag_name":' | head -n 1 | sed -E 's/.*"tag_name": *"([^"]+)".*/\1/')
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${tag:-}" || "${tag}" == "null" ]]; then
|
||||||
|
warn "최신 태그 정보를 가져오지 못했습니다. 기본 버전(${FALLBACK_VERSION})을 사용합니다."
|
||||||
|
echo "${FALLBACK_VERSION}"
|
||||||
|
else
|
||||||
|
echo "${tag}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# 메인 설치 함수
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
main() {
|
||||||
|
local platform_info asset_name format tag url tmpdir archive_file bin_src
|
||||||
|
|
||||||
|
platform_info="$(detect_platform)"
|
||||||
|
asset_name="${platform_info%%:*}"
|
||||||
|
format="${platform_info##*:}"
|
||||||
|
|
||||||
|
info "감지된 플랫폼 에셋: $asset_name (포맷: $format)"
|
||||||
|
|
||||||
|
tag="$(get_latest_tag)"
|
||||||
|
info "적용할 버전 태그: $tag"
|
||||||
|
|
||||||
|
url="https://github.com/${REPO}/releases/download/${tag}/${asset_name}"
|
||||||
|
|
||||||
|
# 임시 디렉토리 생성
|
||||||
|
tmpdir="$(mktemp -d)"
|
||||||
|
trap '[[ -d "${tmpdir:-}" ]] && rm -rf "$tmpdir"' EXIT
|
||||||
|
|
||||||
|
archive_file="${tmpdir}/${asset_name}"
|
||||||
|
|
||||||
|
info "바이너리 아카이브 다운로드 중: $url"
|
||||||
|
if ! curl -fsSL --progress-bar -o "$archive_file" "$url"; then
|
||||||
|
error "다운로드 실패: $url"
|
||||||
|
fi
|
||||||
|
|
||||||
|
info "압축 해제 중..."
|
||||||
|
case "$format" in
|
||||||
|
zip)
|
||||||
|
command -v unzip &>/dev/null || error "'unzip' 명령어가 필요합니다."
|
||||||
|
unzip -q "$archive_file" -d "$tmpdir"
|
||||||
|
;;
|
||||||
|
tar.gz)
|
||||||
|
command -v tar &>/dev/null || error "'tar' 명령어가 필요합니다."
|
||||||
|
tar -xzf "$archive_file" -C "$tmpdir"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
error "지원하지 않는 압축 포맷: $format"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
bin_src="$(find "$tmpdir" -maxdepth 2 -type f -name "all-smi" | head -1)"
|
||||||
|
[[ -z "$bin_src" ]] && error "아카이브 내에서 'all-smi' 바이너리를 찾을 수 없습니다."
|
||||||
|
|
||||||
|
# 설치 디렉토리 확보
|
||||||
|
mkdir -p "$INSTALL_DIR"
|
||||||
|
|
||||||
|
local install_path="${INSTALL_DIR}/all-smi"
|
||||||
|
info "설치 경로로 복사 중: ${install_path}"
|
||||||
|
cp "$bin_src" "$install_path"
|
||||||
|
chmod +x "$install_path"
|
||||||
|
|
||||||
|
success "Lablup all-smi 설치가 완료되었습니다!"
|
||||||
|
|
||||||
|
# 버전 정보 출력 테스트
|
||||||
|
if "$install_path" --version &>/dev/null; then
|
||||||
|
info "버전 확인: $("$install_path" --version)"
|
||||||
|
elif "$install_path" -V &>/dev/null; then
|
||||||
|
info "버전 확인: $("$install_path" -V)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# PATH 환경 변수 체크 및 가이드
|
||||||
|
if ! echo ":${PATH}:" | grep -q ":${INSTALL_DIR}:"; then
|
||||||
|
warn "'${INSTALL_DIR}' 경로가 PATH 환경 변수에 추가되어 있지 않습니다."
|
||||||
|
warn "다음 명령어를 통해 쉘 설정 파일(~/.bashrc 또는 ~/.zshrc)에 PATH를 추가하세요:"
|
||||||
|
warn " echo 'export PATH=\"\$HOME/.local/bin:\$PATH\"' >> ~/.zshrc && source ~/.zshrc"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
Reference in new issue
Block a user