[bin] Cleaning up bootstrap and setup scripts
This commit is contained in:
@ -14,78 +14,78 @@ PLATFORM=""
|
|||||||
|
|
||||||
# -------- Detect platform --------
|
# -------- Detect platform --------
|
||||||
if [[ "$OS" == "Darwin" ]]; then
|
if [[ "$OS" == "Darwin" ]]; then
|
||||||
PLATFORM="macos"
|
PLATFORM="macos"
|
||||||
elif [[ "$OS" == "FreeBSD" ]]; then
|
elif [[ "$OS" == "FreeBSD" ]]; then
|
||||||
PLATFORM="freebsd"
|
PLATFORM="freebsd"
|
||||||
elif [[ "$OS" == "Linux" ]]; then
|
elif [[ "$OS" == "Linux" ]]; then
|
||||||
if [[ -r /etc/os-release ]]; then
|
if [[ -r /etc/os-release ]]; then
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
fi
|
fi
|
||||||
|
|
||||||
is_arch=0
|
is_arch=0
|
||||||
case "${ID:-}" in
|
case "${ID:-}" in
|
||||||
arch | endeavouros) is_arch=1 ;;
|
arch | endeavouros) is_arch=1 ;;
|
||||||
esac
|
esac
|
||||||
if [[ $is_arch -eq 0 && -n "${ID_LIKE:-}" ]] && echo "$ID_LIKE" | grep -qi arch; then
|
if [[ $is_arch -eq 0 && -n "${ID_LIKE:-}" ]] && echo "$ID_LIKE" | grep -qi arch; then
|
||||||
is_arch=1
|
is_arch=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
is_fedora=0
|
is_fedora=0
|
||||||
case "${ID:-}" in
|
case "${ID:-}" in
|
||||||
fedora) is_fedora=1 ;;
|
fedora) is_fedora=1 ;;
|
||||||
esac
|
esac
|
||||||
if [[ $is_fedora -eq 0 && -n "${ID_LIKE:-}" ]] && echo "$ID_LIKE" | grep -qiE 'fedora|rhel'; then
|
if [[ $is_fedora -eq 0 && -n "${ID_LIKE:-}" ]] && echo "$ID_LIKE" | grep -qiE 'fedora|rhel'; then
|
||||||
is_fedora=1
|
is_fedora=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $is_arch -eq 1 ]]; then
|
if [[ $is_arch -eq 1 ]]; then
|
||||||
PLATFORM="arch"
|
PLATFORM="arch"
|
||||||
elif [[ $is_fedora -eq 1 ]]; then
|
elif [[ $is_fedora -eq 1 ]]; then
|
||||||
PLATFORM="fedora"
|
PLATFORM="fedora"
|
||||||
else
|
else
|
||||||
echo "Unsupported Linux distro (ID=${ID:-unknown}, ID_LIKE=${ID_LIKE:-unknown})."
|
echo "Unsupported Linux distro (ID=${ID:-unknown}, ID_LIKE=${ID_LIKE:-unknown})."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Unsupported OS: $OS"
|
echo "Unsupported OS: $OS"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# -------- Install basics (git, stow, zsh, curl, make) --------
|
# -------- Install basics (git, stow, zsh, curl, make) --------
|
||||||
install_arch() {
|
install_arch() {
|
||||||
log "Installing prerequisites (Arch/EndeavourOS)..."
|
log "Installing prerequisites (Arch/EndeavourOS)..."
|
||||||
sudo pacman -Sy --needed --noconfirm git stow zsh curl make openssh
|
sudo pacman -Sy --needed --noconfirm git stow zsh curl make openssh
|
||||||
}
|
}
|
||||||
|
|
||||||
install_fedora() {
|
install_fedora() {
|
||||||
log "Installing prerequisites (Fedora)..."
|
log "Installing prerequisites (Fedora)..."
|
||||||
sudo dnf install -y git stow zsh curl make openssh-clients
|
sudo dnf install -y git stow zsh curl make openssh-clients
|
||||||
}
|
}
|
||||||
|
|
||||||
install_macos() {
|
install_macos() {
|
||||||
log "Ensuring Homebrew..."
|
log "Ensuring Homebrew..."
|
||||||
if ! have brew; then
|
if ! have brew; then
|
||||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# shellenv for both Apple Silicon and Intel
|
# shellenv for both Apple Silicon and Intel
|
||||||
if [[ -x /opt/homebrew/bin/brew ]]; then
|
if [[ -x /opt/homebrew/bin/brew ]]; then
|
||||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||||
elif [[ -x /usr/local/bin/brew ]]; then
|
elif [[ -x /usr/local/bin/brew ]]; then
|
||||||
eval "$(/usr/local/bin/brew shellenv)"
|
eval "$(/usr/local/bin/brew shellenv)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "Installing prerequisites (macOS via brew)..."
|
log "Installing prerequisites (macOS via brew)..."
|
||||||
brew update
|
brew update
|
||||||
brew install git stow zsh curl gnu-make
|
brew install git stow zsh curl gnu-make
|
||||||
}
|
}
|
||||||
|
|
||||||
install_freebsd() {
|
install_freebsd() {
|
||||||
log "Installing prerequisites (FreeBSD)..."
|
log "Installing prerequisites (FreeBSD)..."
|
||||||
sudo pkg update -f
|
sudo pkg update -f
|
||||||
# gmake is GNU make; stow is stow; git/curl/zsh are available
|
# gmake is GNU make; stow is stow; git/curl/zsh are available
|
||||||
sudo pkg install -y git stow zsh curl gmake
|
sudo pkg install -y git stow zsh curl gmake
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$PLATFORM" in
|
case "$PLATFORM" in
|
||||||
@ -97,20 +97,20 @@ esac
|
|||||||
|
|
||||||
# -------- Clone/update dotfiles --------
|
# -------- Clone/update dotfiles --------
|
||||||
if [[ -d "$DOTFILES_DIR/.git" ]]; then
|
if [[ -d "$DOTFILES_DIR/.git" ]]; then
|
||||||
log "Updating dotfiles in $DOTFILES_DIR..."
|
log "Updating dotfiles in $DOTFILES_DIR..."
|
||||||
git -C "$DOTFILES_DIR" pull --rebase
|
git -C "$DOTFILES_DIR" pull --rebase || log "Warning: could not update dotfiles, continuing..."
|
||||||
else
|
else
|
||||||
log "Cloning dotfiles to $DOTFILES_DIR..."
|
log "Cloning dotfiles to $DOTFILES_DIR..."
|
||||||
git clone "$DOTFILES_REPO" "$DOTFILES_DIR"
|
git clone "$DOTFILES_REPO" "$DOTFILES_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# -------- Build/apply dotfiles (make vs gmake) --------
|
# -------- Build/apply dotfiles (make vs gmake) --------
|
||||||
MAKE_CMD="make"
|
MAKE_CMD="make"
|
||||||
if [[ "$PLATFORM" == "freebsd" ]]; then
|
if [[ "$PLATFORM" == "freebsd" ]]; then
|
||||||
MAKE_CMD="gmake"
|
MAKE_CMD="gmake"
|
||||||
elif [[ "$PLATFORM" == "macos" ]]; then
|
elif [[ "$PLATFORM" == "macos" ]]; then
|
||||||
# prefer GNU make if available (brew installs as gmake)
|
# prefer GNU make if available (brew installs as gmake)
|
||||||
if have gmake; then MAKE_CMD="gmake"; fi
|
if have gmake; then MAKE_CMD="gmake"; fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "Backing up existing files"
|
log "Backing up existing files"
|
||||||
@ -123,38 +123,24 @@ log "Running $MAKE_CMD in dotfiles repo..."
|
|||||||
|
|
||||||
# -------- oh-my-zsh --------
|
# -------- oh-my-zsh --------
|
||||||
if [[ -d "$OMZ_DIR" ]]; then
|
if [[ -d "$OMZ_DIR" ]]; then
|
||||||
log "oh-my-zsh already present at $OMZ_DIR"
|
log "oh-my-zsh already present at $OMZ_DIR"
|
||||||
else
|
else
|
||||||
log "Cloning oh-my-zsh..."
|
log "Cloning oh-my-zsh..."
|
||||||
git clone --depth=1 https://github.com/ohmyzsh/ohmyzsh "$OMZ_DIR"
|
git clone --depth=1 https://github.com/ohmyzsh/ohmyzsh "$OMZ_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# -------- Doom Emacs --------
|
# -------- Set zsh as default shell --------
|
||||||
if [[ -d "$DOOM_DIR/.git" ]]; then
|
log "Setting zsh as default shell..."
|
||||||
log "Doom Emacs already present at $DOOM_DIR (updating)..."
|
ZSH_PATH="$(command -v zsh)"
|
||||||
git -C "$DOOM_DIR" pull --rebase || true
|
case "$PLATFORM" in
|
||||||
elif [[ -e "$DOOM_DIR" ]]; then
|
macos)
|
||||||
log "Skipping Doom Emacs clone because $DOOM_DIR exists but is not a git repo."
|
sudo -u "$USER" chsh -s "$ZSH_PATH" || chsh -s "$ZSH_PATH"
|
||||||
log "Move it aside if you want to install Doom there."
|
;;
|
||||||
else
|
*)
|
||||||
log "Cloning Doom Emacs to $DOOM_DIR..."
|
sudo chsh -s "$ZSH_PATH" "$USER" || sudo usermod -s "$ZSH_PATH" "$USER" || chsh -s "$ZSH_PATH"
|
||||||
git clone --depth=1 https://github.com/doomemacs/doomemacs "$DOOM_DIR"
|
;;
|
||||||
fi
|
esac
|
||||||
|
|
||||||
# -------- Next steps --------
|
log "Please open a new shell or terminal so your shell config reloads."
|
||||||
log "Next steps"
|
|
||||||
cat <<'EOF'
|
|
||||||
1) Start a new shell (or open a new terminal) so shell config reloads.
|
|
||||||
|
|
||||||
2) If you want zsh as default:
|
|
||||||
- Linux: chsh -s $(command -v zsh)
|
|
||||||
- macOS: chsh -s /bin/zsh (or $(command -v zsh) if preferred)
|
|
||||||
- FreeBSD: chsh -s $(command -v zsh)
|
|
||||||
|
|
||||||
3) Doom Emacs:
|
|
||||||
~/.emacs.d/bin/doom install
|
|
||||||
(And later, when you change config: ~/.emacs.d/bin/doom sync)
|
|
||||||
|
|
||||||
EOF
|
|
||||||
|
|
||||||
log "Done."
|
log "Done."
|
||||||
|
|||||||
@ -9,151 +9,151 @@ PLATFORM=""
|
|||||||
|
|
||||||
# -------- OS detection --------
|
# -------- OS detection --------
|
||||||
if [[ "$OS" == "Darwin" ]]; then
|
if [[ "$OS" == "Darwin" ]]; then
|
||||||
PLATFORM="macos"
|
PLATFORM="macos"
|
||||||
elif [[ "$OS" == "FreeBSD" ]]; then
|
elif [[ "$OS" == "FreeBSD" ]]; then
|
||||||
PLATFORM="freebsd"
|
PLATFORM="freebsd"
|
||||||
elif [[ "$OS" == "Linux" ]]; then
|
elif [[ "$OS" == "Linux" ]]; then
|
||||||
if [[ -r /etc/os-release ]]; then
|
if [[ -r /etc/os-release ]]; then
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
fi
|
fi
|
||||||
|
|
||||||
is_arch=0
|
is_arch=0
|
||||||
case "${ID:-}" in
|
case "${ID:-}" in
|
||||||
arch | endeavouros) is_arch=1 ;;
|
arch | endeavouros) is_arch=1 ;;
|
||||||
esac
|
esac
|
||||||
if [[ $is_arch -eq 0 && -n "${ID_LIKE:-}" ]] && echo "$ID_LIKE" | grep -qi arch; then
|
if [[ $is_arch -eq 0 && -n "${ID_LIKE:-}" ]] && echo "$ID_LIKE" | grep -qi arch; then
|
||||||
is_arch=1
|
is_arch=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
is_fedora=0
|
is_fedora=0
|
||||||
case "${ID:-}" in
|
case "${ID:-}" in
|
||||||
fedora) is_fedora=1 ;;
|
fedora) is_fedora=1 ;;
|
||||||
esac
|
esac
|
||||||
if [[ $is_fedora -eq 0 && -n "${ID_LIKE:-}" ]] && echo "$ID_LIKE" | grep -qiE 'fedora|rhel'; then
|
if [[ $is_fedora -eq 0 && -n "${ID_LIKE:-}" ]] && echo "$ID_LIKE" | grep -qiE 'fedora|rhel'; then
|
||||||
is_fedora=1
|
is_fedora=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $is_arch -eq 1 ]]; then
|
if [[ $is_arch -eq 1 ]]; then
|
||||||
PLATFORM="arch"
|
PLATFORM="arch"
|
||||||
elif [[ $is_fedora -eq 1 ]]; then
|
elif [[ $is_fedora -eq 1 ]]; then
|
||||||
PLATFORM="fedora"
|
PLATFORM="fedora"
|
||||||
else
|
else
|
||||||
echo "Unsupported Linux distro (ID=${ID:-unknown}, ID_LIKE=${ID_LIKE:-unknown})."
|
echo "Unsupported Linux distro (ID=${ID:-unknown}, ID_LIKE=${ID_LIKE:-unknown})."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Unsupported OS: $OS"
|
echo "Unsupported OS: $OS"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# -------- Helpers --------
|
# -------- Helpers --------
|
||||||
install_pacman() {
|
install_pacman() {
|
||||||
local pkgs=("$@")
|
local pkgs=("$@")
|
||||||
log "pacman install: ${pkgs[*]}"
|
log "pacman install: ${pkgs[*]}"
|
||||||
sudo pacman -Sy --needed --noconfirm "${pkgs[@]}"
|
sudo pacman -Sy --needed --noconfirm "${pkgs[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
install_dnf() {
|
install_dnf() {
|
||||||
local pkgs=("$@")
|
local pkgs=("$@")
|
||||||
log "dnf install: ${pkgs[*]}"
|
log "dnf install: ${pkgs[*]}"
|
||||||
sudo dnf install -y "${pkgs[@]}"
|
sudo dnf install -y "${pkgs[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
brew_install() {
|
brew_install() {
|
||||||
local pkgs=("$@")
|
local pkgs=("$@")
|
||||||
log "brew install: ${pkgs[*]}"
|
log "brew install: ${pkgs[*]}"
|
||||||
brew install "${pkgs[@]}"
|
brew install "${pkgs[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
brew_cask() {
|
brew_cask() {
|
||||||
local pkgs=("$@")
|
local pkgs=("$@")
|
||||||
log "brew install --cask: ${pkgs[*]}"
|
log "brew install --cask: ${pkgs[*]}"
|
||||||
brew install --cask "${pkgs[@]}"
|
brew install --cask "${pkgs[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
install_pkg() {
|
install_pkg() {
|
||||||
local pkgs=("$@")
|
local pkgs=("$@")
|
||||||
log "pkg install: ${pkgs[*]}"
|
log "pkg install: ${pkgs[*]}"
|
||||||
sudo pkg install -y "${pkgs[@]}"
|
sudo pkg install -y "${pkgs[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Best-effort install loops (skip missing packages cleanly)
|
# Best-effort install loops (skip missing packages cleanly)
|
||||||
dnf_install_best_effort() {
|
dnf_install_best_effort() {
|
||||||
local pkgs=("$@")
|
local pkgs=("$@")
|
||||||
for p in "${pkgs[@]}"; do
|
for p in "${pkgs[@]}"; do
|
||||||
if sudo dnf info "$p" >/dev/null 2>&1; then
|
if sudo dnf info "$p" >/dev/null 2>&1; then
|
||||||
install_dnf "$p"
|
install_dnf "$p"
|
||||||
else
|
else
|
||||||
log "Skipping (dnf not found): $p"
|
log "Skipping (dnf not found): $p"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
pacman_install_best_effort() {
|
pacman_install_best_effort() {
|
||||||
local pkgs=("$@")
|
local pkgs=("$@")
|
||||||
for p in "${pkgs[@]}"; do
|
for p in "${pkgs[@]}"; do
|
||||||
if pacman -Si "$p" >/dev/null 2>&1; then
|
if pacman -Si "$p" >/dev/null 2>&1; then
|
||||||
install_pacman "$p"
|
install_pacman "$p"
|
||||||
else
|
else
|
||||||
log "Skipping (pacman not found): $p"
|
log "Skipping (pacman not found): $p"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_install_best_effort() {
|
pkg_install_best_effort() {
|
||||||
local pkgs=("$@")
|
local pkgs=("$@")
|
||||||
for p in "${pkgs[@]}"; do
|
for p in "${pkgs[@]}"; do
|
||||||
if pkg search -q "^${p}$" >/dev/null 2>&1; then
|
if pkg search -q "^${p}$" >/dev/null 2>&1; then
|
||||||
install_pkg "$p"
|
install_pkg "$p"
|
||||||
else
|
else
|
||||||
log "Skipping (pkg not found): $p"
|
log "Skipping (pkg not found): $p"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
aur_install_if_possible() {
|
aur_install_if_possible() {
|
||||||
local pkgs=("$@")
|
local pkgs=("$@")
|
||||||
if have yay; then
|
if have yay; then
|
||||||
log "AUR install via yay: ${pkgs[*]}"
|
log "AUR install via yay: ${pkgs[*]}"
|
||||||
yay -S --needed --noconfirm "${pkgs[@]}"
|
yay -S --needed --noconfirm "${pkgs[@]}"
|
||||||
else
|
else
|
||||||
log "Skipping AUR packages (yay not found): ${pkgs[*]}"
|
log "Skipping AUR packages (yay not found): ${pkgs[*]}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_opencode() {
|
install_opencode() {
|
||||||
if have opencode; then
|
if have opencode; then
|
||||||
log "opencode already installed"
|
log "opencode already installed"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if have npm; then
|
if have npm; then
|
||||||
log "Installing opencode via npm..."
|
log "Installing opencode via npm..."
|
||||||
npm install -g opencode-ai
|
npm install -g opencode-ai
|
||||||
else
|
else
|
||||||
log "Skipping opencode (npm not found)"
|
log "Skipping opencode (npm not found)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
ensure_brew() {
|
ensure_brew() {
|
||||||
if have brew; then return 0; fi
|
if have brew; then return 0; fi
|
||||||
log "Homebrew not found; installing Homebrew..."
|
log "Homebrew not found; installing Homebrew..."
|
||||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||||
|
|
||||||
if [[ -x /opt/homebrew/bin/brew ]]; then
|
if [[ -x /opt/homebrew/bin/brew ]]; then
|
||||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||||
elif [[ -x /usr/local/bin/brew ]]; then
|
elif [[ -x /usr/local/bin/brew ]]; then
|
||||||
eval "$(/usr/local/bin/brew shellenv)"
|
eval "$(/usr/local/bin/brew shellenv)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
ensure_flathub() {
|
ensure_flathub() {
|
||||||
if ! have flatpak; then
|
if ! have flatpak; then
|
||||||
log "flatpak not installed; skipping flathub apps."
|
log "flatpak not installed; skipping flathub apps."
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
log "Ensuring Flathub remote exists..."
|
log "Ensuring Flathub remote exists..."
|
||||||
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||||
}
|
}
|
||||||
|
|
||||||
# -------- Package sets (portable intent) --------
|
# -------- Package sets (portable intent) --------
|
||||||
@ -169,52 +169,52 @@ UTILS_LINUX=(gnuplot graphviz shfmt shellcheck pandoc)
|
|||||||
DESKTOP_LINUX=(kitty alacritty dino syncthing)
|
DESKTOP_LINUX=(kitty alacritty dino syncthing)
|
||||||
|
|
||||||
FEDORA_EXTRAS=(
|
FEDORA_EXTRAS=(
|
||||||
gnome-extensions-app
|
gnome-extensions-app
|
||||||
gnome-tweaks
|
gnome-tweaks
|
||||||
spice-vdagent
|
spice-vdagent
|
||||||
kernel-modules-extra
|
kernel-modules-extra
|
||||||
pinentry-tty
|
pinentry-tty
|
||||||
NetworkManager-openvpn-gnome
|
NetworkManager-openvpn-gnome
|
||||||
openvpn
|
openvpn
|
||||||
openvpn3-client
|
openvpn3-client
|
||||||
libpq-devel
|
libpq-devel
|
||||||
postgresql
|
postgresql
|
||||||
pass-otp
|
pass-otp
|
||||||
chromium
|
chromium
|
||||||
google-chrome-stable
|
google-chrome-stable
|
||||||
)
|
)
|
||||||
|
|
||||||
ARCH_EXTRAS=(
|
ARCH_EXTRAS=(
|
||||||
gnome-extensions-app
|
gnome-extensions-app
|
||||||
gnome-tweaks
|
gnome-tweaks
|
||||||
spice-vdagent
|
spice-vdagent
|
||||||
linux-headers
|
linux-headers
|
||||||
pinentry
|
pinentry
|
||||||
networkmanager-openvpn
|
networkmanager-openvpn
|
||||||
openvpn
|
openvpn
|
||||||
postgresql-libs
|
postgresql-libs
|
||||||
postgresql
|
postgresql
|
||||||
pass-otp
|
pass-otp
|
||||||
chromium
|
chromium
|
||||||
snapcast
|
snapcast
|
||||||
)
|
)
|
||||||
|
|
||||||
MAC_BREW_PKGS=(
|
MAC_BREW_PKGS=(
|
||||||
fzf direnv stow pass just
|
fzf direnv stow pass just
|
||||||
fd editorconfig git
|
fd editorconfig git
|
||||||
cmake libtool
|
cmake libtool
|
||||||
gnuplot graphviz shfmt shellcheck pandoc
|
gnuplot graphviz shfmt shellcheck pandoc
|
||||||
postgresql
|
postgresql
|
||||||
syncthing
|
syncthing
|
||||||
pinentry-mac
|
pinentry-mac
|
||||||
)
|
)
|
||||||
|
|
||||||
MAC_CASKS=(
|
MAC_CASKS=(
|
||||||
kitty
|
kitty
|
||||||
alacritty
|
alacritty
|
||||||
slack
|
slack
|
||||||
google-chrome
|
google-chrome
|
||||||
chromium
|
chromium
|
||||||
)
|
)
|
||||||
|
|
||||||
# FreeBSD name mapping (best-effort)
|
# FreeBSD name mapping (best-effort)
|
||||||
@ -235,85 +235,97 @@ FREEBSD_MISC=(postgresql16-client syncthing)
|
|||||||
# -------- Install per-platform --------
|
# -------- Install per-platform --------
|
||||||
case "$PLATFORM" in
|
case "$PLATFORM" in
|
||||||
fedora)
|
fedora)
|
||||||
log "Platform: Fedora. Refreshing + upgrading..."
|
log "Platform: Fedora. Refreshing + upgrading..."
|
||||||
sudo dnf -y upgrade --refresh || true
|
sudo dnf -y upgrade --refresh || true
|
||||||
|
|
||||||
install_dnf "${CORE_CLI[@]}" "${EXTRA_CLI[@]}" || true
|
install_dnf "${CORE_CLI[@]}" "${EXTRA_CLI[@]}" || true
|
||||||
dnf_install_best_effort "${DEV_TOOLS_LINUX[@]}"
|
dnf_install_best_effort "${DEV_TOOLS_LINUX[@]}"
|
||||||
dnf_install_best_effort "${UTILS_LINUX[@]}"
|
dnf_install_best_effort "${UTILS_LINUX[@]}"
|
||||||
dnf_install_best_effort "${DESKTOP_LINUX[@]}"
|
dnf_install_best_effort "${DESKTOP_LINUX[@]}"
|
||||||
dnf_install_best_effort "${FEDORA_EXTRAS[@]}"
|
dnf_install_best_effort "${FEDORA_EXTRAS[@]}"
|
||||||
|
|
||||||
ensure_flathub
|
ensure_flathub
|
||||||
if have flatpak; then
|
if have flatpak; then
|
||||||
log "Optional: Slack via Flatpak"
|
log "Optional: Slack via Flatpak"
|
||||||
sudo flatpak install -y flathub com.slack.Slack || true
|
sudo flatpak install -y flathub com.slack.Slack || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
install_opencode
|
install_opencode
|
||||||
;;
|
|
||||||
|
log "Final system upgrade..."
|
||||||
|
sudo dnf -y upgrade
|
||||||
|
;;
|
||||||
|
|
||||||
arch)
|
arch)
|
||||||
log "Platform: EndeavourOS/Arch. Updating package databases..."
|
log "Platform: EndeavourOS/Arch. Updating package databases..."
|
||||||
sudo pacman -Sy --noconfirm
|
sudo pacman -Sy --noconfirm
|
||||||
|
|
||||||
install_pacman "${CORE_CLI[@]}" "${EXTRA_CLI[@]}"
|
install_pacman "${CORE_CLI[@]}" "${EXTRA_CLI[@]}"
|
||||||
pacman_install_best_effort "${DEV_TOOLS_LINUX[@]}"
|
pacman_install_best_effort "${DEV_TOOLS_LINUX[@]}"
|
||||||
pacman_install_best_effort "${UTILS_LINUX[@]}"
|
pacman_install_best_effort "${UTILS_LINUX[@]}"
|
||||||
pacman_install_best_effort "${DESKTOP_LINUX[@]}"
|
pacman_install_best_effort "${DESKTOP_LINUX[@]}"
|
||||||
pacman_install_best_effort "${ARCH_EXTRAS[@]}"
|
pacman_install_best_effort "${ARCH_EXTRAS[@]}"
|
||||||
|
|
||||||
aur_install_if_possible google-chrome slack-desktop || true
|
aur_install_if_possible google-chrome slack-desktop || true
|
||||||
|
|
||||||
install_opencode
|
log "Final system upgrade..."
|
||||||
;;
|
sudo pacman -Syu --noconfirm
|
||||||
|
|
||||||
|
install_opencode
|
||||||
|
;;
|
||||||
|
|
||||||
macos)
|
macos)
|
||||||
log "Platform: macOS. Ensuring Homebrew..."
|
log "Platform: macOS. Ensuring Homebrew..."
|
||||||
ensure_brew
|
ensure_brew
|
||||||
|
|
||||||
log "Updating Homebrew..."
|
log "Updating Homebrew..."
|
||||||
brew update
|
brew update
|
||||||
|
|
||||||
brew_install "${MAC_BREW_PKGS[@]}"
|
brew_install "${MAC_BREW_PKGS[@]}"
|
||||||
brew_cask "${MAC_CASKS[@]}" || true
|
brew_cask "${MAC_CASKS[@]}" || true
|
||||||
|
|
||||||
if [[ -f "$(brew --prefix)/opt/fzf/install" ]]; then
|
if [[ -f "$(brew --prefix)/opt/fzf/install" ]]; then
|
||||||
log "Tip: run fzf install helper if you want keybindings/completion:"
|
log "Tip: run fzf install helper if you want keybindings/completion:"
|
||||||
echo " $(brew --prefix)/opt/fzf/install"
|
echo " $(brew --prefix)/opt/fzf/install"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
install_opencode
|
install_opencode
|
||||||
;;
|
|
||||||
|
log "Final system upgrade..."
|
||||||
|
brew upgrade
|
||||||
|
;;
|
||||||
|
|
||||||
freebsd)
|
freebsd)
|
||||||
log "Platform: FreeBSD. Updating pkg metadata..."
|
log "Platform: FreeBSD. Updating pkg metadata..."
|
||||||
sudo pkg update -f
|
sudo pkg update -f
|
||||||
|
|
||||||
# Ensure basic SSL certs exist for fetches/tools that need it
|
# Ensure basic SSL certs exist for fetches/tools that need it
|
||||||
pkg_install_best_effort ca_root_nss || true
|
pkg_install_best_effort ca_root_nss || true
|
||||||
|
|
||||||
# Core CLI tools you asked for
|
# Core CLI tools you asked for
|
||||||
pkg_install_best_effort "${FREEBSD_CORE[@]}"
|
pkg_install_best_effort "${FREEBSD_CORE[@]}"
|
||||||
|
|
||||||
# Extras + dev + utilities
|
# Extras + dev + utilities
|
||||||
pkg_install_best_effort "${FREEBSD_EXTRA[@]}"
|
pkg_install_best_effort "${FREEBSD_EXTRA[@]}"
|
||||||
pkg_install_best_effort "${FREEBSD_DEV[@]}"
|
pkg_install_best_effort "${FREEBSD_DEV[@]}"
|
||||||
pkg_install_best_effort "${FREEBSD_UTILS[@]}"
|
pkg_install_best_effort "${FREEBSD_UTILS[@]}"
|
||||||
|
|
||||||
# pass needs gpg + pinentry
|
# pass needs gpg + pinentry
|
||||||
pkg_install_best_effort "${FREEBSD_SECURITY[@]}"
|
pkg_install_best_effort "${FREEBSD_SECURITY[@]}"
|
||||||
|
|
||||||
# Optional stuff from your history where it makes sense
|
# Optional stuff from your history where it makes sense
|
||||||
pkg_install_best_effort "${FREEBSD_MISC[@]}"
|
pkg_install_best_effort "${FREEBSD_MISC[@]}"
|
||||||
|
|
||||||
log "FreeBSD notes:"
|
log "Final system upgrade..."
|
||||||
cat <<'EOF'
|
sudo pkg upgrade -y
|
||||||
|
|
||||||
|
log "FreeBSD notes:"
|
||||||
|
cat <<'EOF'
|
||||||
- 'pass' is installed as 'password-store' on FreeBSD; command is still: pass
|
- 'pass' is installed as 'password-store' on FreeBSD; command is still: pass
|
||||||
- Build tools often use gmake (GNU make). If you compile from source, try gmake.
|
- Build tools often use gmake (GNU make). If you compile from source, try gmake.
|
||||||
- GUI apps (kitty/alacritty/slack/chrome) are not installed here by default.
|
- GUI apps (kitty/alacritty/slack/chrome) are not installed here by default.
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# -------- Post-install notes --------
|
# -------- Post-install notes --------
|
||||||
@ -333,3 +345,21 @@ cat <<'EOF'
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
log "Done."
|
log "Done."
|
||||||
|
|
||||||
|
# -------- Doom Emacs --------
|
||||||
|
DOOM_DIR="${DOOM_DIR:-$HOME/.emacs.d}"
|
||||||
|
if [[ -d "$DOOM_DIR/.git" ]]; then
|
||||||
|
log "Doom Emacs already present at $DOOM_DIR (updating)..."
|
||||||
|
git -C "$DOOM_DIR" pull --rebase || true
|
||||||
|
elif [[ -e "$DOOM_DIR" ]]; then
|
||||||
|
log "Skipping Doom Emacs clone because $DOOM_DIR exists but is not a git repo."
|
||||||
|
log "Move it aside if you want to install Doom there."
|
||||||
|
else
|
||||||
|
log "Cloning Doom Emacs to $DOOM_DIR..."
|
||||||
|
git clone --depth=1 https://github.com/doomemacs/doomemacs "$DOOM_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -d "$DOOM_DIR" ]]; then
|
||||||
|
log "Installing Doom Emacs..."
|
||||||
|
"$DOOM_DIR/bin/doom" install
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user