From 4a89a290b9c8c3e08020a3941fbecf118d887e65 Mon Sep 17 00:00:00 2001 From: Yuan Chiu Date: Fri, 2 May 2025 21:08:37 +0800 Subject: [PATCH] =?UTF-8?q?feat=20debian=20over=2013=20trixie=20=E5=8F=AF?= =?UTF-8?q?=E7=94=A8=E5=8E=9F=E7=94=9F=E5=A5=97=E4=BB=B6=E5=AE=89=E8=A3=9D?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E9=9C=80=E6=89=8B=E5=8B=95=E8=99=95=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .chezmoidata/packages.toml | 8 ++++++++ ...hange_before_linux-install-packages.sh.tmpl | 18 +++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.chezmoidata/packages.toml b/.chezmoidata/packages.toml index 8231b26..7d99e18 100644 --- a/.chezmoidata/packages.toml +++ b/.chezmoidata/packages.toml @@ -3,6 +3,7 @@ brews = [ 'chezmoi', 'git', + 'lazygit', 'zsh', 'vim', 'neovim', @@ -41,6 +42,11 @@ apt = [ 'gcc', ] +apt_13 = [ + 'neovim', + 'lazygit', +] + # Arch Linux ------------------------------------------------------------------- [packages.linux.arch] pacman_force = [ @@ -53,6 +59,7 @@ pacman = [ 'chezmoi', 'sudo', 'git', + 'lazygit', 'base-devel', 'fakeroot', 'gcc', @@ -99,6 +106,7 @@ pacman = [ 'chezmoi', 'yay', 'git', + 'lazygit', 'base-devel', 'fakeroot', 'gcc', diff --git a/.chezmoiscripts/run_onchange_before_linux-install-packages.sh.tmpl b/.chezmoiscripts/run_onchange_before_linux-install-packages.sh.tmpl index dd0e3f2..1d684b0 100644 --- a/.chezmoiscripts/run_onchange_before_linux-install-packages.sh.tmpl +++ b/.chezmoiscripts/run_onchange_before_linux-install-packages.sh.tmpl @@ -7,6 +7,9 @@ {{/* ---- 整理待安裝清單 -------------------------------------------------- */ -}} {{- $aptInstall := .packages.linux.debian.apt -}} +{{- if ge .chezmoi.osRelease.versionID 13 -}} +{{- $aptInstall := concat .packages.linux.debian.apt .packages.linux.debian.apt_13 -}} +{{- end -}} apt_packages=( {{ $aptInstall | quoteList | join " " }} ) to_install_apt=() @@ -22,7 +25,7 @@ else fi {{/* 手動安裝 neovim 0.11.1 */ -}} -{{ if and (eq .chezmoi.osRelease.id "debian") (eq .chezmoi.arch "amd64") }} +{{ if and (eq .chezmoi.osRelease.id "debian") (eq .chezmoi.arch "amd64") (le .chezmoi.osRelease.versionID 12) }} curl -LO https://github.com/neovim/neovim/releases/download/v0.11.1/nvim-linux-x86_64.appimage chmod u+x nvim-linux-x86_64.appimage ./nvim-linux-x86_64.appimage --appimage-extract @@ -34,8 +37,21 @@ fi rm -r nvim-linux-x86_64.appimage squashfs-root {{ end }} +{{/* 手動安裝 lazygit */ -}} +{{ if and (eq .chezmoi.osRelease.id "debian") (le .chezmoi.osRelease.versionID 12) }} +LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | \grep -Po '"tag_name": *"v\K[^"]*') +curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/download/v${LAZYGIT_VERSION}/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz" +tar xf lazygit.tar.gz lazygit +if [ "$EUID" -ne 0 ]; then + sudo install lazygit -D -t /usr/local/bin/ +else + install lazygit -D -t /usr/local/bin/ +fi +rm -rf lazygit.tar.gz lazygit {{ end -}} +{{ end }} + {{/* ==== Arch Linux / Manjaro ========================================== */ -}} {{ if or (eq .chezmoi.osRelease.id "manjaro") (eq .chezmoi.osRelease.id "arch") -}}