Let people own their own basic configs

Just call for defaults, then overwrite
This commit is contained in:
David Heinemeier Hansson
2024-05-27 09:01:23 -07:00
parent 730a1c86ae
commit 8dc16ca981
10 changed files with 73 additions and 91 deletions

View File

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