diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2025-12-20 10:53:14 -0500 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2025-12-20 10:54:02 -0500 |
| commit | 7b6dbb921650e2a52929f025b67be57609fda6d4 (patch) | |
| tree | 895416312698cfe4ac61d4eed0f071d7743c0214 /shlib | |
| parent | Remove openbsd conditional in zsh (diff) | |
| download | dotfiles-7b6dbb921650e2a52929f025b67be57609fda6d4.zip | |
Rework dotfiles to *only* contain dotfiles
Diffstat (limited to 'shlib')
| -rw-r--r-- | shlib/bootstrap.sh | 63 | ||||
| -rw-r--r-- | shlib/homebrew.sh | 20 | ||||
| -rw-r--r-- | shlib/log.sh | 47 | ||||
| -rw-r--r-- | shlib/os.sh | 24 | ||||
| -rw-r--r-- | shlib/prompt.sh | 23 | ||||
| -rw-r--r-- | shlib/tmux.sh | 30 |
6 files changed, 0 insertions, 207 deletions
diff --git a/shlib/bootstrap.sh b/shlib/bootstrap.sh deleted file mode 100644 index 50be271..0000000 --- a/shlib/bootstrap.sh +++ /dev/null @@ -1,63 +0,0 @@ -# shellcheck shell=sh -[ -n "${DOTFILES_BOOTSTRAP_LOADED}" ] && return -readonly DOTFILES_BOOTSTRAP_LOADED=1 - -. "$(dirname "$0")/shlib/homebrew.sh" -. "$(dirname "$0")/shlib/log.sh" -. "$(dirname "$0")/shlib/prompt.sh" - -bootstrap_macos() { - if ! homebrew_is_installed; then - if prompt_for_confirmation "Homebrew not found. Would you like to install Homebrew?"; then - homebrew_install - else - log_error "Cannot continue without homebrew installed." - return 1 - fi - fi - - log_info "Found homebrew installation. Installing Brewfile.." - (cd macos/homebrew && brew bundle) - log_info "Brewfile successfully installed. Moving to linking dotfiles.." - - sudo ln -sf "$HOME/bin/get-password" /usr/local/bin/get-password - sudo ln -sf "$(which op)" /usr/local/bin/op -} - -bootstrap_linux_debian() { - sudo apt-get install curl - if ! command -v op; then - _install_1password_cli - fi - if ! command -v ghostty; then - _install_ghostty - fi - - log_info "Installing debian packages..." - _linux_debian_packages="$(cat "$(dirname "$0")/linux-debian/packages.txt" | tr '\n' ' ')" - # shellcheck disable=SC2086 - sudo apt-get install --assume-yes $_linux_debian_packages - chsh -s $(which zsh) "$USER" -} - -_install_1password_cli() { - # https://developer.1password.com/docs/cli/get-started/ - curl -sS https://downloads.1password.com/linux/keys/1password.asc | \ - sudo gpg --dearmor --output /usr/share/keyrings/1password-archive-keyring.gpg && \ - echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/1password-archive-keyring.gpg] https://downloads.1password.com/linux/debian/$(dpkg --print-architecture) stable main" | \ - sudo tee /etc/apt/sources.list.d/1password.list && \ - sudo mkdir -p /etc/debsig/policies/AC2D62742012EA22/ && \ - curl -sS https://downloads.1password.com/linux/debian/debsig/1password.pol | \ - sudo tee /etc/debsig/policies/AC2D62742012EA22/1password.pol && \ - sudo mkdir -p /usr/share/debsig/keyrings/AC2D62742012EA22 && \ - curl -sS https://downloads.1password.com/linux/keys/1password.asc | \ - sudo gpg --dearmor --output /usr/share/debsig/keyrings/AC2D62742012EA22/debsig.gpg && \ - sudo apt update && sudo apt install 1password-cli -} - -_install_ghostty() { - curl -sS https://debian.griffo.io/EA0F721D231FDD3A0A17B9AC7808B4DD62C41256.asc | sudo gpg --dearmor --yes -o /etc/apt/trusted.gpg.d/debian.griffo.io.gpg - echo "deb https://debian.griffo.io/apt $(lsb_release -sc 2>/dev/null) main" | sudo tee /etc/apt/sources.list.d/debian.griffo.io.list - sudo apt update - sudo apt intall ghostty -} diff --git a/shlib/homebrew.sh b/shlib/homebrew.sh deleted file mode 100644 index a00ad73..0000000 --- a/shlib/homebrew.sh +++ /dev/null @@ -1,20 +0,0 @@ -# shellcheck shell=sh -[ -n "${DOTFILES_HOMEBREW_LOADED}" ] && return -readonly DOTFILES_HOMEBREW_LOADED=1 - -homebrew_is_installed() { - command -v brew >/dev/null 2>&1 -} - -# Installs homebrew and verifies the installation. -# -# If the install was not successful, exits with a -# 1 status code. -homebrew_install() { - /usr/bin/env bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - eval "$(/opt/homebrew/bin/brew shellenv)" - if ! command -v brew >/dev/null 2>&1; then - echo "Failed to install homebrew" - return 1 - fi -} diff --git a/shlib/log.sh b/shlib/log.sh deleted file mode 100644 index f2f8864..0000000 --- a/shlib/log.sh +++ /dev/null @@ -1,47 +0,0 @@ -# shellcheck shell=sh -[ -n "${DOTFILES_LOG_LOADED:-}" ] && return -readonly DOTFILES_LOG_LOADED=1 - -log_info() { - echo "[INFO] $*" >&2 -} - -log_error() { - echo "[ERROR] $*" >&2 -} - -log_warn() { - echo "[WARN] $*" >&2 -} - -log_success() { - echo "[SUCCESS] $*" >&2 -} - -log_debug() { - [ "${DEBUG:-}" = "true" ] && echo "[DEBUG] $*" >&2 -} - -log_newline() { - echo "" >&2 -} - -log_header() { - echo "=== $* ===" >&2 -} - -log_step() { - echo "→ $*" >&2 -} - -log_substep() { - echo " • $*" >&2 -} - -log_progress() { - printf "." >&2 -} - -log_progress_end() { - echo "" >&2 -} diff --git a/shlib/os.sh b/shlib/os.sh deleted file mode 100644 index 4fb7989..0000000 --- a/shlib/os.sh +++ /dev/null @@ -1,24 +0,0 @@ -# shellcheck shell=sh -[ -n "${DOTFILES_OS_LOADED}" ] && return -readonly DOTFILES_OS_LOADED=1 - -os_print() { - uname -} - -os_is_macos() { - [ "$(os_print)" = "Darwin" ] -} - -os_is_openbsd() { - [ "$(os_print)" = "OpenBSD" ] -} - -os_is_linux() { - [ "$(os_print)" = "Linux" ] -} - -os_is_linux_debian() { - _linux_debian_id=$(. /etc/os-release && echo $ID) - [ os_is_linux ] && [ "$_linux_debian_id" = "debian" ] -} diff --git a/shlib/prompt.sh b/shlib/prompt.sh deleted file mode 100644 index 6a63db0..0000000 --- a/shlib/prompt.sh +++ /dev/null @@ -1,23 +0,0 @@ -# shellcheck shell=sh -[ -n "${DOTFILES_PROMPT_LOADED}" ] && return -readonly DOTFILES_PROMPT_LOADED=1 - -# Prompt the user for confirmation on an action. -# -# Args: -# $1: The question to prompt for. Answer choices -# will be added onto the end. -# -# Returns: -# 0 on yes. 1 on no. -prompt_for_confirmation() { - ( - printf "%s [y/n]: " "$1" - read -r answer - if [ "$answer" != "${answer#[Yy]}" ]; then - return 0 - else - return 1 - fi - ) -} diff --git a/shlib/tmux.sh b/shlib/tmux.sh deleted file mode 100644 index c8870f5..0000000 --- a/shlib/tmux.sh +++ /dev/null @@ -1,30 +0,0 @@ -# shellcheck shell=sh -[ -n "${DOTFILES_TMUX_LOADED}" ] && return -readonly DOTFILES_TMUX_LOADED=1 - -. "$(dirname "$0")/shlib/log.sh" - -tmux_setup_tpm() { - ( - tpm_dir="$HOME/.config/tpm/plugins/tpm" - if [ ! -d "$tpm_dir" ]; then - log_info "Cloning TPM..." - if ! git clone https://github.com/tmux-plugins/tpm "$tpm_dir"; then - log_error "Failed to clone tpm to $tpm_dir" - return 1 - fi - else - log_info "TPM already exists, updating..." - (cd "$tpm_dir" && git pull) - fi - - if command -v tmux >/dev/null 2>&1; then - log_info "Installing tmux plugins..." - "$tpm_dir/scripts/install_plugins.sh" - log_info "TPM plugins installed successfully." - else - log_warn "tmux not found. TPM cloned but plugins not installed." - log_warn "Run 'tmux' and then press 'prefix + I' to install plugins manually." - fi - ) -} |