Compare commits

...

3 Commits

5 changed files with 54 additions and 8 deletions

View File

@ -1,21 +1,27 @@
{{- $name := promptStringOnce . "name" "請輸入您的姓名" -}}
{{- $email := promptStringOnce . "email" "輸入您的Email地址" -}}
{{- $hosttype_choices := list "desktop" "server" "manual" -}}
{{- $hosttype_choices := list "desktop" "server" "unroot_server" "manual" -}}
{{- $hosttype := promptChoice "What type of host are you on" $hosttype_choices -}}
{{- $isServer := true -}}
{{- $unRootMode := true -}}
{{- $enableSixel := false -}}
{{- $enableGUI := false -}}
{{- $enableYcm := false -}}
{{- if eq $hosttype "desktop" -}}
{{- if eq $hosttype "server" -}}
{{- $unRootMode = false -}}
{{- else if eq $hosttype "desktop" -}}
{{- $isServer = false -}}
{{- $unRootMode = false -}}
{{- $enableSixel = true -}}
{{- $enableGUI = true -}}
{{- $enableYcm = true -}}
{{- else if eq $hosttype "manual" -}}
{{- $isServer = promptBool "Does this machine is Server" -}}
{{- $unRootMode = promptBool "Is enable unRoot local mode (Will install at home directory)" -}}
{{- $enableSixel = promptBool "Is enable terminal output with sixel" -}}
{{- $enableGUI = promptBool "Does this machine have a GUI" -}}
{{- $enableYcm = promptBool "Is enable Vim YCM compatible (Will use 2.7GB)" -}}
@ -27,6 +33,7 @@ sourceDir = "~/.local/share/chezmoi"
name = {{ $name | quote }}
email = {{ $email | quote }}
serverStyle = {{ $isServer }}
unRootMode = {{ $unRootMode }}
enableSixel = {{ $enableSixel }} {{/* TODO: packages.toml還沒處理 */}}
noGUI = {{ not $enableGUI }}
enableYcm = {{ $enableYcm }}

View File

@ -14,3 +14,26 @@
url = "https://github.com/alacritty/alacritty-theme"
refreshPeriod = "168h"
{{ end }}
{{ if and .unRootMode (eq .chezmoi.arch "amd64")}}
{{/* eza */ -}}
{{ $ezaVersion := "v0.21.3" -}}
[".local/bin/eza"]
type = "archive-file"
url = "https://github.com/eza-community/eza/releases/download/{{ $ezaVersion }}/eza_x86_64-unknown-{{ .chezmoi.os }}-gnu.tar.gz"
path = "eza"
{{/* neovim */ -}}
{{ $nvimVersion := "v0.11.1" -}}
[".local"]
type = "archive"
url = "https://github.com/neovim/neovim/releases/{{ $nvimVersion }}download/nvim-{{ .chezmoi.os }}-x86_64.tar.gz"
exact = true
stripComponents = 1
path = "nvim-linux-x86_64"
{{/* zsh */ -}}
{{/* lazygit */ -}}
{{ end }}

View File

@ -10,7 +10,7 @@ if command -v nvim &> /dev/null; then
nvim --headless "+Lazy! update" +qa
fi
{{ if not .noGUI }}
{{ if and (not .noGUI) (hasKey .chezmoi.osRelease "id") }}
{{ if and (eq .chezmoi.os "linux") (stat (print .chezmoi.homeDir "/.winscp")) }}
{{ if or (eq .chezmoi.osRelease.id "manjaro") (eq .chezmoi.osRelease.id "arch") }}
mkdir -p ~/.winscp

View File

@ -1,4 +1,4 @@
{{ if eq .chezmoi.os "darwin" -}}
{{ if and (not .unRootMode) (eq .chezmoi.os "darwin") -}}
#!/bin/sh
# Install Homebrew

View File

@ -1,7 +1,21 @@
{{ if eq .chezmoi.os "linux" -}}
{{/* ---- 安裝腳本 ------------------------------------------------------- */ -}}
#!/bin/bash
{{/* **** unRoot Mode *************************************************** */ -}}
{{/* 如果強制設定unRoot */}}
{{/* 或是沒有.chezmoi.osRelease.id因為環境有可能是Synology極精簡環境直接視同unRoot Mode處理 */}}
{{ if or .unRootMode (not (hasKey .chezmoi.osRelease "id")) -}}
{{/* 部份已由.chezmoiexternal.toml處理了 */ -}}
{{/* 其他自訂手動安裝腳本: */ -}}
{{/* 手動安裝 eza */ -}}
# if command -v eza &> /dev/null; then
#
# fi
{{/* **** Root Mode ***************************************************** */ -}}
{{ else -}}
{{/* ==== Debian ======================================================== */ -}}
{{ if or (eq .chezmoi.osRelease.id "debian") (eq .chezmoi.osRelease.id "ubuntu") -}}
@ -57,7 +71,7 @@ fi
rm -rf lazygit.tar.gz lazygit
{{ end -}}
{{ end }}
{{ end }} {{/* if or (eq .chezmoi.osRelease.id "debian") (eq .chezmoi.osRelease.id "ubuntu") */}}
{{/* ==== Arch Linux / Manjaro ========================================== */ -}}
{{ if or (eq .chezmoi.osRelease.id "manjaro") (eq .chezmoi.osRelease.id "arch") -}}
@ -194,6 +208,8 @@ if [[ ${#to_install_aur[@]} -gt 0 ]]; then
echo " - Installing missing AUR packages via yay: ${to_install_aur[@]}"
yay -S --noconfirm "${to_install_aur[@]}"
fi
{{ end -}}
{{ end -}} {{/* if or (eq .chezmoi.osRelease.id "manjaro") (eq .chezmoi.osRelease.id "arch") */}}
{{ end -}}
{{ end -}} {{/* else .unRootMode */}}
{{ end -}} {{/* if eq .chezmoi.os "linux" */}}