-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Remove mackup dependency (#44)
- 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 ## Summary by Sourcery Remove the mackup dependency and implement custom logic for managing dotfiles and application settings using new functions 'dotlink' and 'dotunlink'. Update scripts to use rsync for copying files and managing symbolic links. New Features: - Introduce new functions 'dotlink' and 'dotunlink' for managing symbolic links in the home directory. Enhancements: - Replace mackup dependency with custom logic for managing dotfiles and application settings.
- Loading branch information
1 parent
b048747
commit ed3368c
Showing
27 changed files
with
24 additions
and
74 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
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,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 |
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.
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.