- compares files
- only hardlink files which are not hardlinked yet
- permission and uid/gid must be equal
- size 0 files are excluded
- can be called with multiple arguments which are used directly by find
- writes a script which can be used to undo all hardlinks

i will not do any more updates on this and focus on the vserver unifier now (it will get a small control language and tons of more sophisticated options)


example usage:
./knoppix.unify Path/To/KNOPPIX ! -path "*/var/log/*" >undo_hardlinks.sh

File knoppix.unify:
Code:
#!/bin/bash

find "$@" -type f ! -size 0 -exec md5sum {} \; |\
sort +0 |\
{
        read sum file;
        while [ "$sum" != "" ]; do
                while read sum2 file2 &&\
                        [ $sum = $sum2 ] &&\
                        [ $(cut -d " " -f 1 <(ls -i "$file")) != $(cut -d " " -f 1 <(ls -i "$file2")) ] &&\
                        [ $(cut -c -32 <(ls -ln "$file")) = $(cut -c -32 <(ls -ln "$file2")) ] &&\
                        cmp "$file" "$file2";
                do
                        ln -f "$file" "$file2" &&
                        echo "rm -f \"$file2\"; cp -pf \"$file\" \"$file2\""
                done
                sum=$sum2
                file="$file2"
        done
}