diff --git a/apps.toml b/apps.toml index e6e76dc..e30dd08 100644 --- a/apps.toml +++ b/apps.toml @@ -120,7 +120,6 @@ ffmpeg = "formula" # Play, record, convert, and stream audio and video httpie = "formula" # User-friendly cURL replacement (command-line HTTP client) imagemagick = "formula" # Tools and libraries to manipulate images in many formats jq = "formula" # Lightweight and flexible command-line JSON processor -mackup = "formula" # Keep your Mac's application settings in sync nano = "formula" # Free (GNU) replacement for the Pico text editor nnn = "formula" # Tiny, lightning fast, feature-packed file manager pandoc = "formula" # Swiss-army knife of markup format conversion diff --git a/bootstrap.sh b/bootstrap.sh index 27754e4..dbe3df1 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,32 +1,35 @@ #!/usr/bin/env bash +# Source the bash_traceback.sh file +source "$(dirname "$0")/bash_traceback.sh" + ############################################################################### # UPDATE DOTFILES # ############################################################################### cd "$(dirname "${BASH_SOURCE:-$0}")" || exit 1; -git pull origin main; +function dotlink() { + find "linkme" -type d -mindepth 1 | sed "s|^linkme/||" | while read -r dir; do mkdir -p "$HOME/$dir"; done + find "linkme" -type f -not -name '.DS_Store' | sed "s|^linkme/||" | while read -r file; do ln -fvns "$(pwd)/linkme/$file" "$HOME/$file"; done +} -# Sync dotfiles (excludes folders, .sh files, .md files, and git files) -function bootstrap() { - rsync --exclude "*.sh" \ - --exclude "*.md" \ - --exclude ".DS_Store" \ - --exclude ".gitignore" \ - -f"- */" \ - -avh --no-perms . ~; - # shellcheck source=/dev/null - source "$HOME"/.zprofile; +function dotunlink() { + rsync -av --exclude='.DS_Store' linkme/ "$HOME" | \ + grep -v "building file list ... done" | \ + awk '/^$/ { exit } !/\/$/ { print "Restored " $0 }' } -if [ "$1" == "--force" ] || [ "$1" == "-f" ]; then - bootstrap; +if [ "$1" == "unlink" ]; then + dotunlink; +elif [ "$1" == "--force" ] || [ "$1" == "-f" ]; then + dotlink; else - read -rp "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1; - echo ""; + read -rp $'❓ \e[1;31mThis may overwrite existing files in your home directory. Are you sure? (y/n)\e[0m ' REPLY if [[ $REPLY =~ ^[Yy]$ ]]; then - bootstrap; + dotlink; fi; fi; -unset bootstrap; + +# shellcheck source=/dev/null +source "$HOME"/.zprofile diff --git a/manual/Library/Preferences/com.bjango.istatmenus.agent.plist b/copyme/Library/Preferences/com.bjango.istatmenus.agent.plist similarity index 100% rename from manual/Library/Preferences/com.bjango.istatmenus.agent.plist rename to copyme/Library/Preferences/com.bjango.istatmenus.agent.plist diff --git a/manual/Library/Preferences/com.bjango.istatmenus.plist b/copyme/Library/Preferences/com.bjango.istatmenus.plist similarity index 100% rename from manual/Library/Preferences/com.bjango.istatmenus.plist rename to copyme/Library/Preferences/com.bjango.istatmenus.plist diff --git a/manual/Library/Preferences/com.bjango.istatmenus.status.plist b/copyme/Library/Preferences/com.bjango.istatmenus.status.plist similarity index 100% rename from manual/Library/Preferences/com.bjango.istatmenus.status.plist rename to copyme/Library/Preferences/com.bjango.istatmenus.status.plist diff --git a/manual/Library/Preferences/com.bjango.istatmenus6.extras.plist b/copyme/Library/Preferences/com.bjango.istatmenus6.extras.plist similarity index 100% rename from manual/Library/Preferences/com.bjango.istatmenus6.extras.plist rename to copyme/Library/Preferences/com.bjango.istatmenus6.extras.plist diff --git a/manual/Library/Preferences/com.xk72.charles.config b/copyme/Library/Preferences/com.xk72.charles.config similarity index 100% rename from manual/Library/Preferences/com.xk72.charles.config rename to copyme/Library/Preferences/com.xk72.charles.config diff --git a/mackup/.aliases b/linkme/.aliases similarity index 100% rename from mackup/.aliases rename to linkme/.aliases diff --git a/mackup/.aws/config b/linkme/.aws/config similarity index 100% rename from mackup/.aws/config rename to linkme/.aws/config diff --git a/mackup/.config/1Password/ssh/agent.toml b/linkme/.config/1Password/ssh/agent.toml similarity index 100% rename from mackup/.config/1Password/ssh/agent.toml rename to linkme/.config/1Password/ssh/agent.toml diff --git a/mackup/.config/ruff/ruff.toml b/linkme/.config/ruff/ruff.toml similarity index 100% rename from mackup/.config/ruff/ruff.toml rename to linkme/.config/ruff/ruff.toml diff --git a/mackup/.config/starship.toml b/linkme/.config/starship.toml similarity index 100% rename from mackup/.config/starship.toml rename to linkme/.config/starship.toml diff --git a/mackup/.exports b/linkme/.exports similarity index 100% rename from mackup/.exports rename to linkme/.exports diff --git a/mackup/.functions b/linkme/.functions similarity index 100% rename from mackup/.functions rename to linkme/.functions diff --git a/mackup/.gitattributes b/linkme/.gitattributes similarity index 100% rename from mackup/.gitattributes rename to linkme/.gitattributes diff --git a/mackup/.gitconfig b/linkme/.gitconfig similarity index 100% rename from mackup/.gitconfig rename to linkme/.gitconfig diff --git a/mackup/.hyper.js b/linkme/.hyper.js similarity index 100% rename from mackup/.hyper.js rename to linkme/.hyper.js diff --git a/mackup/.ssh/config b/linkme/.ssh/config similarity index 100% rename from mackup/.ssh/config rename to linkme/.ssh/config diff --git a/mackup/.zprofile b/linkme/.zprofile similarity index 100% rename from mackup/.zprofile rename to linkme/.zprofile diff --git a/mackup/.zshrc b/linkme/.zshrc similarity index 100% rename from mackup/.zshrc rename to linkme/.zshrc diff --git a/local.sh b/local.sh index 3436f54..b328bf6 100755 --- a/local.sh +++ b/local.sh @@ -45,10 +45,10 @@ git config --file="$HOME"/.gitconfig.private user.email "$(op read "op://Private git config --file="$HOME"/.gitconfig.private user.signingKey "$(op read "op://Private/Github SSH Commit Signing Key/public key")" git config --file="$HOME"/.gitconfig.private github.user "$(op read "op://Private/Github/username")" -# Copy all files from manual/ to ~/ -read -rp $'❓ \e[1;31mDo you want to copy and overwrite all files from manual/ to $HOME? (y/n)\e[0m ' COPYMANUAL -if [[ $COPYMANUAL =~ ^[Yy]$ ]]; then - cp -r manual/ ~/ +# Copy all files from copyme/ to $HOME +read -rp $'❓ \e[1;31mDo you want to copy and overwrite all files from copyme/ to $HOME? (y/n)\e[0m ' COPYME +if [[ $COPYME =~ ^[Yy]$ ]]; then + rsync -av --exclude='.DS_Store' copyme/ "$HOME" fi # iStat Menus diff --git a/mackup/.mackup.cfg b/mackup/.mackup.cfg deleted file mode 100644 index b1095ba..00000000 --- a/mackup/.mackup.cfg +++ /dev/null @@ -1,15 +0,0 @@ -[storage] -engine = file_system -path = Documents -directory = dotfiles/mackup - -[applications_to_sync] -aws -dotfiles -git -hyper -mackup -ruff -ssh -starship -zsh diff --git a/mackup/.mackup/aws.cfg b/mackup/.mackup/aws.cfg deleted file mode 100644 index 51bc925..00000000 --- a/mackup/.mackup/aws.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[application] -name = AWS - -[configuration_files] -.aws/config diff --git a/mackup/.mackup/dotfiles.cfg b/mackup/.mackup/dotfiles.cfg deleted file mode 100644 index 353fd8a..00000000 --- a/mackup/.mackup/dotfiles.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[application] -name = Dotfiles - -[configuration_files] -.aliases -.exports -.functions diff --git a/mackup/.mackup/git.cfg b/mackup/.mackup/git.cfg deleted file mode 100644 index 50dcf22..00000000 --- a/mackup/.mackup/git.cfg +++ /dev/null @@ -1,11 +0,0 @@ -[application] -name = Git - -[configuration_files] -.gitconfig -.gitattributes - -[xdg_configuration_files] -git/config -git/ignore -git/attributes diff --git a/mackup/.mackup/ruff.cfg b/mackup/.mackup/ruff.cfg deleted file mode 100644 index 31cd0e7..00000000 --- a/mackup/.mackup/ruff.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[application] -name = Ruff - -[xdg_configuration_files] -ruff/ruff.toml diff --git a/mackup/.mackup/ssh.cfg b/mackup/.mackup/ssh.cfg deleted file mode 100644 index aea6a65..00000000 --- a/mackup/.mackup/ssh.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[application] -name = SSH - -[configuration_files] -.ssh/config -.ssh/authorized_keys - -[xdg_configuration_files] -1Password/ssh/agent.toml