diff options
author | sergei <sergei@FreeBSD.org> | 2003-12-09 00:08:14 +0800 |
---|---|---|
committer | sergei <sergei@FreeBSD.org> | 2003-12-09 00:08:14 +0800 |
commit | 1af9d39a030a61519820657e0f693e8d4f79f6e1 (patch) | |
tree | 680949508b272a92b7318d565af61f525489de7f /mail/dovecot-devel/pkg-install | |
parent | 4ce5391e2b1dea9717ec6106929dbda83a04fadb (diff) | |
download | freebsd-ports-gnome-1af9d39a030a61519820657e0f693e8d4f79f6e1.tar.gz freebsd-ports-gnome-1af9d39a030a61519820657e0f693e8d4f79f6e1.tar.zst freebsd-ports-gnome-1af9d39a030a61519820657e0f693e8d4f79f6e1.zip |
- Update to 0.99.10.4
- Improve pkg-install script (create /var/dovecot tree)
- Add pkg-deinstall to cleanup dovecot directories and remove
created uids at de-install; ask to stop dovecot
if it's still running
- Make pkg-message obey PREFIX/DOCSDIR
- Make use of USE_OPENLDAP, rename WITH_LDAP2 to more standard WITH_LDAP
- Remove 'Feature Autodetection'. If you want the port built with extra
dependencies, tell it: avoid bloat
- Update the rc.d script to work with relative addressing
(e.g. './dovecot.sh start' works.)
- Assign maintainership to the submitter
PR: 59762
Submitted by: Robin Breathe <robin@isometry.net>
Diffstat (limited to 'mail/dovecot-devel/pkg-install')
-rw-r--r-- | mail/dovecot-devel/pkg-install | 122 |
1 files changed, 58 insertions, 64 deletions
diff --git a/mail/dovecot-devel/pkg-install b/mail/dovecot-devel/pkg-install index dbb68998b884..1cde7df41f58 100644 --- a/mail/dovecot-devel/pkg-install +++ b/mail/dovecot-devel/pkg-install @@ -3,21 +3,17 @@ # $FreeBSD$ # -PKG_PREFIX=${PKG_PREFIX:=/usr/local} -BATCH=${BATCH:=no} +base=/var/dovecot ask() { local question default answer question=$1 default=$2 - if [ -z "${PACKAGE_BUILDING}" -a x${BATCH} = xno ]; then - read -p "${question} [${default}]? " answer + if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then + read -p "${question} [${default}]? " answer fi - if [ x${answer} = x ]; then - answer=${default} - fi - echo ${answer} + echo ${answer:-${default}} } yesno() { @@ -26,75 +22,73 @@ yesno() { question=$1 default=$2 while :; do - answer=$(ask "${question}" "${default}") - case "${answer}" in - [Yy]*) return 0;; - [Nn]*) return 1;; - esac - echo "Please answer yes or no." + answer=$(ask "${question}" "${default}") + case "${answer}" in + [Yy]*) return 0;; + [Nn]*) return 1;; + esac + echo "Please answer yes or no." done } -if [ x"$2" = xPRE-INSTALL ]; then - USER=dovecot - GROUP=dovecot +make_account() { + local u g gcos - if /usr/sbin/pw groupshow "${GROUP}" 2>/dev/null; then - echo "You already have a group \"${GROUP}\", so I will use it." - else - if /usr/sbin/pw groupadd ${GROUP} -h - - then - echo "Added group \"${GROUP}\"." - else - echo "Adding group \"${GROUP}\" failed..." - echo "Please create it, and try again." - exit 1 - fi - fi + u=$1 + g=$2 + gcos=$3 - if /usr/sbin/pw usershow "${USER}" 2>/dev/null; then - echo "You already have a user \"${USER}\", so I will use it." + if pw group show "${g}" >/dev/null 2>&1; then + echo "You already have a group \"${g}\", so I will use it." else - if /usr/sbin/pw useradd ${USER} -g ${GROUP} -h - \ - -s /sbin/nologin \ - -c "Dovecot" + echo "You need a group \"${g}\"." + if which -s pw && yesno "Would you like me to create it" y then - echo "Added user \"${USER}\"." + pw groupadd ${g} || exit + echo "Done." else - echo "Adding user \"${USER}\" failed..." - echo "Please create it, and try again." - exit 1 - fi - fi - - USER=dovecot-auth - GROUP=dovecot-auth - - if /usr/sbin/pw groupshow "${GROUP}" 2>/dev/null; then - echo "You already have a group \"${GROUP}\", so I will use it." - else - if /usr/sbin/pw groupadd ${GROUP} -h - - then - echo "Added group \"${GROUP}\"." - else - echo "Adding group \"${GROUP}\" failed..." echo "Please create it, and try again." exit 1 - fi + fi fi - - if /usr/sbin/pw usershow "${USER}" 2>/dev/null; then - echo "You already have a user \"${USER}\", so I will use it." + + if pw user show "${u}" >/dev/null 2>&1; then + echo "You already have a user \"${u}\", so I will use it." else - if /usr/sbin/pw useradd ${USER} -g ${GROUP} -h - \ - -s /sbin/nologin \ - -c "Dovecot Auth" - then - echo "Added user \"${USER}\"." + echo "You need a user \"${u}\"." + if which -s pw && yesno "Would you like me to create it" y + then + pw useradd ${u} -g ${g} -h - -s /sbin/nologin -c "${gcos}" || exit + echo "Done." else - echo "Adding user \"${USER}\" failed..." echo "Please create it, and try again." exit 1 - fi + fi fi -fi +} + +case $2 in + +PRE-INSTALL) + make_account dovecot dovecot "Dovecot" + make_account dovecot-auth dovecot-auth "Dovecot Auth" + ;; + +POST-INSTALL) + DIRLIST="${base} ${base}/auth ${base}/ssl ${base}/ssl/certs \ + ${base}/ssl/private ${base}/login /var/run/dovecot" + echo "Fixing ownerships and modes in \"${base}\"." + for directory in ${DIRLIST}; do + if [ ! -d "${directory}" ]; then + mkdir -p ${directory} + echo "Created directory: ${directory}" + fi + done + chown -R root:wheel ${base} + chown -R dovecot:dovecot ${base}/auth ${base}/ssl + chown root:dovecot ${base}/login /var/run/dovecot + chmod 0750 ${base}/login + chmod 0700 /var/run/dovecot + ;; + +esac |