# script

script:
  [ -f /usr/local/etc/jabber-pymsn.xml ] || cp /usr/local/share/examples/pymsn/etc/jabber-pymsn.xml /usr/local/etc/jabber-pymsn.xml
  cd /usr/local


script:
  if cmp -s /usr/local/share/examples/pymsn/etc/jabber-pymsn.xml /usr/local/etc/jabber-pymsn.xml; then rm -f /usr/local/etc/jabber-pymsn.xml; fi
  cd /usr/local


script:
  if [ -f /usr/local/info/dir ]; then if sed -e '1,/Menu:/d' /usr/local/info/dir | grep -q '^[*] '; then true; else rm /usr/local/info/dir; fi; fi


script:
  /sbin/ldconfig -R
  cd /usr/local
  #rmdir /usr/local/share/licenses 2>/dev/null || true
  if [ -f /usr/local/info/dir ]; then if sed -e '1,/Menu:/d' /usr/local/info/dir | grep -q '^[*] '; then true; else rm /usr/local/info/dir; fi; fi


script:
  cd /usr/include && /usr/local/bin/h2ph -d /usr/local/lib/perl5/site_perl/5.16/mach *.h machine/*.h sys/*.h >/dev/null
  /usr/bin/makewhatis /usr/local/lib/perl5/5.16/perl/man
  install -d /usr/local/lib/perl5/5.16/man/man3
  /usr/bin/makewhatis /usr/local/lib/perl5/5.16/man
  install -d /usr/local/lib/perl5/site_perl/5.16/mach/sys
  install -d /usr/local/lib/perl5/site_perl/5.16/mach/machine
  install -d /usr/local/lib/perl5/site_perl/5.16/mach/auto
  install -d /usr/local/lib/perl5/site_perl/5.16/auto
  cd /usr/local


script:
  find /usr/local/lib/perl5/site_perl/5.16/mach/ -name '*.ph' -delete 2>/dev/null || true
  /bin/rm -f /usr/local/lib/perl5/5.16/perl/man/whatis
  /bin/rm -f /usr/local/lib/perl5/5.16/man/whatis
  cd /usr/local


script:
  #!/bin/sh

  # $FreeBSD: head/lang/perl5.16/files/use.perl.in 349811 2014-03-31 22:26:09Z mat $

  LINK_USRBIN="yes"
  : ${OSVERSION:=`/sbin/sysctl -n kern.osreldate`};
  PERL_VERSION="5.16.3"
  PERL_VER="5.16"
  banner="# added by use.perl $(/bin/date +'%F %T')"
  special_link_list="perl perl5"

  do_remove_links()
  {
  	for binary in ${special_link_list} ; do
  		if [ -L "/usr/bin/${binary}" ] ; then
  			/bin/rm -f "/usr/bin/${binary}"
  		fi
  	done
  	bins=`/bin/ls /usr/bin/*perl*5.* ${PKG_PREFIX}/bin/*perl*5.* 2>/dev/null`
  	for binary in ${bins} ; do
  		if [ -L "${binary}" ] ; then
  			echo "use.perl: Removing ${binary} installed by an older perl port"
  			/bin/rm -f "${binary}"
  		fi
  	done
  }

  do_create_links()
  {
  	for binary in ${special_link_list} ; do
  		if [ -f "/usr/bin/${binary}" ] ; then
  			echo "use.perl: Backing up /usr/bin/${binary} as /usr/bin/${binary}.freebsd"
  			/bin/mv -f "/usr/bin/${binary}" "/usr/bin/${binary}.freebsd"
  		fi
  		if [ -e "/usr/bin/${binary}" ] ; then
  			echo "use.perl: /usr/bin/${binary} is still there, which should not happen"
  		elif [ -e "${PKG_PREFIX}/bin/perl${PERL_VERSION}" ] ; then
  			/bin/ln -sf "${PKG_PREFIX}/bin/perl${PERL_VERSION}" "/usr/bin/${binary}"
  		else
  			echo "use.perl: ${PKG_PREFIX}/bin/perl${PERL_VERSION} is not there, a symlink won't do any good"
  		fi
  	done
  }

  do_cleanup_manpath()
  {
  	if [ -f /etc/manpath.config ] ; then
  		/bin/cp -p /etc/manpath.config /etc/manpath.config.new
  		/usr/bin/awk 's=0;
  			/^#.*use.perl/ { s=1; mode=1 }
  			/^#/ { s=1; if (mode != 1) { mode=0 } }
  			/^OPTIONAL_MANPATH.*perl5/ { s=1; if (mode == 1) { mode=2 } }
  			/^$/ { s=1; if (mode != 2) { mode = 0 } }
  			{ if (s != 1) { mode = 0 } if (mode == 0) print }' /etc/manpath.config >/etc/manpath.config.new
  		/bin/mv /etc/manpath.config /etc/manpath.config.bak
  		/bin/mv /etc/manpath.config.new /etc/manpath.config
  		/bin/rm /etc/manpath.config.bak
  	fi
  }

  do_spam_manpath()
  {
  	if [ -f /etc/manpath.config ] ; then
  		echo "${banner}" >>/etc/manpath.config
  		echo "OPTIONAL_MANPATH	${PKG_PREFIX}/lib/perl5/${PERL_VER}/man" >>/etc/manpath.config
  		echo "OPTIONAL_MANPATH	${PKG_PREFIX}/lib/perl5/${PERL_VER}/perl/man" >>/etc/manpath.config
  	fi
  }


  if [ "$2" = "POST-INSTALL" ] ; then
  	if [ ${LINK_USRBIN} = yes ] ; then
  		do_remove_links
  		do_create_links
  	fi
  	if [ "${OSVERSION}" -lt 900022 ] ; then
  		do_cleanup_manpath
  		do_spam_manpath
  	fi
  elif [ "$2" = "POST-DEINSTALL" ] ; then
  	[ ${LINK_USRBIN} = yes ] && do_remove_links
  	[ "${OSVERSION}" -lt 900022 ] && do_cleanup_manpath
  fi

  exit 0


script:
  /sbin/ldconfig -m /usr/local/lib
  cd /usr/local
  file=/usr/local/info/gdbm.info
  install-info --quiet /usr/local/info/gdbm.info /usr/local/info/dir


script:
  cd /usr/local
  file=/usr/local/info/gdbm.info
  install-info --quiet --delete /usr/local/info/gdbm.info /usr/local/info/dir
  if [ $(info -d ${file%/*}  --output - 2>/dev/null | grep -c '^*') -eq 1 ]; then
    rm -f ${file%/*}/dir
  fi
  if [ ${file%/*} != "/usr/local/info" ]; then
     rmdir ${file%/*} 2> /dev/null || true
  fi


script:
  echo "===> Creating users and/or groups."
  if ! /usr/sbin/pw groupshow ejabberd >/dev/null 2>&1; then 
    echo "Creating group 'ejabberd' with gid '543'." 
    /usr/sbin/pw groupadd ejabberd -g 543; else echo "Using existing group 'ejabberd'."
  fi
  if ! /usr/sbin/pw usershow ejabberd >/dev/null 2>&1; then 
    echo "Creating user 'ejabberd' with uid '543'." 
    /usr/sbin/pw useradd ejabberd -u 543 -g 543  -c "ejabberd pseudo user" -d /var/spool/ejabberd -s /bin/sh 
    else 
  echo "Using existing user 'ejabberd'." 
  fi


script:
  [ ! -f /usr/local/etc/ejabberd/inetrc ] && cp /usr/local/etc/ejabberd/inetrc.example /usr/local/etc/ejabberd/inetrc
  install -d -g 543 -o 543 /var/spool/ejabberd
  cd /usr/local
  cd /usr/local


script:
  if cmp -s /usr/local/etc/ejabberd/ejabberd.defaults.example /usr/local/etc/ejabberd/ejabberd.defaults; then rm -f /usr/local/etc/ejabberd/ejabberd.defaults; fi
  if cmp -s /usr/local/etc/ejabberd/inetrc.example /usr/local/etc/ejabberd/inetrc; then rm -f /usr/local/etc/ejabberd/inetrc; fi
  if /usr/sbin/pw usershow ejabberd >/dev/null 2>&1; then  echo "==> You should manually remove the \"ejabberd\" user. "; fi
  cd /usr/local
  cd /usr/local


script:
  #!/bin/sh

  if [ x"$2" != x"POST-INSTALL" ]; then
      exit 0
  fi

  USERS_HOME="/var/spool/ejabberd"

  install -d -m 750 -o ejabberd -g ejabberd ${USERS_HOME} /var/log/ejabberd

  chown -R ejabberd:ejabberd  /usr/local/etc/ejabberd
  chown -R ejabberd:ejabberd  /usr/local/lib/erlang/lib/ejabberd-2.1.13
  	
  find /usr/local/lib/erlang/lib/ejabberd-2.1.13 -type f -print0 | xargs -0 chmod 444
  find /usr/local/lib/erlang/lib/ejabberd-2.1.13 -type f -print0 | xargs -0 chown root:wheel


  exit 0


script:
  #!/bin/sh

  if [ x"$2" != x"POST-DEINSTALL" ]; then
      exit 0
  fi

  cat <<EOF
  If you wish to delete ejabberd data and log files, remove
  "/var/spool/ejabberd" and "/var/log/ejabberd" directories.

  EOF

  exit 0


script:
  file=/usr/local/info/make.info
  install-info --quiet --delete /usr/local/info/make.info /usr/local/info/dir
  if [ $(info -d ${file%/*}  --output - 2>/dev/null | grep -c '^*') -eq 1 ]; then
    rm -f ${file%/*}/dir
  fi
  if [ ${file%/*} != "/usr/local/info" ]; then
     rmdir ${file%/*} 2> /dev/null || true
  fi


script:
  /sbin/ldconfig -m /usr/local/lib
  cd /usr/local
  file=/usr/local/info/libffi.info
  install-info --quiet /usr/local/info/libffi.info /usr/local/info/dir


script:
  cd /usr/local
  if [ -f /usr/local/info/dir ]; then if sed -e '1,/Menu:/d' /usr/local/info/dir | grep -q '^[*] '; then true; else rm /usr/local/info/dir; fi; fi


script:
  /sbin/ldconfig -R
  cd /usr/local
  file=/usr/local/info/libffi.info
  install-info --quiet --delete /usr/local/info/libffi.info /usr/local/info/dir
  if [ $(info -d ${file%/*}  --output - 2>/dev/null | grep -c '^*') -eq 1 ]; then
    rm -f ${file%/*}/dir
  fi
  if [ ${file%/*} != "/usr/local/info" ]; then
     rmdir ${file%/*} 2> /dev/null || true
  fi


script:
  #!/bin/sh
  #
  # $FreeBSD$
  #

  PREFIX="${PKG_PREFIX-/usr/local}"

  case $2 in
  POST-INSTALL)
  	if [ -f ${PREFIX}/lib/.nvidia/libGL.so.1 ]; then
  	  /bin/ln -f ${PREFIX}/lib/.nvidia/libGL.so.1 ${PREFIX}/lib/libGL.so
  	  /bin/ln -f ${PREFIX}/lib/.nvidia/libGL.so.1 ${PREFIX}/lib/libGL.so.1
  	else
  	  /bin/ln -f ${PREFIX}/lib/.libGL/libGL.so.1 ${PREFIX}/lib/libGL.so
  	  /bin/ln -f ${PREFIX}/lib/.libGL/libGL.so.1 ${PREFIX}/lib/libGL.so.1
  	fi
  	;;
  esac


script:
  #!/bin/sh
  #
  # $FreeBSD$
  #

  PREFIX="${PKG_PREFIX-/usr/local}"

  case $2 in
  DEINSTALL)
  	/bin/rm -f ${PREFIX}/lib/libGL.so*
  	;;
  esac


script:
  mkdir -p /usr/local/share/glib-2.0/schemas
  glib-compile-schemas /usr/local/share/glib-2.0/schemas
  mkdir -p /usr/local/share/GConf/gsettings
  mkdir -p /usr/local/lib/gio/modules
  /usr/local/bin/gio-querymodules /usr/local/lib/gio/modules 2>/dev/null || /usr/bin/true
  /sbin/ldconfig -m /usr/local/lib
  cd /usr/local


script:
  fc-cache -s /usr/local/lib/X11/fonts/TTF 2>/dev/null || true
  mkfontscale /usr/local/lib/X11/fonts/TTF 2>/dev/null || true
  mkfontdir /usr/local/lib/X11/fonts/TTF 2>/dev/null || true
  fc-cache -s /usr/local/lib/X11/fonts/OTF 2>/dev/null || true
  mkfontscale /usr/local/lib/X11/fonts/OTF 2>/dev/null || true
  mkfontdir /usr/local/lib/X11/fonts/OTF 2>/dev/null || true


script:
  fc-cache -s /usr/local/lib/X11/fonts/TTF 2>/dev/null || true
  mkfontscale /usr/local/lib/X11/fonts/TTF 2>/dev/null || true
  if [ -e /usr/local/lib/X11/fonts/TTF/fonts.scale -a "`stat -f '%z' /usr/local/lib/X11/fonts/TTF/fonts.scale 2>/dev/null`" = '2' ]; then
    rm /usr/local/lib/X11/fonts/TTF/fonts.scale
  fi
  mkfontdir /usr/local/lib/X11/fonts/TTF 2>/dev/null || true
  if [ -e /usr/local/lib/X11/fonts/TTF/fonts.dir -a "`stat -f '%z' /usr/local/lib/X11/fonts/TTF/fonts.dir 2>/dev/null`" = '2' ]; then
    rm /usr/local/lib/X11/fonts/TTF/fonts.dir
  fi
  fc-cache -s /usr/local/lib/X11/fonts/OTF 2>/dev/null || true
  mkfontscale /usr/local/lib/X11/fonts/OTF 2>/dev/null || true
  if [ -e /usr/local/lib/X11/fonts/OTF/fonts.scale -a "`stat -f '%z' /usr/local/lib/X11/fonts/OTF/fonts.scale 2>/dev/null`" = '2' ]; then
    rm /usr/local/lib/X11/fonts/OTF/fonts.scale
  fi
  mkfontdir /usr/local/lib/X11/fonts/OTF 2>/dev/null || true
  if [ -e /usr/local/lib/X11/fonts/OTF/fonts.dir -a "`stat -f '%z' /usr/local/lib/X11/fonts/OTF/fonts.dir 2>/dev/null`" = '2' ]; then
    rm /usr/local/lib/X11/fonts/OTF/fonts.dir
  fi


script:
  fc-cache -s /usr/local/lib/X11/fonts/OTF 2>/dev/null || true
  mkfontscale /usr/local/lib/X11/fonts/OTF 2>/dev/null || true
  mkfontdir /usr/local/lib/X11/fonts/OTF 2>/dev/null || true


script:
  fc-cache -s /usr/local/lib/X11/fonts/OTF 2>/dev/null || true
  mkfontscale /usr/local/lib/X11/fonts/OTF 2>/dev/null || true
  if [ -e /usr/local/lib/X11/fonts/OTF/fonts.scale -a "`stat -f '%z' /usr/local/lib/X11/fonts/OTF/fonts.scale 2>/dev/null`" = '2' ]; then
    rm /usr/local/lib/X11/fonts/OTF/fonts.scale
  fi
  mkfontdir /usr/local/lib/X11/fonts/OTF 2>/dev/null || true
  if [ -e /usr/local/lib/X11/fonts/OTF/fonts.dir -a "`stat -f '%z' /usr/local/lib/X11/fonts/OTF/fonts.dir 2>/dev/null`" = '2' ]; then
    rm /usr/local/lib/X11/fonts/OTF/fonts.dir
  fi


script:
  fc-cache -s /usr/local/lib/X11/fonts/TTF 2>/dev/null || true
  mkfontscale /usr/local/lib/X11/fonts/TTF 2>/dev/null || true
  mkfontdir /usr/local/lib/X11/fonts/TTF 2>/dev/null || true


script:
  fc-cache -s /usr/local/lib/X11/fonts/TTF 2>/dev/null || true
  mkfontscale /usr/local/lib/X11/fonts/TTF 2>/dev/null || true
  if [ -e /usr/local/lib/X11/fonts/TTF/fonts.scale -a "`stat -f '%z' /usr/local/lib/X11/fonts/TTF/fonts.scale 2>/dev/null`" = '2' ]; then
    rm /usr/local/lib/X11/fonts/TTF/fonts.scale
  fi
  mkfontdir /usr/local/lib/X11/fonts/TTF 2>/dev/null || true
  if [ -e /usr/local/lib/X11/fonts/TTF/fonts.dir -a "`stat -f '%z' /usr/local/lib/X11/fonts/TTF/fonts.dir 2>/dev/null`" = '2' ]; then
    rm /usr/local/lib/X11/fonts/TTF/fonts.dir
  fi


script:
  #!/bin/sh

  case $2 in
  POST-INSTALL)
  	/usr/sbin/mtree -U -f /usr/local/etc/mtree/BSD.gnome.dist -d -e -p ${PKG_PREFIX}
  	exit 0
  	;;
  esac


script:
  #!/bin/sh
  # $FreeBSD: head/misc/hicolor-icon-theme/files/pkg-install.in 340719 2014-01-22 15:52:06Z mat $
  #    $MCom: ports/misc/hicolor-icon-theme/files/pkg-install.in,v 1.7 2009/09/26 13:42:00 marcus Exp $

  PATH=/bin:/usr/bin:/usr/sbin

  case $2 in
  POST-INSTALL)
  	ICON_SIZES="16x16 22x22 24x24 32x32 36x36 48x48 64x64 72x72 96x96  128x128 192x192 256x256 scalable"
  	ICON_CONTEXTS="actions animations apps categories devices emblems emotes  filesystems intl mimetypes places status stock"
  	STOCK_SUBS="chart code data form image io media navigation net object table text"

  	for dir in ${ICON_SIZES}; do
  	    for ctxt in ${ICON_CONTEXTS}; do
  		mkdir -p ${PKG_PREFIX}/share/icons/hicolor/${dir}/${ctxt}
  		if [ "${ctxt}" = "stock" ]; then
  		    for sub in ${STOCK_SUBS}; do
  			mkdir -p ${PKG_PREFIX}/share/icons/hicolor/${dir}/${ctxt}/${sub}
  		    done
  		fi
  	    done
  	done
  	;;
  esac


script:
  /usr/local/bin/gdk-pixbuf-query-loaders > /dev/null 2>&1 && /usr/local/bin/gdk-pixbuf-query-loaders > /usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache 2>/dev/null || /usr/bin/true
  /sbin/ldconfig -m /usr/local/lib


script:
  if [ ! -f "/usr/local/lib/python2.7/site-packages/easy-install.pth" ]; then cp -p /usr/local/lib/python2.7/site-packages/easy-install.pth.dist /usr/local/lib/python2.7/site-packages/easy-install.pth; fi
  cd /usr/local


script:
  if cmp -s /usr/local/lib/python2.7/site-packages/easy-install.pth /usr/local/lib/python2.7/site-packages/easy-install.pth.dist; then rm -f /usr/local/lib/python2.7/site-packages/easy-install.pth; fi
  cd /usr/local


script:
  rm -f /usr/local/share/mime/XMLnamespaces 2>/dev/null || true
  rm -f /usr/local/share/mime/aliases 2>/dev/null || true
  rm -f /usr/local/share/mime/generic-icons 2>/dev/null || true
  rm -f /usr/local/share/mime/globs 2>/dev/null || true
  rm -f /usr/local/share/mime/globs2 2>/dev/null || true
  rm -f /usr/local/share/mime/icons 2>/dev/null || true
  rm -f /usr/local/share/mime/magic 2>/dev/null || true
  rm -f /usr/local/share/mime/mime.cache 2>/dev/null || true
  rm -f /usr/local/share/mime/subclasses 2>/dev/null || true
  rm -f /usr/local/share/mime/treemagic 2>/dev/null || true
  rm -f /usr/local/share/mime/types 2>/dev/null || true
  rm -f /usr/local/share/mime/version 2>/dev/null || true
  rm -fr /usr/local/share/mime/x-epoc 2>/dev/null || true
  rm -fr /usr/local/share/mime/x-content 2>/dev/null || true
  rm -fr /usr/local/share/mime/video 2>/dev/null || true
  rm -fr /usr/local/share/mime/text 2>/dev/null || true
  rm -fr /usr/local/share/mime/multipart 2>/dev/null || true
  rm -fr /usr/local/share/mime/model 2>/dev/null || true
  rm -fr /usr/local/share/mime/message 2>/dev/null || true
  rm -fr /usr/local/share/mime/inode 2>/dev/null || true
  rm -fr /usr/local/share/mime/image 2>/dev/null || true
  rm -fr /usr/local/share/mime/audio 2>/dev/null || true
  rm -fr /usr/local/share/mime/application 2>/dev/null || true


script:
  #!/bin/sh

  case $2 in
  POST-INSTALL)
  	for mdir in /usr/local/share/mime; do
  	    if [ -d ${mdir} ]; then
  		/usr/local/bin/update-mime-database ${mdir}
  	    fi
  	done
  	exit 0
  	;;
  esac


script:
  echo "===> Creating users and/or groups."
  if ! /usr/sbin/pw groupshow cups >/dev/null 2>&1; then 
    echo "Creating group 'cups' with gid '193'." 
    /usr/sbin/pw groupadd cups -g 193; else echo "Using existing group 'cups'."
  fi
  if ! /usr/sbin/pw usershow cups >/dev/null 2>&1; then 
    echo "Creating user 'cups' with uid '193'." 
    /usr/sbin/pw useradd cups -u 193 -g 193  -c "Cups Owner" -d /nonexistent -s /usr/sbin/nologin 
    else 
  echo "Using existing user 'cups'." 
  fi


script:
  if /usr/sbin/pw usershow cups >/dev/null 2>&1; then  echo "==> You should manually remove the \"cups\" user. "; fi
  cd /usr/local


script:
  echo "Updating /etc/shells"; cp /etc/shells /etc/shells.bak; (grep -v /usr/local/bin/bash /etc/shells.bak; echo /usr/local/bin/bash) >/etc/shells; rm -f /etc/shells.bak
  cp /etc/shells /etc/shells.bak; (grep -v /usr/local/bin/rbash /etc/shells.bak; echo /usr/local/bin/rbash) >/etc/shells; rm -f /etc/shells.bak
  cd /usr/local
  file=/usr/local/info/bash.info
  install-info --quiet /usr/local/info/bash.info /usr/local/info/dir


script:
  echo "Updating /etc/shells"; cp /etc/shells /etc/shells.bak; (grep -v /usr/local/bin/bash /etc/shells.bak) >/etc/shells; rm -f /etc/shells.bak
  cp /etc/shells /etc/shells.bak; (grep -v /usr/local/bin/rbash /etc/shells.bak) >/etc/shells; rm -f /etc/shells.bak
  cd /usr/local
  if [ -f /usr/local/info/dir ]; then if sed -e '1,/Menu:/d' /usr/local/info/dir | grep -q '^[*] '; then true; else rm /usr/local/info/dir; fi; fi


script:
  cd /usr/local
  file=/usr/local/info/bash.info
  install-info --quiet --delete /usr/local/info/bash.info /usr/local/info/dir
  if [ $(info -d ${file%/*}  --output - 2>/dev/null | grep -c '^*') -eq 1 ]; then
    rm -f ${file%/*}/dir
  fi
  if [ ${file%/*} != "/usr/local/info" ]; then
     rmdir ${file%/*} 2> /dev/null || true
  fi


script:
  /bin/mkdir -p /usr/local/lib/erlang/erts-5.10.4/man
  /bin/mkdir -p /usr/local/lib/erlang/lib/erl_interface-3.7.15/src/auxdir
  /bin/mkdir -p /usr/local/lib/erlang/lib/inets-5.9.8/examples/server_root/htdocs/mnesia_secret/top_secret
  /bin/mkdir -p /usr/local/lib/erlang/lib/inets-5.9.8/examples/server_root/htdocs/secret/top_secret
  /bin/mkdir -p /usr/local/lib/erlang/lib/inets-5.9.8/examples/server_root/logs
  /bin/mkdir -p /usr/local/lib/erlang/lib/kernel-2.16.4/examples/uds_dist/ebin
  /bin/mkdir -p /usr/local/lib/erlang/lib/kernel-2.16.4/examples/uds_dist/priv
  /bin/mkdir -p /usr/local/lib/erlang/lib/mnesia-4.11/include
  /bin/mkdir -p /usr/local/lib/erlang/lib/percept-0.8.8.2/priv/logs
  cd /usr/local


script:
  [ -f /usr/local/etc/ezjail.conf ] || cp -p /usr/local/etc/ezjail.conf.sample /usr/local/etc/ezjail.conf


script:
  cmp -s /usr/local/etc/ezjail.conf.sample /usr/local/etc/ezjail.conf && rm -f /usr/local/etc/ezjail.conf || true


script:
  file=/usr/local/info/m4.info
  install-info --quiet --delete /usr/local/info/m4.info /usr/local/info/dir
  if [ $(info -d ${file%/*}  --output - 2>/dev/null | grep -c '^*') -eq 1 ]; then
    rm -f ${file%/*}/dir
  fi
  if [ ${file%/*} != "/usr/local/info" ]; then
     rmdir ${file%/*} 2> /dev/null || true
  fi


script:
  #!/bin/sh
  # $FreeBSD: head/mail/majordomo/pkg-install 340719 2014-01-22 15:52:06Z mat $

  MAJORDOMOUSER=majordom
  MAJORDOMOGROUP=majordom
  UID=54
  GID=$UID

  case $2 in
  PRE-INSTALL|ADDUSER)
  	if ! pw groupshow ${MAJORDOMOGROUP} 2>/dev/null 1>&2; then
  		if pw groupadd ${MAJORDOMOGROUP} -g $GID; then
  			echo "=> Added group \"${MAJORDOMOGROUP}\"."
  		else
  			echo "=> Adding group \"${MAJORDOMOGROUP}\" failed..."
  			exit 1
  		fi
  	fi

  	if ! pw usershow ${MAJORDOMOUSER} 2>/dev/null 1>&2; then
  		if pw useradd ${MAJORDOMOUSER} -u $UID -g ${MAJORDOMOGROUP} -h - \
  			-s "/nonexistent" -d "/usr/local/majordomo" \
  			-c "Majordomo Pseudo User"; \
  		then
  			pw groupmod ${MAJORDOMOGROUP} -m ${MAJORDOMOUSER}
  			echo "=> Added user \"${MAJORDOMOUSER}\"."
  		else
  			echo "=> Adding user \"${MAJORDOMOUSER}\" failed..."
  			exit 1
  		fi
  	fi
  	;;
  POST-INSTALL)
  	# Add misc empty dirs, correct permissions
  	for dir in tmp lists/test-l.archive lists/test-l-digest.archive digests/test-l-digest; do
  		mkdir -p ${PKG_PREFIX}/majordomo/$dir
  	done
  	chown -R majordom:majordom ${PKG_PREFIX}/majordomo
  	chmod 700 ${PKG_PREFIX}/majordomo/tmp
  	chmod 755 ${PKG_PREFIX}/majordomo
  	for dir in digests lists/*.archive digests/test-l-digest; do
  		chmod 775 ${PKG_PREFIX}/majordomo/$dir
  	done
  	if [ x"${NOPORTDOCS}" = x ]; then
  		mkdir -p ${PKG_PREFIX}/majordomo/doc
  		chmod 775 ${PKG_PREFIX}/majordomo/doc
  	fi
  	chmod 755 ${PKG_PREFIX}/majordomo/lists ${PKG_PREFIX}/majordomo
  	;;
  esac

  exit 0


script:
  #!/bin/sh
  # $FreeBSD: head/mail/majordomo/pkg-deinstall 340719 2014-01-22 15:52:06Z mat $

  MAJORDOMOUSER=majordom
  MAJORDOMOGROUP=majordom

  case $2 in
  POST-DEINSTALL)
  	if pw groupshow "${MAJORDOMOGROUP}" 2>/dev/null 1>&2; then
  		echo "To delete ${MAJORDOMOGROUP} group permanently, use 'pw groupdel \"${MAJORDOMOGROUP}\"'"
  	fi
  	if pw usershow "${MAJORDOMOUSER}" 2>/dev/null 1>&2; then
  		echo "To delete ${MAJORDOMOUSER} user permanently, use 'pw userdel \"${MAJORDOMOUSER}\"'"
  	fi
  	;;
  esac
  exit 0


script:
  sample_file="/usr/local/etc/rsync/rsyncd.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  cd /usr/local
  cd /usr/local


script:
  sample_file="/usr/local/etc/rsync/rsyncd.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  cd /usr/local
  cd /usr/local


script:
  echo "===> Creating users and/or groups."
  if ! /usr/sbin/pw groupshow _spamd >/dev/null 2>&1; then 
    echo "Creating group '_spamd' with gid '132'." 
    /usr/sbin/pw groupadd _spamd -g 132; else echo "Using existing group '_spamd'."
  fi
  if ! /usr/sbin/pw usershow _spamd >/dev/null 2>&1; then 
    echo "Creating user '_spamd' with uid '132'." 
    /usr/sbin/pw useradd _spamd -u 132 -g 132  -c "Spam Daemon" -d /var/empty -s /usr/sbin/nologin 
    else 
  echo "Using existing user '_spamd'." 
  fi


script:
  if /usr/sbin/pw usershow _spamd >/dev/null 2>&1; then  echo "==> You should manually remove the \"_spamd\" user. "; fi
  cd /usr/local
  cd /usr/local


script:
  #!/bin/sh
  #
  # ex:ts=4:sw=4:noet
  #-*- mode: makefile; tab-width: 4; -*-
  #
  # $FreeBSD: head/mail/spamd/files/pkg-install.in 340719 2014-01-22 15:52:06Z mat $

  SPAMDUSER=_spamd
  SPAMDGROUP=_spamd
  FILE="/etc/services"

  check_db() {
  	DB=/var/db/spamd
  	if [ -f ${DB} ]; then
  		OWN=$(stat -f "%Su" ${DB})
  		GRP=$(stat -f "%Sg" ${DB})
  		if [ "x${OWN}" != "x${SPAMDUSER}" ]; then
  			echo "==> chown ${SPAMDUSER} ${DB} (previous ${OWN})"
  				chown ${SPAMDUSER} ${DB}
  		fi
  		if [ "x${GRP}" != "x${SPAMDGROUP}" ]; then
  			echo "==> chgrp ${SPAMDGROUP} ${DB} (previous ${GRP})"
  			chgrp ${SPAMDGROUP} ${DB}
  		fi
  	fi
  }

  check_service() {
  	local SERVICE PORT PROTO COMMENT

  	SERVICE=$1
  	PORT=$2
  	PROTO=$3
  	COMMENT=$4

  	# check
  	OK=no
  	HAS_SERVICE=no
  	COUNT=1
  	for i in $(grep ^${SERVICE} ${FILE}); do
  		if [ ${COUNT} -eq 1 ] && [ x"${i}" = x"${SERVICE}" ]; then
  			HAS_SERVICE=yes
  		elif [ ${COUNT} -eq 2 ] && [ "${HAS_SERVICE}" = "yes" ] && \
  			[ x"${i}" = x"${PORT}/${PROTO}" ]; then
  			OK=yes
  			break
  		fi
  		COUNT=$(( ${COUNT} + 1 ))
  	done
  	# add an entry for SERVICE to /etc/services
  	if [ "${OK}" = "no" ]; then
  		echo "==> add entry \"${SERVICE} ${PORT}/${PROTO}\""
  		(
  			grep -v -e "^${SERVICE}.*${PORT}/${PROTO}" ${FILE}
  			echo "${SERVICE}	${PORT}/${PROTO}   # ${COMMENT}"
  		) >> ${FILE}.new
  		mv ${FILE}.new ${FILE}
  	fi
  }

  # always add service entries
  if [ "$2" = "PRE-INSTALL" ]; then
  	echo "Checking ${FILE} for missing service entries"
  	[ ! -f ${FILE} ] && echo "==> cannot find ${FILE} ... => exit" &&  exit 1
  	check_service spamd 8025 tcp "spamd(8)"
  	check_service spamd-sync 8025 udp "spamd(8) synchronisation"
  	check_service spamd-cfg 8026 tcp "spamd(8) configuration"
  fi

  if [ "$2" = "POST-INSTALL" ]; then
  	check_db
  fi


script:
  #!/bin/sh
  #
  # ex:ts=4:sw=4:noet
  #-*- mode: makefile; tab-width: 4; -*-
  #
  # $FreeBSD: head/mail/spamd/pkg-deinstall 340719 2014-01-22 15:52:06Z mat $

  if [ "$2" = "DEINSTALL" ]; then
  	FILE="/etc/services"
  	echo "===>   Removing spamd entries from ${FILE}"
  	sed -i '' \
  		-e "/^spamd-sync.*8025/d" \
  		-e "/^spamd-cfg.*8026/d" \
  		-e "/^spamd.*8025/d" \
  		${FILE}
  fi


script:
  #!/bin/sh

  # If:
  #   1) syslog.conf exists
  #   2) it doesn't already contain some (uncommented) sshguard directive
  # then add $SSHGUARDCONFLINE (commented) right at the end of the header
  # comments section in syslog.conf

  # real syslog.conf configuration file path
  SYSLOGCONF=/etc/syslog.conf
  # configuration line to add
  SSHGUARDCONFLINE="auth.info;authpriv.info     |exec $PKG_PREFIX/sbin/sshguard"

  case "$2" in
      "POST-INSTALL")
          if test "$SSHGUARDFW" = hosts
          then
              touch /etc/hosts.allow
          fi
          if (test -f "$SYSLOGCONF" && ! grep -q sshguard "$SYSLOGCONF")
          then
              # append default sshguard entry in syslog.conf (first line after comments header)
  	    TMPFILE=`mktemp -q /tmp/syslogcXX`
  	    # make sure our file has the same permissions as the original, since we mv it back
  	    cp -p $SYSLOGCONF ${TMPFILE}
  	    : > ${TMPFILE}
              inheader=1
              cat "$SYSLOGCONF" | while read cline ;
              do
                  if (test $inheader -eq 1 && !(echo "$cline" | grep -q "^[[:space:]]*#"))
                  then
                      # got off of header comments
                      inheader=0
                      echo "#$SSHGUARDCONFLINE" >> $TMPFILE
                  fi
                  echo "$cline" >> $TMPFILE
              done
              mv $TMPFILE "$SYSLOGCONF"
          fi
  ;;
  esac


script:
  #!/bin/sh

  # If:
  #   1) syslog.conf exists
  #   2) it does contain some directive for sshguard
  # then do the following:
  #   @ if the directive was the default directive (as installed by pkg-install)
  #       then remove it
  #   @ if the directive is some custom (uncommented) directive, comment it
  # and reload syslogd eventually.

  # real syslog.conf configuration file path
  SYSLOGCONF=/etc/syslog.conf
  # configuration line to add
  SSHGUARDCONFLINE="auth.info;authpriv.info     |exec $PKG_PREFIX/sbin/sshguard"

  case "$2" in
  	"DEINSTALL")
  	    if test -f "$SYSLOGCONF" && grep -q '^[^#].*sshguard' "$SYSLOGCONF"
          then
              if ! TMPFILE=`mktemp -q /tmp/syslogcXX`; then
  		echo "Couldn't create temporary file"
  		exit 1
  	    fi
              if grep -qx "$SSHGUARDCONFLINE" "$SYSLOGCONF"
              then
                  # remove default sshguard entry from syslog.conf
                  echo "I'm removing the default sshguard syslog entry for you..."
                  grep -vx "$SSHGUARDCONFLINE" "$SYSLOGCONF" > $TMPFILE
              else
                  # comment customized sshguard configuration line
                  echo "I'm commenting your custom sshguard syslog entry for you..."
                  sed "s/^[^#].*sshguard.*/#&/" < "$SYSLOGCONF" > $TMPFILE
              fi
              mv $TMPFILE "$SYSLOGCONF"
              /etc/rc.d/syslogd reload
  		fi
  	;;
  esac


script:
  /bin/mkdir -p /usr/local/lib/gettext
  /sbin/ldconfig -m /usr/local/lib
  file=/usr/local/info/autosprintf.info
  install-info --quiet /usr/local/info/autosprintf.info /usr/local/info/dir
  file=/usr/local/info/gettext.info
  install-info --quiet /usr/local/info/gettext.info /usr/local/info/dir


script:
  /sbin/ldconfig -R
  file=/usr/local/info/autosprintf.info
  install-info --quiet --delete /usr/local/info/autosprintf.info /usr/local/info/dir
  if [ $(info -d ${file%/*}  --output - 2>/dev/null | grep -c '^*') -eq 1 ]; then
    rm -f ${file%/*}/dir
  fi
  if [ ${file%/*} != "/usr/local/info" ]; then
     rmdir ${file%/*} 2> /dev/null || true
  fi
  file=/usr/local/info/gettext.info
  install-info --quiet --delete /usr/local/info/gettext.info /usr/local/info/dir
  if [ $(info -d ${file%/*}  --output - 2>/dev/null | grep -c '^*') -eq 1 ]; then
    rm -f ${file%/*}/dir
  fi
  if [ ${file%/*} != "/usr/local/info" ]; then
     rmdir ${file%/*} 2> /dev/null || true
  fi


script:
  [ -f /usr/local/etc/fonts/fonts.conf ] || cp /usr/local/etc/fonts/fonts.conf.default /usr/local/etc/fonts/fonts.conf
  /sbin/ldconfig -m /usr/local/lib


script:
  if cmp -s /usr/local/etc/fonts/fonts.conf /usr/local/etc/fonts/fonts.conf.default; then rm -f /usr/local/etc/fonts/fonts.conf; fi
  rm -rf /var/db/fontconfig 2>/dev/null || true


script:
  #!/bin/sh

  PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
  export PATH

  if [ "$2" = "POST-INSTALL" ]; then
      echo "Running fc-cache to build fontconfig cache..."
      fc-cache -f -v
      exit 0
  fi


script:
  /usr/bin/find /usr/local/share/icons -type d -depth 1 -exec /usr/local/bin/gtk-update-icon-cache -q -f {} \; 2>/dev/null || /usr/bin/true
  /usr/local/bin/gtk-query-immodules-2.0 --update-cache > /dev/null 2>&1 || /usr/bin/true
  /bin/mkdir -p /usr/local/lib/gtk-2.0/modules
  /bin/mkdir -p /usr/local/lib/gtk-2.0/2.10.0/engines
  /bin/mkdir -p /usr/local/lib/gtk-2.0/2.10.0/loaders
  /bin/mkdir -p /usr/local/lib/gtk-2.0/2.10.0/modules
  /sbin/ldconfig -m /usr/local/lib
  cd /usr/local


script:
  /usr/bin/find /usr/local/share/icons -type f -depth 2 -name icon-theme.cache -delete 2>/dev/null || /usr/bin/true
  /bin/rm -f /usr/local/lib/gtk-2.0/2.10.0/immodules.cache
  cd /usr/local


script:
  #!/bin/sh
  #
  #	$FreeBSD: head/security/cyrus-sasl2/pkg-install 340719 2014-01-22 15:52:06Z mat $
  #
  # Created by: stb@FreeBSD.org for the cyrus imap server
  # Added to the cyrus-sasl port by hetzels@westbend.net

  #set -vx

  PKG_BATCH=${BATCH:=NO}

  PKG_PREFIX=${PKG_PREFIX:=/usr/local}

  SASLDB_NAME=${PKG_PREFIX}/etc/sasldb2.db

  CYRUS_USER=${CYRUS_USER:=cyrus}
  CYRUS_GROUP=${CYRUS_GROUP:=cyrus}

  #
  # create 'cyrus' user and group before installing
  #

  create_user() {
  	USER=${CYRUS_USER}
  	GROUP=${CYRUS_GROUP}
  	PW=/usr/sbin/pw

  	if [ -x /usr/sbin/nologin ]; then
  		shell=/usr/sbin/nologin
  	elif [ -x /sbin/nologin ]; then
  		shell=/sbin/nologin
  	else
  		shell=/nonexistent
  	fi
  	uhome="/nonexistent"

  	if ! ${PW} show group ${GROUP} -q >/dev/null; then
  		gid=60
  		while ${PW} show group -g ${gid} -q >/dev/null; do
  			gid=`expr ${gid} + 1`
  		done
  		if ! ${PW} add group ${GROUP} -g ${gid}; then
  			e=$?
  			echo "*** Failed to add group \`${GROUP}'. Please add it manually."
  			exit ${e}
  		fi
  		echo "*** Added group \`${GROUP}' (id ${gid})"
  	else
  		gid=`${PW} show group ${GROUP} 2>/dev/null | cut -d: -f3`
  	fi

  	if ! ${PW} show user ${USER} -q >/dev/null; then
  		uid=60
  		while ${PW} show user -u ${uid} -q >/dev/null; do
  			uid=`expr ${uid} + 1`
  		done
  		if ! ${PW} add user ${USER} -u ${uid} -g ${gid} -d "${uhome}" \
  				-c "the cyrus mail server" -s "${shell}" -p "*" \
  				; then
  			e=$?
  			echo "*** Failed to add user \`${USER}'. Please add it manually."
  			exit ${e}
  		fi
  		echo "*** Added user \`${USER}' (id ${uid})"
  	else
  		if ! ${PW} mod user ${USER} -g ${gid}; then
  			e=$?
  			echo "*** Failed to update user \`${USER}'."
  			exit ${e}
  		fi
  		echo "*** Updated user \`${USER}'."
  	fi
  }

  create_sasldb() {
  	if [ ! -f ${SASLDB_NAME} ]; then
  		echo "test" | ${PKG_PREFIX}/sbin/saslpasswd2 -p -c ${CYRUS_USER}
  		if [ `${PKG_PREFIX}/sbin/sasldblistusers2 | wc -l` -eq 0 ] ; then
                          echo "WARNING: Failed to create ${SASLDB_NAME}"
                  else
  			${PKG_PREFIX}/sbin/saslpasswd2 -d ${CYRUS_USER}
  			chown ${CYRUS_USER}:mail ${SASLDB_NAME}
  			chmod 640 ${SASLDB_NAME}
  		fi
  	fi
  }

  case $2 in
  	PRE-INSTALL)
  		create_user
  		;;
  	POST-INSTALL)
  		if [ "${PKG_BATCH}" = "NO" ]; then
  			create_sasldb
  		elif [ ! -f ${SASLDB_NAME} ]; then
  			echo "*** We do not create ${SASLDB_NAME} automatically in"
  			echo "*** BATCH mode.  Please create it by yourself.  It should be"
  			echo "*** owner: ${CYRUS_USER}, group: mail, mode: 0640."
  		fi
  		;;

  esac


script:
  #!/bin/sh
  #
  #	$FreeBSD: head/security/cyrus-sasl2/pkg-deinstall 340719 2014-01-22 15:52:06Z mat $
  #
  # Created by: hetzels@westbend.net

  #set -vx

  PKG_BATCH=${BATCH:=NO}

  PKG_PREFIX=${PKG_PREFIX:=/usr/local}

  SASLDB_NAME=${PKG_PREFIX}/etc/sasldb2.db

  CYRUS_USER=${CYRUS_USER:=cyrus}
  CYRUS_GROUP=${CYRUS_GROUP:=cyrus}

  # delete sasldb database

  delete_sasldb() {
  	if [ -f ${SASLDB_NAME} ] ; then
  		if [ `${PKG_PREFIX}/sbin/sasldblistusers2 | wc -l` -eq 0 ]; then
  			rm ${SASLDB_NAME}
  		else
  			echo "WARNING: Users SASL passwords are in ${SASLDB_NAME}, keeping this file"
  		fi
  	fi
  }

  delete_user() {
  	if pw usershow ${CYRUS_USER} 2>/dev/null 1>&2; then
  		echo "To delete Cyrus user permanently, use 'pw userdel ${CYRUS_USER}'"
  	fi
  	if pw groupshow ${CYRUS_GROUP} 2>/dev/null 1>&2; then
  		echo "To delete Cyrus group permanently, use 'pw groupdel ${CYRUS_GROUP}'"
  	fi

  }

  case $2 in
  	DEINSTALL)
  		delete_sasldb
  		;;
  	POST-DEINSTALL)
  		delete_user
  		;;

  esac


script:
  mkdir -p /var/run/saslauthd
  chown -R cyrus:mail /var/run/saslauthd
  chmod -R ug=rwx,o= /var/run/saslauthd
  cd /usr/local
  cd /usr/local
  cd /usr/local


script:
  #!/bin/sh
  #
  #	$FreeBSD: head/security/cyrus-sasl2-saslauthd/pkg-install 340719 2014-01-22 15:52:06Z mat $
  #

  PKG_BATCH=${BATCH:=NO}
  PKG_PREFIX=${PKG_PREFIX:=/usr/local}

  # This should really be installed by Sendmail
  sendmail_conf() {
  	if [ ! -f ${PKG_PREFIX}/lib/sasl2/Sendmail.conf ]; then
  		echo "pwcheck_method: saslauthd" > ${PKG_PREFIX}/lib/sasl2/Sendmail.conf
  	fi
  }

  case $2 in
  POST-INSTALL)
  	if [ "${PKG_BATCH}" = "NO" ]; then
  		sendmail_conf
  	fi
  	;;
  esac


script:
  #!/bin/sh
  #
  #	$FreeBSD: head/security/cyrus-sasl2-saslauthd/pkg-deinstall 340719 2014-01-22 15:52:06Z mat $
  #

  PKG_BATCH=${BATCH:=NO}
  PKG_PREFIX=${PKG_PREFIX:=/usr/local}

  remove_file()
  {
  	file=$1

  	if cmp -s ${file} ${file}.tmp; then
  		rm -f ${file}
  	fi
  	rm -f ${file}.tmp
  }

  # This should really be uninstalled by Sendmail
  sendmail_conf() {
  	if [ -f ${PKG_PREFIX}/lib/sasl2/Sendmail.conf ]; then
  		echo "pwcheck_method: saslauthd" > ${PKG_PREFIX}/lib/sasl2/Sendmail.conf.tmp
  		remove_file ${PKG_PREFIX}/lib/sasl2/Sendmail.conf
  	fi
  }

  case $2 in
  DEINSTALL)
  	sendmail_conf
  	;;
  esac


script:
  echo "===> Creating users and/or groups."
  if ! /usr/sbin/pw groupshow dovecot >/dev/null 2>&1; then 
    echo "Creating group 'dovecot' with gid '143'." 
    /usr/sbin/pw groupadd dovecot -g 143; else echo "Using existing group 'dovecot'."
  fi
  if ! /usr/sbin/pw usershow dovecot >/dev/null 2>&1; then 
    echo "Creating user 'dovecot' with uid '143'." 
    /usr/sbin/pw useradd dovecot -u 143 -g 143  -c "Dovecot User" -d /var/empty -s /usr/sbin/nologin 
    else 
  echo "Using existing user 'dovecot'." 
  fi


script:
  if [ ! -f /usr/local/etc/dovecot.conf ]; then cp -p /usr/local/share/examples/dovecot/dovecot.conf /usr/local/etc/dovecot.conf; fi
  install -o root -g wheel -m 0755 -d /usr/local/lib/dovecot/auth
  /sbin/ldconfig -m /usr/local/lib/dovecot  /usr/local/lib/dovecot/imap  /usr/local/lib/dovecot/pop3  /usr/local/lib/dovecot/lda
  cd /usr/local
  cd /usr/local
  cd /usr/local


script:
  if cmp -s /usr/local/share/examples/dovecot/dovecot.conf /usr/local/etc/dovecot.conf; then rm -f /usr/local/etc/dovecot.conf; fi
  if /usr/sbin/pw usershow dovecot >/dev/null 2>&1; then  echo "==> You should manually remove the \"dovecot\" user. "; fi
  cd /usr/local
  cd /usr/local
  cd /usr/local


script:
  #! /bin/sh
  #
  #	$FreeBSD: /tmp/pcvs/ports/mail/dovecot/files/pkg-deinstall.in,v 1.2 2008-11-28 14:38:26 wxs Exp $
  #

  case $2 in
  DEINSTALL)
  	echo "If you don't intend on reinstalling this port you should manually 'rm -rf /var/db/dovecot' if anything was stored there."
  	;;
  esac


script:
  sample_file="/usr/local/etc/lighttpd/lighttpd.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/modules.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/access_log.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/auth.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/cml.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/cgi.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/compress.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/debug.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/dirlisting.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/evhost.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/expire.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/fastcgi.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/magnet.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/mime.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/mysql_vhost.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/proxy.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/rrdtool.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/scgi.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/secdownload.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/simple_vhost.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/ssi.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/status.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/trigger_b4_dl.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/userdir.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/webdav.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  cd /
  /bin/mkdir -p -m 0700 /var/log/lighttpd
  /usr/sbin/chown www:www /var/log/lighttpd
  cd /usr/local
  cd /usr/local


script:
  sample_file="/usr/local/etc/lighttpd/lighttpd.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/modules.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/access_log.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/auth.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/cml.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/cgi.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/compress.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/debug.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/dirlisting.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/evhost.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/expire.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/fastcgi.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/magnet.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/mime.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/mysql_vhost.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/proxy.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/rrdtool.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/scgi.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/secdownload.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/simple_vhost.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/ssi.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/status.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/trigger_b4_dl.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/userdir.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  sample_file="/usr/local/etc/lighttpd/conf.d/webdav.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  cd /
  cd /usr/local
  cd /usr/local


script:
  mkdir -p /usr/local/lib/vmware-tools/modules/input
  /sbin/ldconfig -m /usr/local/lib
  /usr/sbin/kldxref /boot/modules
  cd /usr/local
  cd /usr/local


script:
  if test -f /usr/local/share/vmware-tools/tools.conf; then rm -f /usr/local/share/vmware-tools/tools.conf; fi
  if test -h /usr/local/etc/vmware-tools/plugins; then rm -f /usr/local/etc/vmware-tools/plugins; fi
  cd /usr/local
  cd /usr/local


script:
  sample_file="/usr/local/etc/poudriere.conf.sample"
  target_file="${sample_file%.sample}"
  if ! [ -f "${target_file}" ]; then
    /bin/cp -p "${sample_file}" "${target_file}"
  fi
  cd /usr/local


script:
  sample_file="/usr/local/etc/poudriere.conf.sample"
  target_file="${sample_file%.sample}"
  if cmp -s "${target_file}" "${sample_file}"; then
    rm -f "${target_file}"
  fi
  cd /usr/local


script:
  #!/bin/sh
  #
  # Date created:				18 Apr 2010
  # Whom:					ohauer@gmx.de
  #
  # Try to activate mod_dav.so in httpd.conf only if the module is not already active.
  # This script is a workaround for apxs bug: 
  # https://issues.apache.org/bugzilla/show_bug.cgi?id=47397
  #
  # $FreeBSD: head/devel/subversion/files/pkg-install.in 340719 2014-01-22 15:52:06Z mat $
  #

  if [ "NO" != "YES" ] ; then
  	exit 0
  fi

  if [ "$2" != "PRE-INSTALL" ]; then
  	exit 0
  fi

  APXSCMD=${PKG_PREFIX}/sbin/apxs

  if [ ! -x ${APXSCMD} ]; then
  	echo Can\'t find the apxs program: ${APXSCMD}.
  	exit 1
  fi

  SYSCONFDIR=`${APXSCMD} -q SYSCONFDIR`
  LIBEXECDIR=`${APXSCMD} -q LIBEXECDIR`

  if [ ! -d "${SYSCONFDIR}" ]; then
  	echo Can\'t find Apache conf dir: ${SYSCONFDIR}
  	exit 1
  fi

  if [ -f "${SYSCONFDIR}/httpd.conf" ]; then
  	CONFFILE=httpd.conf
  fi

  if [ -z "${CONFFILE}" ]; then
  	echo "Can\'t find ${SYSCONFDIR}/${CONFFILE}"
  	exit 1
  fi

  # use only 'egrep -e' else the check works not correct
  if [ ! -n "`egrep -e '^LoadModule[[:blank:]]+dav_module' ${SYSCONFDIR}/${CONFFILE}`" ]; then
  	if [ -f ${LIBEXECDIR}/mod_dav.so ]; then
  		${APXSCMD} -e -S LIBEXECDIR=${LIBEXECDIR} -a -n dav ${LIBEXECDIR}/mod_dav.so
  	else
  		echo "cannot find ${LIBEXECDIR}/mod_dav.so"
  		exit 1
  	fi
  else
  	echo  "dav_module already active in ${SYSCONFDIR}/${CONFFILE}"
  fi

  exit 0


script:
  if [ ! -f /usr/local/etc/sudoers ] ; then cp -p /usr/local/etc/sudoers.sample /usr/local/etc/sudoers; fi
  if [ ! -f /usr/local/etc/pam.d/sudo ] ; then cp -p /usr/local/etc/pam.d/sudo.default /usr/local/etc/pam.d/sudo; fi
  cd /
  cd /usr/local
  cd /usr/local


script:
  if cmp -s /usr/local/etc/sudoers.sample /usr/local/etc/sudoers; then rm -f /usr/local/etc/sudoers; fi
  if cmp -s /usr/local/etc/pam.d/sudo.default /usr/local/etc/pam.d/sudo; then rm -f /usr/local/etc/pam.d/sudo ; fi
  cd /
  cd /usr/local
  cd /usr/local


