-#!/bin/sh
-set -o errexit
-
-# First argument of this script is the package name
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# This server is configured to use SSL only, no plain-text passwords.
-
-# Applying patches (if any)
-apply_patches ${1}
-
-cd ${LFS_TMP}/${1}
-
-# Setting default mailbox format for imapd
-sed -i -e "s!^\(CREATEPROTO=\)unixproto!\1${MAILBOX_FORMAT}proto!" src/osdep/unix/Makefile
-
-make lnp
-
-# Installing imapd
-install -m 755 imapd/imapd /usr/bin
-install -m 644 src/imapd/imapd.8 /usr/man/man8/imapd.8
-
-# Installing mailutil
-install -m 755 mailutil/mailutil /usr/bin
-install -m 644 src/mailutil/mailutil.1 /usr/man/man1/mailutil.1
-
-# Installing dmail
-install -m 755 dmail/dmail /usr/bin
-install -m 644 src/dmail/dmail.1 /usr/man/man1/dmail.1
-
-# Installing C-library
-mkdir -p /usr/lib/uw-imap/{include,lib}
-install -m 644 c-client/c-client.a /usr/lib/uw-imap/lib
-ln -sf /usr/lib/uw-imap/lib/c-client.a /usr/lib/uw-imap/lib/libc-client.a
-install -m 644 c-client/*.h /usr/lib/uw-imap/include
-install -m 644 src/osdep/tops-20/shortsym.h /usr/lib/uw-imap/include
-
-# Addition to /etc/inetd.conf
-string_add "imaps stream tcp nowait.400 root /usr/bin/imapd imapd" /etc/inetd.conf
+#!/bin/bash
+
+hvbuild()
+{
+ cd ${LFS_TMP}/${PACKAGE}
+
+ # Setting default mailbox format for imapd
+ sed -i -e "s!^\(CREATEPROTO=\)unixproto!\1${MAILBOX_FORMAT}proto!" \
+ src/osdep/unix/Makefile
+ make lnp
+
+ # Installing imapd
+ install -m 755 imapd/imapd /usr/bin
+ install -m 644 src/imapd/imapd.8 /usr/man/man8/imapd.8
+
+ # Installing mailutil
+ install -m 755 mailutil/mailutil /usr/bin
+ install -m 644 src/mailutil/mailutil.1 /usr/man/man1/mailutil.1
+
+ # Installing dmail
+ install -m 755 dmail/dmail /usr/bin
+ install -m 644 src/dmail/dmail.1 /usr/man/man1/dmail.1
+
+ # Installing C-library
+ mkdir -p /usr/lib/uw-imap/{include,lib}
+ install -m 644 c-client/c-client.a /usr/lib/uw-imap/lib
+ ln -sf /usr/lib/uw-imap/lib/c-client.a /usr/lib/uw-imap/lib/libc-client.a
+ install -m 644 c-client/*.h /usr/lib/uw-imap/include
+ install -m 644 src/osdep/tops-20/shortsym.h /usr/lib/uw-imap/include
+
+ # Addition to xinetd
+ cat > /etc/xinetd.d/imapd << "EOF"
+service imap
+{
+ disable = no
+ socket_type = stream
+ protocol = tcp
+ wait = no
+ user = root
+ server = /usr/bin/imapd
+ log_type = SYSLOG local4 info
+}
+EOF