Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated the install script to support partial updates

  • Loading branch information...
commit 841baa1cacce86e57097368008798a7235defd61 1 parent ea3744c
@jferris authored
Showing with 22 additions and 2 deletions.
  1. +22 −2 install.sh
View
24 install.sh
@@ -1,15 +1,35 @@
#!/bin/sh
+cutstring="DO NOT EDIT BELOW THIS LINE"
+
for name in *; do
target="$HOME/.$name"
if [ -e $target ]; then
if [ ! -L $target ]; then
- echo "WARNING: $target exists but is not a symlink."
+ cutline=`grep -n -m1 "$cutstring" "$target" | sed "s/:.*//"`
+ if [[ -n $cutline ]]; then
+ let "cutline = $cutline - 1"
+ echo "Updating $target"
+ head -n $cutline "$target" > update_tmp
+ startline=`tail -r "$name" | grep -n -m1 "$cutstring" | sed "s/:.*//"`
+ if [[ -n $startline ]]; then
+ tail -n $startline "$name" >> update_tmp
+ else
+ cat "$name" >> update_tmp
+ fi
+ mv update_tmp "$target"
+ else
+ echo "WARNING: $target exists but is not a symlink."
+ fi
fi
else
if [[ $name != 'install.sh' ]]; then
echo "Creating $target"
- ln -s "$PWD/$name" "$target"
+ if [[ -n `grep "$cutstring" "$name"` ]]; then
+ cp "$PWD/$name" "$target"
+ else
+ ln -s "$PWD/$name" "$target"
+ fi
fi
fi
done
Please sign in to comment.
Something went wrong with that request. Please try again.