doinst.sh 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. config() {
  2. NEW="$1"
  3. OLD="$(dirname $NEW)/$(basename $NEW .new)"
  4. # If there's no config file by that name, mv it over:
  5. if [ ! -r $OLD ]; then
  6. mv $NEW $OLD
  7. elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
  8. # toss the redundant copy
  9. rm $NEW
  10. fi
  11. # Otherwise, we leave the .new copy for the admin to consider...
  12. }
  13. preserve_perms() {
  14. NEW="$1"
  15. OLD="$(dirname $NEW)/$(basename $NEW .new)"
  16. if [ -e $OLD ]; then
  17. cp -a $OLD ${NEW}.incoming
  18. cat $NEW > ${NEW}.incoming
  19. mv ${NEW}.incoming $NEW
  20. fi
  21. config $NEW
  22. }
  23. schema_install() {
  24. SCHEMA="$1"
  25. GCONF_CONFIG_SOURCE="xml::etc/gconf/gconf.xml.defaults" \
  26. chroot . gconftool-2 --makefile-install-rule \
  27. /etc/gconf/schemas/$SCHEMA \
  28. 1>/dev/null
  29. }
  30. schema_install blah.schemas
  31. preserve_perms etc/rc.d/rc.INIT.new
  32. config etc/configfile.new
  33. if [ -x /usr/bin/update-desktop-database ]; then
  34. /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
  35. fi
  36. if [ -x /usr/bin/update-mime-database ]; then
  37. /usr/bin/update-mime-database usr/share/mime >/dev/null 2>&1
  38. fi
  39. # If other icon themes are installed, then add to/modify this as needed
  40. if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
  41. if [ -x /usr/bin/gtk-update-icon-cache ]; then
  42. /usr/bin/gtk-update-icon-cache -f usr/share/icons/hicolor >/dev/null 2>&1
  43. fi
  44. fi
  45. if [ -e usr/share/glib-2.0/schemas ]; then
  46. if [ -x /usr/bin/glib-compile-schemas ]; then
  47. /usr/bin/glib-compile-schemas usr/share/glib-2.0/schemas >/dev/null 2>&1
  48. fi
  49. fi
  50. # If needed -- be sure to sed @LIBDIR@ inside the build script
  51. chroot . /usr/bin/gio-querymodules @LIBDIR@/gio/modules/ 1> /dev/null 2> /dev/null
  52. if [ -x /usr/bin/install-info ]; then
  53. chroot . /usr/bin/install-info --info-dir=/usr/info /usr/info/blah.gz 2> /dev/null
  54. fi
  55. # WARNING
  56. # When upgradepkg is used, doinst.sh gets run twice. So don't put
  57. # anything here that takes a long time to run.