From 8853a8939aaff2e7cd6ef3af3804dc0567744f03 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Mon, 2 Mar 2026 11:39:18 -0500 Subject: [PATCH] [bin] On bootstrap, hide directories --- .gitignore | 2 +- bin/.local/bin/bootstrap.sh | 25 ++++++++++++++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 1e4fd60..960a0a9 100644 --- a/.gitignore +++ b/.gitignore @@ -70,7 +70,7 @@ _fake* fish/.config/fish/conf.d/virtualfish-loader.fish fish/.config/fish/functions/fzf_key_bindings.fish default.target.wants -/bin/.bin/Microsoft Bing for Safari.app/ +bin/.local/bin/git-cu /launchd/Library/LaunchAgents/com.microsoft.msbwapp.plist /launchd/Library/LaunchAgents/com.microsoft.msbwupdater.plist Bing Wallpaper1.1.3.app diff --git a/bin/.local/bin/bootstrap.sh b/bin/.local/bin/bootstrap.sh index 94b9975..442b954 100755 --- a/bin/.local/bin/bootstrap.sh +++ b/bin/.local/bin/bootstrap.sh @@ -8,6 +8,7 @@ DOTFILES_REPO="https://code.lab.unbl.ink/secstate/dotfiles" DOTFILES_DIR="${DOTFILES_DIR:-$HOME/.dotfiles}" OMZ_DIR="${ZSH:-$HOME/.oh-my-zsh}" DOOM_DIR="${DOOM_DIR:-$HOME/.emacs.d}" +BACKUP_DIR="$HOME/.backup" OS="$(uname -s)" PLATFORM="" @@ -55,7 +56,7 @@ fi # -------- Install basics (git, stow, zsh, curl, make) -------- install_arch() { 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 asdf } install_fedora() { @@ -78,7 +79,7 @@ install_macos() { log "Installing prerequisites (macOS via brew)..." brew update - brew install git stow zsh curl gnu-make + brew install git stow zsh curl gnu-make asdf } install_freebsd() { @@ -114,9 +115,23 @@ elif [[ "$PLATFORM" == "macos" ]]; then fi log "Backing up existing files" -(cd ~ && mv .zshrc .zshrc.bak) -(cd ~ && mv .bashrc .bashrc.bak) -(cd ~ && mv .config/gtk-3.0 .config/gtk-3.0.bak) +mkdir -p "$BACKUP_DIR" + +(cd ~ && mv .zshrc "$BACKUP_DIR/") +(cd ~ && mv .bashrc "$BACKUP_DIR/") +(cd ~ && mv .config/gtk-3.0 "$BACKUP_DIR/") + +log "Moving empty XDG user directories to .backup" +if [[ "$PLATFORM" != "macos" ]]; then + for dir in Desktop Documents Downloads Music Pictures Public Templates Videos; do + target="$HOME/$dir" + if [[ -d "$target" ]]; then + if [[ -z "$(ls -A "$target" 2>/dev/null)" ]]; then + mv "$target" "$BACKUP_DIR/" + fi + fi + done +fi log "Running $MAKE_CMD in dotfiles repo..." (cd "$DOTFILES_DIR" && "$MAKE_CMD")