pi/kimi2.5 로 작업; bottom 수정 및 lazygit 추가
This commit is contained in:
1 parent
a07e58ce04
commit
dd494a4991
7 files changed
+746
-120
No files matched your search
+43
-43
@@ -1,15 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck disable=SC2086
|
||||
|
||||
# https://github.com/ClementTsang/bottom/releases 에서 Nightly 마지막 버전 목록을 확인하고
|
||||
# 현재 OS와 CPU 등을 파악한 후 다운로드 받아서 설치
|
||||
# Downloads and installs the latest Nightly version from
|
||||
# https://github.com/ClementTsang/bottom/releases
|
||||
#
|
||||
# 지원 플랫폼:
|
||||
# Supported platforms:
|
||||
# macOS : Apple Silicon (arm64), Intel (x86_64)
|
||||
# Linux : x86_64, aarch64(RPi4/5), armv7(RPi2/3 32bit), armv6(RPi Zero/1), i686
|
||||
# FreeBSD : x86_64
|
||||
# Windows : Git Bash / MSYS2 / Cygwin 환경에서 .zip 설치
|
||||
# (네이티브 PowerShell/CMD는 지원 안 함 → WSL 권장)
|
||||
# Windows : Git Bash / MSYS2 / Cygwin (.zip install)
|
||||
# (Native PowerShell/CMD not supported → use WSL)
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
@@ -35,13 +35,13 @@ for cmd in curl uname; do
|
||||
command -v "$cmd" &>/dev/null || error "'$cmd' 명령어가 필요합니다."
|
||||
done
|
||||
|
||||
# jq가 없으면 python3으로 JSON 파싱 (fallback)
|
||||
# Fallback: use python3 if jq is not available
|
||||
if command -v jq &>/dev/null; then
|
||||
_json_nightly_tag() {
|
||||
jq -r '[.[] | select(.prerelease==true and (.tag_name | startswith("nightly-")))] | .[0].tag_name'
|
||||
}
|
||||
else
|
||||
command -v python3 &>/dev/null || error "'jq' 또는 'python3' 중 하나가 필요합니다."
|
||||
command -v python3 &>/dev/null || error "'jq' or 'python3' is required."
|
||||
_json_nightly_tag() {
|
||||
python3 -c "
|
||||
import sys, json
|
||||
@@ -88,9 +88,9 @@ detect_platform() {
|
||||
echo "armv7-unknown-linux-musleabihf:tar.gz" ;;
|
||||
armv6l)
|
||||
# RPi Zero / 1 (ARMv6)
|
||||
# bottom은 ARMv6용 사전 빌드 바이너리를 제공하지 않습니다.
|
||||
# (armv7 musl/gnu 바이너리는 ARMv6에서 동작하지 않음)
|
||||
error "ARMv6(RPi Zero/1)용 사전 빌드 바이너리가 제공되지 않습니다. 'cargo install bottom' 으로 소스 빌드를 권장합니다." ;;
|
||||
# No pre-built binaries available for ARMv6.
|
||||
# (armv7 musl/gnu binaries don't work on ARMv6)
|
||||
error "No pre-built binaries for ARMv6 (RPi Zero/1). Build from source: 'cargo install bottom'" ;;
|
||||
i686|i386)
|
||||
echo "i686-unknown-linux-musl:tar.gz" ;;
|
||||
*)
|
||||
@@ -107,11 +107,11 @@ detect_platform() {
|
||||
;;
|
||||
|
||||
# ── Windows (Git Bash / MSYS2 / Cygwin) ───────────────
|
||||
# 네이티브 PowerShell/CMD는 bash가 없으므로 이 스크립트 실행 불가
|
||||
# WSL은 Linux로 감지되므로 여기에 해당 안 됨
|
||||
# Native PowerShell/CMD don't have bash, so this script won't run
|
||||
# WSL is detected as Linux, not Windows
|
||||
MINGW*|MSYS*|CYGWIN*)
|
||||
warn "Windows 환경(Git Bash/MSYS2/Cygwin)이 감지되었습니다."
|
||||
warn "WSL(Windows Subsystem for Linux) 사용을 권장합니다."
|
||||
warn "Windows environment (Git Bash/MSYS2/Cygwin) detected."
|
||||
warn "WSL (Windows Subsystem for Linux) is recommended."
|
||||
# Windows에는 tar.exe(Windows 10 1803+)가 있어 .zip 처리 가능
|
||||
case "$arch" in
|
||||
x86_64) echo "x86_64-pc-windows-msvc:zip" ;;
|
||||
@@ -128,34 +128,34 @@ detect_platform() {
|
||||
}
|
||||
|
||||
# ────────────────────────────────────────────
|
||||
# 최신 Nightly 릴리스 태그 가져오기
|
||||
# Get latest Nightly release tag
|
||||
# ────────────────────────────────────────────
|
||||
get_latest_nightly_tag() {
|
||||
info "GitHub API로 최신 Nightly 릴리스 정보를 조회합니다..."
|
||||
info "Fetching latest Nightly release from GitHub API..."
|
||||
|
||||
local releases
|
||||
releases="$(curl -fsSL "${API_URL}")" || error "GitHub API 호출에 실패했습니다."
|
||||
releases="$(curl -fsSL "${API_URL}")" || error "Failed to call GitHub API."
|
||||
|
||||
local tag
|
||||
tag="$(echo "$releases" | _json_nightly_tag)"
|
||||
|
||||
[[ -z "$tag" || "$tag" == "null" ]] && error "Nightly 릴리스 태그를 찾을 수 없습니다."
|
||||
[[ -z "$tag" || "$tag" == "null" ]] && error "Could not find Nightly release tag."
|
||||
echo "$tag"
|
||||
}
|
||||
|
||||
# ────────────────────────────────────────────
|
||||
# 다운로드 URL 조합
|
||||
# Build download URL
|
||||
# ────────────────────────────────────────────
|
||||
build_download_url() {
|
||||
local tag="$1"
|
||||
local triple="$2" # 플랫폼 트리플 (e.g. x86_64-apple-darwin)
|
||||
local triple="$2" # Platform triple (e.g. x86_64-apple-darwin)
|
||||
local ext="$3" # tar.gz | zip
|
||||
local filename="bottom_${triple}.${ext}"
|
||||
echo "https://github.com/${REPO}/releases/download/${tag}/${filename}"
|
||||
}
|
||||
|
||||
# ────────────────────────────────────────────
|
||||
# 다운로드 & 압축 해제 & 설치
|
||||
# Download, extract & install
|
||||
# ────────────────────────────────────────────
|
||||
download_and_install() {
|
||||
local url="$1"
|
||||
@@ -169,77 +169,77 @@ download_and_install() {
|
||||
local filename
|
||||
filename="${url##*/}"
|
||||
|
||||
info "다운로드 중: $url"
|
||||
info "Downloading: $url"
|
||||
curl -fsSL --progress-bar -o "${tmpdir}/${filename}" "$url" \
|
||||
|| error "다운로드 실패: $url"
|
||||
|| error "Download failed: $url"
|
||||
|
||||
info "압축 해제 중..."
|
||||
info "Extracting..."
|
||||
case "$ext" in
|
||||
tar.gz)
|
||||
command -v tar &>/dev/null || error "'tar' 명령어가 필요합니다."
|
||||
command -v tar &>/dev/null || error "'tar' command is required."
|
||||
tar -xzf "${tmpdir}/${filename}" -C "$tmpdir"
|
||||
;;
|
||||
zip)
|
||||
if command -v unzip &>/dev/null; then
|
||||
unzip -q "${tmpdir}/${filename}" -d "$tmpdir"
|
||||
elif command -v tar &>/dev/null; then
|
||||
# Windows 10+ tar.exe 는 zip 지원
|
||||
# Windows 10+ tar.exe supports zip
|
||||
tar -xf "${tmpdir}/${filename}" -C "$tmpdir"
|
||||
else
|
||||
error "'unzip' 또는 'tar'(Windows 10+) 명령어가 필요합니다."
|
||||
error "'unzip' or 'tar' (Windows 10+) is required."
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
error "알 수 없는 압축 포맷: $ext"
|
||||
error "Unknown archive format: $ext"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Windows는 btm.exe, 나머지는 btm
|
||||
# Windows uses btm.exe, others use btm
|
||||
local bin_name="btm"
|
||||
[[ "$is_windows" == "true" ]] && bin_name="btm.exe"
|
||||
|
||||
local bin_src
|
||||
bin_src="$(find "$tmpdir" -maxdepth 3 -type f -name "$bin_name" | head -1)"
|
||||
[[ -z "$bin_src" ]] && error "압축 파일에서 '$bin_name' 실행파일을 찾을 수 없습니다."
|
||||
[[ -z "$bin_src" ]] && error "Cannot find '$bin_name' in the archive."
|
||||
|
||||
# 설치 디렉토리 생성
|
||||
# Create install directory
|
||||
mkdir -p "$INSTALL_DIR"
|
||||
|
||||
local install_path="${INSTALL_DIR}/${bin_name}"
|
||||
info "설치 중: ${install_path}"
|
||||
info "Installing: ${install_path}"
|
||||
cp "$bin_src" "$install_path"
|
||||
chmod +x "$install_path"
|
||||
|
||||
success "설치 완료!"
|
||||
info "버전 확인:"
|
||||
success "Installation complete!"
|
||||
info "Version check:"
|
||||
"$install_path" --version || true
|
||||
|
||||
# PATH 안내
|
||||
# PATH instructions
|
||||
if ! echo ":${PATH}:" | grep -q ":${INSTALL_DIR}:"; then
|
||||
warn "'${INSTALL_DIR}' 가 PATH에 없습니다."
|
||||
warn "다음 줄을 ~/.bashrc 또는 ~/.zshrc 에 추가하세요:"
|
||||
warn "'${INSTALL_DIR}' is not in your PATH."
|
||||
warn "Add this line to your ~/.bashrc or ~/.zshrc:"
|
||||
warn " export PATH=\"\$HOME/.local/bin:\$PATH\""
|
||||
fi
|
||||
}
|
||||
|
||||
# ────────────────────────────────────────────
|
||||
# 메인
|
||||
# Main
|
||||
# ────────────────────────────────────────────
|
||||
main() {
|
||||
local platform_info triple ext is_windows tag url
|
||||
|
||||
platform_info="$(detect_platform)"
|
||||
triple="${platform_info%%:*}" # ':' 앞부분
|
||||
ext="${platform_info##*:}" # ':' 뒷부분
|
||||
triple="${platform_info%%:*}" # Before ':'
|
||||
ext="${platform_info##*:}" # After ':'
|
||||
|
||||
info "감지된 플랫폼: $triple (압축 포맷: $ext)"
|
||||
info "Detected platform: $triple (format: $ext)"
|
||||
|
||||
# Windows 여부 판단
|
||||
# Check if Windows
|
||||
is_windows="false"
|
||||
[[ "$triple" == *"windows"* ]] && is_windows="true"
|
||||
|
||||
tag="$(get_latest_nightly_tag)"
|
||||
info "최신 Nightly 태그: $tag"
|
||||
info "Latest Nightly tag: $tag"
|
||||
|
||||
url="$(build_download_url "$tag" "$triple" "$ext")"
|
||||
download_and_install "$url" "$ext" "$is_windows"
|
||||
|
||||
Reference in new issue
Block a user