add auto-install scripts for fedora39

This commit is contained in:
reeink 2024-03-03 21:41:52 +08:00
parent 2174f5cd8f
commit ee2bf02772
No known key found for this signature in database
2 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,14 @@
[packages.fedora39]
dnf.pkgs = [
"eza",
"thefuck",
"micromamba",
"zoxide"
]
brew.pkgs = [
"atuin",
"fnm",
"yazi",
"zsh-syntax-highlighting",
"zsh-autosuggestions"
]

View file

@ -0,0 +1,40 @@
{{- if (and (and (eq .chezmoi.os "linux")
(eq .chezmoi.osRelease.id "fedora"))
(eq .chezmoi.osRelease.versionID "39")) -}}
#!/bin/bash
# fedora39 packages hash: {{ .packages.fedora39 | quote | sha256sum }}
bold=$(tput bold)
normal=$(tput sgr0)
function custom_echo() {
echo -e "${bold}$1${normal}"
}
{{ if gt (len .packages.fedora39.dnf.pkgs) 0 -}}
# Install dnf packages
custom_echo "[Info] Installing dnf packages... Please input your password if requested."
sudo dnf install {{ range .packages.fedora39.dnf.pkgs }} {{- . | quote }} {{ end }}
{{- end }}
{{ if gt (len .packages.fedora39.brew.pkgs) 0 -}}
# Check if Homebrew is installed
if ! command -v brew &> /dev/null; then
custom_echo "[Info] Homebrew is not installed. Installing..."
# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Check if installation was successful
if ! command -v brew &> /dev/null; then
custom_echo "[Error] Failed to install Homebrew. Exiting."
exit 1
fi
custom_echo "[Success] Homebrew has been successfully installed."
else
custom_echo "[Info] Homebrew is already installed."
fi
# Install Homebrew packages
custom_echo "[Info] Installing homebrew packages..."
brew install {{ range .packages.fedora39.brew.pkgs }} {{- . | quote }} {{ end }}
{{- end }}
{{- end }}