Skip to content

Commit

Permalink
feat: Remove mackup dependency
Browse files Browse the repository at this point in the history
- use more straightforward logic for bootstrapping and unboostrapping
- mackup is broken and there are no signs of a fix
- see: lra/mackup#1924 lra/mackup#2035
  • Loading branch information
martimlobao committed Nov 4, 2024
1 parent b048747 commit 275838e
Show file tree
Hide file tree
Showing 27 changed files with 21 additions and 22 deletions.
1 change: 0 additions & 1 deletion apps.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 17 additions & 17 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@

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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 275838e

Please sign in to comment.