Installer and update script enhancements.
This commit is contained in:
@@ -3,9 +3,47 @@
|
|||||||
# Update Dotfiles Script
|
# Update Dotfiles Script
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# Updates dotfiles from the git repository and relinks files
|
# Updates dotfiles from the git repository and relinks files
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# update-dotfiles.sh # Pull and re-run install
|
||||||
|
# update-dotfiles.sh --skip-deps # Pull and re-run install without deps
|
||||||
|
# update-dotfiles.sh --pull-only # Only git pull, don't re-run install
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Options
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
SKIP_DEPS=true # Default to skipping deps on updates
|
||||||
|
PULL_ONLY=false
|
||||||
|
|
||||||
|
for arg in "$@"; do
|
||||||
|
case "$arg" in
|
||||||
|
--skip-deps)
|
||||||
|
SKIP_DEPS=true
|
||||||
|
;;
|
||||||
|
--with-deps)
|
||||||
|
SKIP_DEPS=false
|
||||||
|
;;
|
||||||
|
--pull-only)
|
||||||
|
PULL_ONLY=true
|
||||||
|
;;
|
||||||
|
--help|-h)
|
||||||
|
echo "Usage: $0 [OPTIONS]"
|
||||||
|
echo
|
||||||
|
echo "Options:"
|
||||||
|
echo " --skip-deps Skip dependency check (default for updates)"
|
||||||
|
echo " --with-deps Run full dependency check"
|
||||||
|
echo " --pull-only Only git pull, don't re-run install script"
|
||||||
|
echo " --help Show this help message"
|
||||||
|
echo
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# Load Configuration
|
# Load Configuration
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
@@ -32,6 +70,7 @@ fi
|
|||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW='\033[1;33m'
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
|
BLUE='\033[0;34m'
|
||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
|
|
||||||
print_success() {
|
print_success() {
|
||||||
@@ -46,6 +85,10 @@ print_error() {
|
|||||||
echo -e "${RED}✗${NC} $1"
|
echo -e "${RED}✗${NC} $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print_step() {
|
||||||
|
echo -e "${GREEN}==>${NC} $1"
|
||||||
|
}
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# Main
|
# Main
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
@@ -59,21 +102,32 @@ fi
|
|||||||
|
|
||||||
cd "$DOTFILES_DIR"
|
cd "$DOTFILES_DIR"
|
||||||
|
|
||||||
echo "Updating dotfiles from repository..."
|
print_step "Updating dotfiles from repository..."
|
||||||
git pull origin "$DOTFILES_BRANCH"
|
git pull origin "$DOTFILES_BRANCH"
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
print_success "Dotfiles updated successfully"
|
print_success "Dotfiles updated successfully"
|
||||||
|
|
||||||
|
if [[ "$PULL_ONLY" == true ]]; then
|
||||||
|
echo
|
||||||
|
print_success "Pull complete (--pull-only mode)"
|
||||||
|
echo "Run ./install.sh manually to re-link files"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -f "$DOTFILES_DIR/install.sh" ]; then
|
if [ -f "$DOTFILES_DIR/install.sh" ]; then
|
||||||
echo
|
echo
|
||||||
read -p "Run install script to update links? [Y/n]: " response
|
read -p "Run install script to update links? [Y/n]: " response
|
||||||
response=${response:-y}
|
response=${response:-y}
|
||||||
|
|
||||||
if [[ "$response" =~ ^[Yy]$ ]]; then
|
if [[ "$response" =~ ^[Yy]$ ]]; then
|
||||||
|
if [[ "$SKIP_DEPS" == true ]]; then
|
||||||
|
"$DOTFILES_DIR/install.sh" --skip-deps
|
||||||
|
else
|
||||||
"$DOTFILES_DIR/install.sh"
|
"$DOTFILES_DIR/install.sh"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
print_success "Update complete!"
|
print_success "Update complete!"
|
||||||
|
|||||||
@@ -23,7 +23,9 @@ USER_WEBSITE=""
|
|||||||
USER_GITHUB=""
|
USER_GITHUB=""
|
||||||
|
|
||||||
# --- Feature Toggles ---
|
# --- Feature Toggles ---
|
||||||
# Set to "true" or "false" to control what gets installed
|
# Set to "true", "false", or "ask" to control what gets installed
|
||||||
|
# Use "auto" to skip if already installed (default for deps)
|
||||||
|
INSTALL_DEPS="auto" # "auto" (skip if installed), "true", "false", or "ask"
|
||||||
INSTALL_ESPANSO="ask" # "true", "false", or "ask"
|
INSTALL_ESPANSO="ask" # "true", "false", or "ask"
|
||||||
INSTALL_FZF="ask"
|
INSTALL_FZF="ask"
|
||||||
INSTALL_BAT="ask"
|
INSTALL_BAT="ask"
|
||||||
@@ -36,7 +38,7 @@ THEME_TIMER_THRESHOLD=10 # Show elapsed time for commands longer than
|
|||||||
THEME_PATH_TRUNCATE_LENGTH=32 # Truncate path display after N characters
|
THEME_PATH_TRUNCATE_LENGTH=32 # Truncate path display after N characters
|
||||||
|
|
||||||
# --- Espanso Settings ---
|
# --- Espanso Settings ---
|
||||||
ESPANSO_TRIGGER_PREFIX=".." # Prefix for all triggers (e.g., "..date")
|
ESPANSO_TRIGGER_PREFIX=".." # Prefix for all Aaron D. Lee's normal triggers (e.g., "..date")
|
||||||
|
|
||||||
# --- Snapper Settings (CachyOS/Arch with btrfs) ---
|
# --- Snapper Settings (CachyOS/Arch with btrfs) ---
|
||||||
SNAPPER_CONFIG="root"
|
SNAPPER_CONFIG="root"
|
||||||
|
|||||||
94
install.sh
94
install.sh
@@ -7,11 +7,48 @@
|
|||||||
# Or:
|
# Or:
|
||||||
# git clone https://github.com/adlee-was-taken/dotfiles.git && cd dotfiles && ./install.sh
|
# git clone https://github.com/adlee-was-taken/dotfiles.git && cd dotfiles && ./install.sh
|
||||||
#
|
#
|
||||||
|
# Options:
|
||||||
|
# --skip-deps Skip dependency installation (for re-runs)
|
||||||
|
# --deps-only Only install dependencies, then exit
|
||||||
|
# --help Show help
|
||||||
|
#
|
||||||
# Fork this repo? Edit dotfiles.conf with your settings.
|
# Fork this repo? Edit dotfiles.conf with your settings.
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Command Line Options
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
SKIP_DEPS=false
|
||||||
|
DEPS_ONLY=false
|
||||||
|
|
||||||
|
for arg in "$@"; do
|
||||||
|
case "$arg" in
|
||||||
|
--skip-deps)
|
||||||
|
SKIP_DEPS=true
|
||||||
|
;;
|
||||||
|
--deps-only)
|
||||||
|
DEPS_ONLY=true
|
||||||
|
;;
|
||||||
|
--help|-h)
|
||||||
|
echo "Usage: $0 [OPTIONS]"
|
||||||
|
echo
|
||||||
|
echo "Options:"
|
||||||
|
echo " --skip-deps Skip dependency installation (useful for re-runs)"
|
||||||
|
echo " --deps-only Only install dependencies, then exit"
|
||||||
|
echo " --help Show this help message"
|
||||||
|
echo
|
||||||
|
echo "Configuration:"
|
||||||
|
echo " Edit dotfiles.conf to customize installation behavior"
|
||||||
|
echo " Set INSTALL_DEPS=\"false\" to always skip dependencies"
|
||||||
|
echo
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# Load Configuration
|
# Load Configuration
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
@@ -32,6 +69,7 @@ load_config() {
|
|||||||
DOTFILES_REPO_URL="https://github.com/${DOTFILES_GITHUB_USER}/${DOTFILES_REPO_NAME}.git"
|
DOTFILES_REPO_URL="https://github.com/${DOTFILES_GITHUB_USER}/${DOTFILES_REPO_NAME}.git"
|
||||||
|
|
||||||
# Feature toggles
|
# Feature toggles
|
||||||
|
INSTALL_DEPS="${INSTALL_DEPS:-auto}"
|
||||||
INSTALL_ESPANSO="${INSTALL_ESPANSO:-ask}"
|
INSTALL_ESPANSO="${INSTALL_ESPANSO:-ask}"
|
||||||
INSTALL_FZF="${INSTALL_FZF:-ask}"
|
INSTALL_FZF="${INSTALL_FZF:-ask}"
|
||||||
INSTALL_BAT="${INSTALL_BAT:-ask}"
|
INSTALL_BAT="${INSTALL_BAT:-ask}"
|
||||||
@@ -64,7 +102,7 @@ NC='\033[0m'
|
|||||||
print_header() {
|
print_header() {
|
||||||
echo -e "\n${BLUE}╔════════════════════════════════════════════════════════════╗${NC}"
|
echo -e "\n${BLUE}╔════════════════════════════════════════════════════════════╗${NC}"
|
||||||
echo -e "${BLUE}║${NC} Dotfiles Installation ${BLUE}║${NC}"
|
echo -e "${BLUE}║${NC} Dotfiles Installation ${BLUE}║${NC}"
|
||||||
echo -e "${BLUE}║${NC} Repo: ${DOTFILES_GITHUB_USER}/${DOTFILES_REPO_NAME}${BLUE}║${NC}"
|
echo -e "${BLUE}║${NC} Repo: ${DOTFILES_GITHUB_USER}/${DOTFILES_REPO_NAME} ${BLUE}║${NC}"
|
||||||
echo -e "${BLUE}╚════════════════════════════════════════════════════════════╝${NC}\n"
|
echo -e "${BLUE}╚════════════════════════════════════════════════════════════╝${NC}\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,7 +179,31 @@ detect_os() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check if core dependencies are already installed
|
||||||
|
check_core_deps() {
|
||||||
|
command -v git &>/dev/null && command -v curl &>/dev/null && command -v zsh &>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
install_dependencies() {
|
install_dependencies() {
|
||||||
|
# Skip if --skip-deps flag
|
||||||
|
if [[ "$SKIP_DEPS" == true ]]; then
|
||||||
|
print_step "Skipping dependencies (--skip-deps)"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Skip if INSTALL_DEPS=false in config
|
||||||
|
if [[ "${INSTALL_DEPS}" == "false" || "${INSTALL_DEPS}" == "no" || "${INSTALL_DEPS}" == "0" ]]; then
|
||||||
|
print_step "Skipping dependencies (INSTALL_DEPS=false in config)"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Auto-detect: skip if deps already installed (default behavior)
|
||||||
|
if [[ "${INSTALL_DEPS}" == "auto" ]] && check_core_deps; then
|
||||||
|
print_step "Dependencies check"
|
||||||
|
print_success "Core dependencies already installed (git, curl, zsh)"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
print_step "Installing dependencies"
|
print_step "Installing dependencies"
|
||||||
|
|
||||||
case "$OS" in
|
case "$OS" in
|
||||||
@@ -216,15 +278,15 @@ backup_existing_configs() {
|
|||||||
if [ "$backup_needed" = true ]; then
|
if [ "$backup_needed" = true ]; then
|
||||||
print_success "Backups saved to: $BACKUP_DIR"
|
print_success "Backups saved to: $BACKUP_DIR"
|
||||||
else
|
else
|
||||||
print_success "No backups needed"
|
print_success "No backups needed (files already symlinked or don't exist)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_oh_my_zsh() {
|
install_oh_my_zsh() {
|
||||||
print_step "Installing oh-my-zsh"
|
print_step "Checking oh-my-zsh"
|
||||||
|
|
||||||
if [ -d "$HOME/.oh-my-zsh" ]; then
|
if [ -d "$HOME/.oh-my-zsh" ]; then
|
||||||
print_warning "oh-my-zsh already installed"
|
print_success "oh-my-zsh already installed"
|
||||||
else
|
else
|
||||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
|
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
|
||||||
print_success "oh-my-zsh installed"
|
print_success "oh-my-zsh installed"
|
||||||
@@ -278,7 +340,7 @@ link_dotfiles() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set_zsh_default() {
|
set_zsh_default() {
|
||||||
print_step "Setting zsh as default shell"
|
print_step "Checking default shell"
|
||||||
|
|
||||||
if [ "$SHELL" != "$(which zsh)" ]; then
|
if [ "$SHELL" != "$(which zsh)" ]; then
|
||||||
case "$SET_ZSH_DEFAULT" in
|
case "$SET_ZSH_DEFAULT" in
|
||||||
@@ -302,13 +364,13 @@ set_zsh_default() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
install_espanso() {
|
install_espanso() {
|
||||||
print_step "Installing espanso (text expander)"
|
|
||||||
|
|
||||||
if command -v espanso &> /dev/null; then
|
if command -v espanso &> /dev/null; then
|
||||||
print_warning "espanso already installed"
|
print_success "espanso already installed"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
print_step "Installing espanso (text expander)"
|
||||||
|
|
||||||
case "$OS" in
|
case "$OS" in
|
||||||
ubuntu|debian)
|
ubuntu|debian)
|
||||||
sudo apt-get install -y wget
|
sudo apt-get install -y wget
|
||||||
@@ -389,6 +451,8 @@ install_optional_tools() {
|
|||||||
if should_install "$INSTALL_ESPANSO" "espanso (text expander)"; then
|
if should_install "$INSTALL_ESPANSO" "espanso (text expander)"; then
|
||||||
install_espanso
|
install_espanso
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
print_success "espanso already installed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# fzf
|
# fzf
|
||||||
@@ -398,6 +462,8 @@ install_optional_tools() {
|
|||||||
~/.fzf/install --all
|
~/.fzf/install --all
|
||||||
print_success "fzf installed"
|
print_success "fzf installed"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
print_success "fzf already installed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# bat
|
# bat
|
||||||
@@ -411,6 +477,8 @@ install_optional_tools() {
|
|||||||
esac
|
esac
|
||||||
print_success "bat installed"
|
print_success "bat installed"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
print_success "bat already installed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# eza
|
# eza
|
||||||
@@ -424,6 +492,8 @@ install_optional_tools() {
|
|||||||
esac
|
esac
|
||||||
print_success "eza installed"
|
print_success "eza installed"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
print_success "eza already installed"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,6 +506,14 @@ main() {
|
|||||||
|
|
||||||
detect_os
|
detect_os
|
||||||
|
|
||||||
|
# Handle --deps-only
|
||||||
|
if [[ "$DEPS_ONLY" == true ]]; then
|
||||||
|
install_dependencies
|
||||||
|
echo
|
||||||
|
print_success "Dependencies installed. Run without --deps-only to continue."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
if ask_yes_no "Install/update dotfiles?"; then
|
if ask_yes_no "Install/update dotfiles?"; then
|
||||||
install_dependencies
|
install_dependencies
|
||||||
clone_or_update_dotfiles
|
clone_or_update_dotfiles
|
||||||
|
|||||||
Reference in New Issue
Block a user