#! /bin/sh

set -e

if test "$1" = configure -a -d /usr/doc -a ! -e /usr/doc/bsdmainutils -a -d /usr/share/doc/bsdmainutils
then
  ln -sf ../share/doc/bsdmainutils /usr/doc/bsdmainutils
fi

if test -f /usr/lib/calendar/default; then
  mv -f /usr/lib/calendar/default /etc/calendar/default.old
  cat <<'EOM'

NOTE: Your old `calendar' configuration file, /usr/lib/calendar/default,
      has now been moved to /etc/calendar/default.old.  If you had
      customised /usr/lib/calendar/default, you should apply those changes
      to the new calendar configuration file, /etc/calendar/default.
EOM
  rmdir /usr/lib/calendar 2>/dev/null
  if test ! -d /usr/lib/calendar; then
    echo '      (By the way, the directory /usr/lib/calendar was empty, so I have'
    echo '      now removed it for you.)'
  else
    echo '      (You will probably want to check the files left over in'
    echo '      /usr/lib/calendar, too, perhaps moving them into /etc/calendar.)'
  fi
  echo
  echo -n 'Press RETURN to continue...'
  read ANS
fi
