]> git.lyx.org Git - lyx.git/commitdiff
Avoid duplicates of dictionaries and thesauri in distributed package
authorStephan Witt <switt@lyx.org>
Thu, 23 Jul 2015 10:55:02 +0000 (12:55 +0200)
committerStephan Witt <switt@lyx.org>
Thu, 23 Jul 2015 10:55:02 +0000 (12:55 +0200)
development/LyX-Mac-binary-release.sh

index fc26c1e404fff0294f10a24c45db5b61095cecca..a7f0620ff217f67606fa8dee9149bd25a4b28892 100644 (file)
@@ -799,6 +799,21 @@ convert_universal() {
        done
 }
 
+deduplicate() {
+       find "$@" -type f -print | while read file ; do
+               echo $(md5 -q "$file") "$file"
+       done | sort | while read hash file ; do
+               if [ "$phash" = "$hash" ]; then
+                       cmp -s "$pfile" "$file" && (
+                               rm "$file"
+                               ln -s "$pfile" "$file" && echo link for "$file" created
+                       )
+               fi
+               phash="$hash"
+               pfile="$file"
+       done
+}
+
 copy_dictionaries() {
        if [ -d "${ASpellInstallDir}" -a "yes" = "${aspell_dictionaries}" ]; then
                ASpellResources="${LyxAppPrefix}/Contents/Resources"
@@ -814,11 +829,13 @@ copy_dictionaries() {
                HunSpellResources="${LyxAppPrefix}/Contents/Resources"
                if [ -d "${DictionarySourceDir}" ]; then
                        ( cd "${DictionarySourceDir}" && find dicts -name .svn -prune -o -type f -print | cpio -pmdv "${HunSpellResources}" )
+                       deduplicate "${HunSpellResources}"/dicts
                fi
        fi
        if [ -d "${DictionarySourceDir}" -a "yes" = "${thesaurus_deployment}" ]; then
                MyThesResources="${LyxAppPrefix}/Contents/Resources"
                ( cd "${DictionarySourceDir}" && find thes -name .svn -prune -o -type f -print | cpio -pmdv "${MyThesResources}" )
+               deduplicate "${MyThesResources}"/thes
        fi
 }