Compare commits

..
6 Commits
Author SHA1 Message Date
tgrosinger ec4c0437c4 Install: Add bubblewrap on server 2026-08-26 20:44:43 -07:00
tgrosinger 908936c360 Install: Only create temporary links if they are missing 2026-08-26 20:34:52 -07:00
tgrosinger f5f7acacb6 Bash: Add mise to path 2026-08-26 19:19:57 -07:00
tgrosinger d324c13f02 Install: Link shell configs by hand to bootstrap brew
brew is not on the PATH until the shell configs are stowed, but stow is
installed via brew. Create the .bashrc and fish config symlinks stow would
create so this script and new shells can find brew, and fail with guidance if
the current shell still lacks it after linking.
2026-08-26 19:19:43 -07:00
tgrosinger 1717fd0ef0 Install: Drop the apt-get homebrew-deps branch
Build dependencies are only installed via dnf now; the Debian/Ubuntu apt-get
path and the unsupported-package-manager error are no longer needed.
2026-08-26 19:19:42 -07:00
tgrosinger 857465ccd9 Install: Add sudo preflight check
Both the distro package managers and the homebrew installer need sudo, so
fail early with instructions for granting temporary passwordless sudo rather
than partway through the run.
2026-08-26 19:19:42 -07:00
2 changed files with 73 additions and 7 deletions
+1
View File
@@ -89,6 +89,7 @@ if [[ -d ${HOME}/bin ]]; then
export PATH=$PATH:${HOME}/bin
fi
eval "$(mise activate bash)"
# Enable atuin
# https://docs.atuin.sh
+72 -7
View File
@@ -13,18 +13,67 @@
set -euo pipefail
link_shell_configs() {
# Manually create the symlinks that `stow` would create for the shell
# configs, without needing `stow`. This solves the chicken-and-egg problem
# below: `brew` is not on the PATH until these configs are in place, but
# `stow` is installed with `brew`.
#
# The link targets are relative and route through ~/.dotfiles. Note that
# stow resolves that symlink to its physical path, so it does NOT
# recognize these as its own -- ./run-stow.sh reports them as conflicts
# ("existing target is not owned by stow") and aborts the whole run.
# Remove them before stowing if you want stow to manage them instead.
if [ ! -d "${HOME}/.dotfiles" ]; then
echo "Cannot find dotfiles directory in user home." >&2
exit 1
fi
link_config() {
local link="$1" # path to create, relative to ${HOME}
local target="$2" # link contents, relative to the link's directory
# Only ever create a missing link. Anything already at this path -- a
# link stow made, a link from a previous run, or a real file the user
# wrote -- is left exactly as it is.
if [ -e "${HOME}/${link}" ] || [ -L "${HOME}/${link}" ]; then
echo "~/${link} already exists, leaving it alone"
return
fi
mkdir -p "$(dirname "${HOME}/${link}")"
ln -s "${target}" "${HOME}/${link}"
echo "Linked ~/${link} -> ${target}"
}
link_config .bashrc .dotfiles/home/.bashrc
link_config .config/fish ../.dotfiles/home/.config/fish
}
require_sudo() {
# Both the distro package managers and the homebrew installer need sudo.
if command -v sudo >/dev/null 2>&1; then
return
fi
echo "sudo is not installed or not on the PATH." >&2
echo "Become root (su -) and run visudo to temporarily grant this user" >&2
echo "passwordless sudo:" >&2
echo >&2
echo " $(id -un) ALL=(ALL) NOPASSWD: ALL" >&2
echo >&2
echo "Re-run this script, then remove that line with visudo when done." >&2
exit 1
}
install_common() {
# Packages installed on every machine (desktop and headless server).
require_sudo
# Install homebrew dependencies (dnf on Fedora, apt on Debian/Ubuntu).
if command -v dnf >/dev/null 2>&1; then
sudo dnf group install development-tools
elif command -v apt-get >/dev/null 2>&1; then
sudo apt-get update
sudo apt-get install -y build-essential procps curl file git
else
echo "No supported package manager (dnf/apt-get) found for homebrew deps" >&2
exit 1
fi
if command -v brew >/dev/null 2>&1; then
@@ -34,6 +83,20 @@ install_common() {
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
# NOTE: Chicken-and-egg issue. `brew` is not on the path until we run
# `stow`, but we install `stow` with `brew`. Link the shell configs by
# hand so the rest of this script (and new shells) can find `brew`.
link_shell_configs
# The shell configs above put brew on the PATH for new shells, but this
# already-running shell won't pick it up. Nothing below works without it.
if ! command -v brew >/dev/null 2>&1; then
echo "brew is not on the PATH." >&2
echo "The shell configs have been linked, so log out and back in (or start" >&2
echo "a new shell) to refresh the PATH, then re-run this script." >&2
exit 1
fi
# NOTE: Do not brew install anything with a dependency on node.
# Instead, use mise.
#
@@ -97,6 +160,8 @@ install_common() {
}
install_desktop() {
require_sudo
# Install flatpaks
flatpak install flathub com.github.jeromerobert.pdfarranger
flatpak install flathub fr.handbrake.ghb
@@ -148,7 +213,7 @@ install_server() {
#
# NOTE: Debian may lack the tmux-256color terminfo entry (it's in the
# ncurses-term package); install it if tmux complains about the terminal.
:
sudo apt install -y bubblewrap
}
main() {