Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
# coming-home: configure home-dir with your dotfiles
# Copyright: (C) 2010 Florian Baumann <flo@noqqe.de>
# License: GPL3 <http://gnu.org/licenses/gpl-3.0.txt>
# get dotfiles
dotfiles=$(ls -la | grep -v ^d | awk '{print $8}'| grep -v ^coming-home.bash$ )
mode=${1:-normal}
for x in $dotfiles; do
# fishing errors
if [ ! -e $x ] ; then echo "error reading files" ; exit 1 ; fi
# keep old .bashrc
if [ $x = ".bashrc" ]; then
if [ ! -e $HOME/.bashrc_old ]; then
cp $HOME/.bashrc $HOME/.bashrc_old
fi
fi
# forced hook
if [ $mode = "--hook" ]; then echo "hook: copying $x" ; /bin/cp -r $x $HOME/ ; fi
# standard run
if [ $mode != "--hook" ]; then /bin/cp -i $x $HOME/ ; fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment