home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / var / lib / dpkg / info / firefox.preinst < prev    next >
Encoding:
Text File  |  2007-04-03  |  3.0 KB  |  87 lines

  1. #!/bin/bash -e
  2.  
  3. merge_two_directories () {
  4.     link_name="$1"
  5.     link_target="$2"
  6.     if ! test -L "$link_name"   && test -d "$link_name" && \
  7.        ! test -L "$link_target" && test -d "$link_target" ; then
  8.     for f in `
  9.         find "$link_name"/.   ! -type d -printf '%P\n' | grep -xFf <( \
  10.         find "$link_target"/. ! -type d -printf '%P\n' \
  11.        )`; do
  12.        name_inode=`  stat --format=%i "$link_name/$f"`
  13.        target_inode=`stat --format=%i "$link_target/$f"`
  14.         if test x$name_inode != x$target_inode; then
  15.         echo >&2 "warning: cannot unify $link_name and $link_target\
  16.  - overlapping contents (eg, .../$f)"
  17.         return
  18.         fi
  19.     done
  20.         cp --remove-destination -al "$link_name"/. "$link_target"/.
  21.     rm -rf "$link_name"
  22.     ln -sf "$link_target" "$link_name"
  23.     fi
  24. }
  25.  
  26. #merge_two_directories /usr/lib/mozilla-firefox /usr/lib/firefox
  27.  
  28. upgrade_conffile() {
  29.     new_file="$1"
  30.     old_file="$2"
  31.     old_md5sum="$3"
  32.  
  33.     if [ -f "$old_file" ]; then
  34.         md5sum="`md5sum \"$old_file\" | sed -e \"s/ .*//\"`"
  35.     
  36.         if [ $md5sum != $old_md5sum ]; then
  37.             if [ ! -d `dirname $new_file` ]; then
  38.                 mkdir -p `dirname $new_file` > /dev/null 2>&1 || true
  39.             fi
  40.         
  41.             cp -fa "$old_file" "$new_file"
  42.         fi
  43.     fi
  44. }
  45.  
  46. # Upgrade conffiles for mozilla-firefox -> firefox transition
  47. if [ "$1" = 'install' ]; then
  48.     if [ ! -d /etc/firefox ]; then
  49.         upgrade_conffile /etc/firefox/firefoxrc \
  50.             /etc/mozilla-firefox/mozilla-firefoxrc \
  51.             'fa562ca63014f5e9dd470a37766376d6'
  52.         upgrade_conffile /etc/firefox/pref/firefox.js \
  53.             /etc/mozilla-firefox/pref/firefox.js \
  54.             '9b21e21aa3f8a0ab8f134ba04b8846ff'
  55.         upgrade_conffile /etc/firefox/profile/bookmarks.html \
  56.             /etc/mozilla-firefox/profile/bookmarks.html \
  57.             '44e419e6fc9b2a2a954b73708d5223cc'
  58.         upgrade_conffile /etc/firefox/profile/localstore.rdf \
  59.             /etc/mozilla-firefox/profile/localstore.rdf \
  60.             'ea03cc19c2a3f622fa557cd8ea9da6eb'
  61.         upgrade_conffile /etc/firefox/profile/search.rdf \
  62.             /etc/mozilla-firefox/profile/search.rdf \
  63.             '26d13f5d96ad118b5de5d234f9d052fa'
  64.         upgrade_conffile /etc/firefox/profile/mimeTypes.rdf \
  65.             /etc/mozilla-firefox/profile/mimeTypes.rdf \
  66.             '69cdcb7e0209f2e9d29000ee1c0ee2f0'
  67.         upgrade_conffile /etc/firefox/profile/chrome/userChrome-example.css \
  68.             /etc/mozilla-firefox/profile/chrome/userChrome-example.css \
  69.             '4788fdaa51b0a238cb21f5c2877ef06d'
  70.         upgrade_conffile /etc/firefox/profile/chrome/userContent-example.css \
  71.             /etc/mozilla-firefox/profile/chrome/userContent-example.css \
  72.             'd3765c7d2de5626529195007f4b7144a'
  73.     fi
  74. fi
  75.  
  76. # Remove some directories that are now symlinks
  77.  
  78. for dir in /usr/lib/firefox/icons /usr/lib/firefox/searchplugins \
  79.     /usr/lib/firefox/res /usr/lib/firefox/chrome /usr/lib/firefox/defaults \
  80.     /usr/lib/firefox/greprefs ; do
  81.   if [ -d "$dir" ]; then
  82.       rm -rf "$dir"
  83.   fi
  84. done
  85.  
  86.  
  87.