]> err.no Git - dotfiles/commitdiff
add support for known md5sums
authortfheen <tfheen@8da78d58-1cd3-0310-bee5-d77bd1b3e8bf>
Sun, 13 Oct 2002 19:58:19 +0000 (19:58 +0000)
committertfheen <tfheen@8da78d58-1cd3-0310-bee5-d77bd1b3e8bf>
Sun, 13 Oct 2002 19:58:19 +0000 (19:58 +0000)
git-svn-id: file:///svn/tfheen/trunk/dotfiles@62 8da78d58-1cd3-0310-bee5-d77bd1b3e8bf

link-dotfiles

index 4129dd387ebbf0b77628a18e6c5e7a515228b71f..62b71911757e65d6a82f2edfbdac03c0e2d9ebe2 100755 (executable)
@@ -1,5 +1,7 @@
 #! /bin/sh
 
+KNOWNMDSUMS=b5239e7dfbecaf832e18a5377b794b09
+
 DOTFILESDIR=$HOME/dotfiles
 MD5SUM=`which md5sum`
 if test -z "$MD5SUM"; then
@@ -22,14 +24,24 @@ for file in $DOTFILESDIR/*; do
         continue
     fi
     if test -f $HOME/.$file; then
-        C_MD5SUM=`$MD5SUM < $HOME/.$file`
-        N_MD5SUM=`$MD5SUM < $DOTFILESDIR/$file`
+        C_MD5SUM=`$MD5SUM < $HOME/.$file | awk '{print $1}'`
+        N_MD5SUM=`$MD5SUM < $DOTFILESDIR/$file | awk '{print $1}'`
         if test "$C_MD5SUM" = "$N_MD5SUM"; then
             rm -f $HOME/.$file
         else
-            echo "$HOME/.$file different from $DOTFILESDIR/$file, and not symlink skipping"
-            continue
+            found=0
+            for md5 in $KNOWNMD5SUMS; do
+                if [ "$md5" = "$C_MD5SUM" ]; then
+                    rm -f $HOME/.$file
+                    found=1
+                    break
+                fi
+            done
+            if [ "$found" = "0" ]; then
+                echo "$HOME/.$file different from $DOTFILESDIR/$file, not known ok, and not symlink: skipping"
+                continue
+            fi
         fi
     fi
-        ln -s $DOTFILESDIR/$file $HOME/.$file
+    ln -s $DOTFILESDIR/$file $HOME/.$file
 done
\ No newline at end of file