Fix Script: add first packages in Linux before

This commit is contained in:
Yuan Chiu 2025-04-23 21:52:15 +08:00
parent e757bcc18b
commit 72d7d1a3fd
3 changed files with 34 additions and 12 deletions

View File

@ -23,10 +23,15 @@ casks = [
] ]
[packages.linux.manjaro] [packages.linux.manjaro]
pacman = [ pacman_first = [
'archlinux-keyring', 'archlinux-keyring',
'chezmoi',
'libpamac', 'libpamac',
'llvm',
'llvm-libs',
]
pacman = [
'chezmoi',
'yay', 'yay',
'base-devel', 'base-devel',
'fakeroot', 'fakeroot',
@ -42,8 +47,6 @@ pacman = [
'go', 'go',
'nodejs', 'nodejs',
'jdk-openjdk', 'jdk-openjdk',
'llvm',
'llvm-libs',
] ]
aur = [ aur = [

View File

@ -5,6 +5,7 @@
{{- /* https://github.com/mriehl/dotfiles/blob/master/run_onchange_packages.sh.tmpl */ -}} {{- /* https://github.com/mriehl/dotfiles/blob/master/run_onchange_packages.sh.tmpl */ -}}
#!/usr/bin/env bash #!/usr/bin/env bash
pacmanFirst_packages=( {{.packages.linux.manjaro.pacman_first | quoteList | join " " }})
pacman_packages=( {{.packages.linux.manjaro.pacman | quoteList | join " " }}) pacman_packages=( {{.packages.linux.manjaro.pacman | quoteList | join " " }})
aur_packages=( {{.packages.linux.manjaro.aur | quoteList | join " " }}) aur_packages=( {{.packages.linux.manjaro.aur | quoteList | join " " }})
@ -14,6 +15,18 @@ is_installed() {
[[ " ${installed_packages[*]} " =~ " $1 " ]] [[ " ${installed_packages[*]} " =~ " $1 " ]]
} }
to_install_pacmanFirst=()
for package in "${pacmanFirst_packages[@]}"; do
if ! is_installed "$package"; then
to_install_pacmanFirst+=("$package")
fi
done
if [[ ${#to_install_pacmanFirst[@]} -gt 0 ]]; then
echo " - Installing missing packages via pacman: ${to_install_pacmanFirst[@]}"
sudo pacman -S --needed --noconfirm "${to_install_pacmanFirst[@]}"
fi
to_install_pacman=() to_install_pacman=()
for package in "${pacman_packages[@]}"; do for package in "${pacman_packages[@]}"; do
if ! is_installed "$package"; then if ! is_installed "$package"; then
@ -23,12 +36,12 @@ done
if [[ ${#to_install_pacman[@]} -gt 0 ]]; then if [[ ${#to_install_pacman[@]} -gt 0 ]]; then
echo " - Installing missing packages via pacman: ${to_install_pacman[@]}" echo " - Installing missing packages via pacman: ${to_install_pacman[@]}"
sudo pacman -S --noconfirm "${to_install_pacman[@]}" sudo pacman -S --needed --noconfirm "${to_install_pacman[@]}"
fi fi
if ! is_installed "yay"; then if ! is_installed "yay"; then
echo " - Installing yay" echo " - Installing yay"
sudo pacman -S --noconfirm yay sudo pacman -S --needed --noconfirm yay
fi fi
to_install_aur=() to_install_aur=()

View File

@ -4,21 +4,27 @@ Yuan dotfile
安裝 (個人用途) 安裝 (個人用途)
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
### Linux / macOS ### Linux / macOS
#### 1. 放置自己的金鑰(若是其他人要用,請直接跳過) #### 安裝主dotfiles包
```
sh -c "$(curl -fsLS get.chezmoi.io)" -- init https://git.yuaner.tw/yuan/dotfiles-private.git --apply
```
<details>
<summary>私人用安裝方式</summary>
##### 1. 放置自己的金鑰(若是其他人要用,請直接跳過)
`id_rsa` sshkey金鑰檔放到 `~/.ssh/id_rsa` `id_rsa` sshkey金鑰檔放到 `~/.ssh/id_rsa`
#### 2. 安裝主dotfiles包 ##### 2. 安裝主dotfiles包
``` ```
#sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply ssh://git@git.yuaner.tw:10022/yuan/dotfiles.git #私人用 sh -c "$(curl -fsLS get.chezmoi.io)" -- init ssh://git@git.yuaner.tw:10022/yuan/dotfiles.git --apply
sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply ssh://git@git.yuaner.tw:10022/yuan/dotfiles.git
vim +PlugInstall +qall
``` ```
#### 3. 安裝私人用的dotfiles包若是其他人要用請直接跳過 ##### 3. 安裝私人用的dotfiles包若是其他人要用請直接跳過
``` ```
chezmoi init --source ~/.local/share/chezmoi-private --config ~/.config/chezmoi-private/chezmoi.toml ssh://git@git.yuaner.tw:10022/yuan/dotfiles-private.git --apply chezmoi init --source ~/.local/share/chezmoi-private --config ~/.config/chezmoi-private/chezmoi.toml ssh://git@git.yuaner.tw:10022/yuan/dotfiles-private.git --apply
chezmoi apply chezmoi apply
``` ```
</details>
#### 若需要刪掉重來 #### 若需要刪掉重來
``` ```