From: tfheen Date: Sun, 13 Oct 2002 19:58:19 +0000 (+0000) Subject: add support for known md5sums X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3577fbf21b05a2975c5fea990ab9d10951d9222;p=dotfiles add support for known md5sums git-svn-id: file:///svn/tfheen/trunk/dotfiles@62 8da78d58-1cd3-0310-bee5-d77bd1b3e8bf --- diff --git a/link-dotfiles b/link-dotfiles index 4129dd3..62b7191 100755 --- a/link-dotfiles +++ b/link-dotfiles @@ -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