Permalink
Browse files

tweak the way files are synched between ~/.config and ~/

  • Loading branch information...
stesla committed Nov 10, 2011
1 parent 2975010 commit 34a36a6ca4467530edf96827465fc503570978b5
Showing with 16 additions and 39 deletions.
  1. +7 −0 copy-in.sh
  2. +9 −0 copy-out.sh
  3. +0 −39 update.sh
View
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+cd ${0%/*}
+
+find home -type f -print | while read file; do
+ cp -v $(sed -e "s#home#$HOME#" <<< "$file") $file
+done
View
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+cd ${0%/*}
+
+find home -type f -print | while read file; do
+ dest=$(sed -e "s#home#$HOME#" <<< "$file")
+ mv -v $dest $dest.bak
+ cp -v $file $dest
+done
View
@@ -1,39 +0,0 @@
-#!/bin/bash
-
-error()
-{
- echo "$1"
- exit 1
-}
-
-# First figure out our directories
-
-src=$(dirname $0)/home
-dest="$1"
-if [ "$dest" == "" ]; then
- dest="$HOME"
-fi
-if [ "$dest" == "" ]; then
- error "Unable to determine destination."
-fi
-
-# Next ensure all of the directories exist
-
-for dir in $(find $src -type d -print | sed -e "s#$src#$dest#"); do
- if [ ! -d $dir ]; then
- mkdir -p $dir
- fi
-done
-
-# Now link all of the files that we don't have linked
-
-for file in $(find $src -type f -print); do
- dest_file=$(echo $file | sed -e "s#$src#$dest#")
- if [ -e $dest_file ]; then
- if [ ! $file -ef $dest_file ]; then
- ln -i $file $dest_file
- fi
- else
- ln $file $dest_file
- fi
-done

0 comments on commit 34a36a6

Please sign in to comment.