-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from edheltzel/feature/xdg
Feature/xdg
- Loading branch information
Showing
138 changed files
with
4,140 additions
and
6,118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
"tigrc", | ||
"tldr", | ||
"tmol", | ||
"Unstowing", | ||
"zoxide" | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,69 @@ | ||
STOW_PACKAGES := dots git fish nvim config warp vscode | ||
STOW_PACKAGES := dots git fish nvim config local warp vscode | ||
YELLOW := \033[33m | ||
GREEN := \033[32m | ||
WHITE := \033[37m | ||
CLR := \033[0m | ||
|
||
.PHONY: all | ||
all: help | ||
.PHONY: default | ||
default: help | ||
|
||
.PHONY: help | ||
help: ## Show this help message (default) | ||
@awk 'BEGIN {FS = ":.*?## "}; \ | ||
/^[^\t][a-zA-Z0-9_-]+:.*?##/ \ | ||
{ printf "\033[36m%-24s\033[0m %s\n", $$1, $$2 } \ | ||
/^##/ { printf "\033[33m%s\033[0m\n", substr($$0, 4) }' $(MAKEFILE_LIST) | ||
{ printf "\033[36m%-24s$(CLR) %s\n", $$1, $$2 } \ | ||
/^##/ { printf "$(YELLOW)%s$(CLR)\n", substr($$0, 4) }' $(MAKEFILE_LIST) | ||
|
||
.PHONY: stow | ||
stow: ## Symlink all dotfiles managed by Stow | ||
.PHONY: install | ||
install: ## Bootsraps a new machine | ||
@echo "$(YELLOW)Running bootstrap to provision the system...$(CLR)" | ||
@./install.sh | ||
@echo "$(GREEN)System provisioning complete!$(CLR)" | ||
|
||
|
||
.PHONY: run | ||
run: ## Symlink all dotfiles w/Stow | ||
@for pkg in $(STOW_PACKAGES); do \ | ||
stow $$pkg; \ | ||
done | ||
@echo "Dotfiles stowed successfully" | ||
|
||
.PHONY: stow | ||
stow: ## Add individual packages w/Stow | ||
@if [ -z "${pkg}" ]; then \ | ||
echo "Error: Please specify a package to stow. \n$(YELLOW)ie: $(YELLOW)make stow pkg=<pacakgeName>$(CLR) \n$(WHITE)Available packages:$(CLR) $(STOW_PACKAGES)"; \ | ||
exit 1; \ | ||
fi | ||
@if [[ ! " ${STOW_PACKAGES} " =~ " ${pkg} " ]]; then \ | ||
echo "Error: Package '${pkg}' not found in STOW_PACKAGES: $(STOW_PACKAGES)"; \ | ||
exit 1; \ | ||
fi | ||
stow ${pkg} | ||
@echo "${pkg} was added" | ||
|
||
.PHONY: unstow | ||
unstow: ## Remove all dotfiles managed by Stow | ||
unstow: ## Remove individual packages w/Stow | ||
@if [ -z "${pkg}" ]; then \ | ||
echo "Error: Please specify a package to unstow. \n$(YELLOW)ie: $(YELLOW)make unstow pkg=<pacakgeName>$(CLR) \n$(WHITE)Available packages:$(CLR) $(STOW_PACKAGES)"; \ | ||
exit 1; \ | ||
fi | ||
@if [[ ! " ${STOW_PACKAGES} " =~ " ${pkg} " ]]; then \ | ||
echo "Error: Package '${pkg}' not found in STOW_PACKAGES: $(STOW_PACKAGES)"; \ | ||
exit 1; \ | ||
fi | ||
stow --delete ${pkg} | ||
@echo "${pkg} was removed" | ||
|
||
.PHONY: delete | ||
delete: ## Delete all dotfiles w/Stow | ||
@for pkg in $(STOW_PACKAGES); do \ | ||
stow --delete $$pkg; \ | ||
done | ||
@echo "Dotfiles zapped! ⚡️" | ||
@echo "$(WHITE)Dotfiles zapped! ⚡️" | ||
|
||
.PHONY: update | ||
update: ## Update dotfiles & remove broken symlinks managed by Stow | ||
update: ## Sync & clean dead symlinks w/Stow | ||
@for pkg in $(STOW_PACKAGES); do \ | ||
stow --restow $$pkg; \ | ||
done | ||
@echo "Dotfiles updated successfully" | ||
@echo "$(GREEN)Dotfiles updated successfully$(CLR)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,47 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
# Define variables | ||
DOTFILES_REPO="https://github.com/edheltzel/dotfiles.git" | ||
PROJECTS_DIR="$HOME/Developer" | ||
DOTFILES_DIR="$HOME/.dotfiles" | ||
# Define the source and target locations | ||
SOURCE="https://github.com/edheltzel/dotfiles" | ||
TARBALL="$SOURCE/tarball/main" | ||
TARGET="$HOME/.dotfiles" | ||
TAR_CMD="tar -xzv -C \"$TARGET\" --strip-components=1 --exclude='{.gitignore}'" | ||
|
||
# Define functions for prompts, banners, and errors | ||
print_prompt() { | ||
echo -e "\033[1m$1\033[0m" | ||
# Function to check if a command is executable | ||
is_executable() { | ||
type "$1" > /dev/null 2>&1 | ||
} | ||
|
||
function print_banner() { | ||
local message="$1" | ||
echo -e "${YELLOW}====================================================${NC}" | ||
echo -e "${YELLOW} NOTE: $message${NC}" | ||
echo -e "${YELLOW}====================================================${NC}" | ||
} | ||
|
||
print_error() { | ||
local message="$1" | ||
echo -e "${YELLOW}====================================================${NC}" | ||
echo -e "${YELLOW} ERROR: $message${NC}" | ||
echo -e "${YELLOW}====================================================${NC}" | ||
} | ||
|
||
## | ||
|
||
# Create the Developer directory if it does not exist | ||
if [ ! -d "$PROJECTS_DIR" ]; then | ||
mkdir "$PROJECTS_DIR" | ||
# Determine the download command based on available tools | ||
if is_executable "git"; then | ||
CMD="git clone $SOURCE $TARGET" | ||
elif is_executable "curl"; then | ||
CMD="curl -#L $TARBALL | $TAR_CMD" | ||
elif is_executable "wget"; then | ||
CMD="wget --no-check-certificate -O - $TARBALL | $TAR_CMD" | ||
fi | ||
|
||
# Clone the dotfiles repository | ||
if ! git clone $DOTFILES_REPO $DOTFILES_DIR &> /dev/null; then | ||
print_error "Failed to clone dotfiles repository. Please check your internet connection and try again." | ||
# Execute the download command or abort if no tools are available | ||
if [ -z "$CMD" ]; then | ||
echo "No git, curl, or wget available. Aborting." | ||
else | ||
echo "Installing dotfiles..." | ||
mkdir -p "$TARGET" | ||
eval "$CMD" | ||
|
||
# Check if install.sh exists | ||
if [ -f "$TARGET/install.sh" ]; then | ||
# Prompt the user for confirmation before proceeding | ||
read -p "Do you want to continue with the installation? [y/N] " -n 1 -r | ||
echo # Move to a new line | ||
if [[ $REPLY =~ ^[Yy]$ ]]; then | ||
echo "Running install script..." | ||
bash "$TARGET/install.sh" | ||
else | ||
echo "Installation aborted by user." | ||
exit 1 | ||
fi | ||
else | ||
echo "Error: install.sh not found in the dotfiles repository." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Run the installation script in the dotfiles directory | ||
if ! bash $DOTFILES_DIR/install.sh &> /dev/null; then | ||
print_error "Failed to install dotfiles. Please check the installation script and try again." | ||
exit 1 | ||
fi | ||
|
||
print_banner "You should restart your computer at this point for all the changes to take effect." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.