This commit is contained in:
David Heinemeier Hansson 2024-05-26 19:47:00 -07:00
parent 63a73b9ed1
commit 423f0393ba

View File

@ -2,32 +2,32 @@
mkdir -p ~/.config
# Link all dotfiles
for entry in dotfiles/*; do
for entry in ~/.local/share/omakub/dotfiles/*; do
# Link all root files as .file in ~/
# Any existing files will be renamed .bak
if [ -f "$entry" ]; then
target=~/."$(basename "$entry")"
if [ -f $entry ]; then
target=~/."$(basename $entry)"
if [ -e "$target" ] && [ "$(readlink "$target")" != "$(pwd)/$entry" ]; then
mv "$target" "$target.bak"
if [ -e $target ] && [ "$(readlink $target)" != $entry ]; then
mv $target $target.bak
fi
if [ ! -e "$target" ]; then
ln -s "$(pwd)/$entry" "$target"
if [ ! -e $target ]; then
ln -s $entry $target
fi
fi
# Link all directories in ~/.config/
# Any existing directories will be renamed .bak
if [ -d "$entry" ]; then
target=~/.config/"$(basename "$entry")"
if [ -d $entry ]; then
target=~/.config/"$(basename $entry)"
if [ -e "$target" ] && [ "$(readlink "$target")" != "$(pwd)/$entry" ]; then
mv "$target" "$target.bak"
if [ -e $target ] && [ "$(readlink "$target")" != $entry ]; then
mv $target $target.bak
fi
if [ ! -e "$target" ]; then
ln -s "$(pwd)/$entry" "$target"
if [ ! -e $target ]; then
ln -s $entry $target
fi
fi
done