Skip to content

Instantly share code, notes, and snippets.

@noqqe
Created August 16, 2010 17:20
Show Gist options
  • Save noqqe/527325 to your computer and use it in GitHub Desktop.
Save noqqe/527325 to your computer and use it in GitHub Desktop.
#!/bin/bash
# coming-home: configure home-dir with your dotfiles
# Copyright: (C) 2010 Florian Baumann <[email protected]>
# 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