pkg-deinstall

#!/bin/sh

USER=agk
GROUP=agk

ask() {
local question default answer

question=$1
default=$2
if [ -z "${PACKAGE_BUILDING}" ]; then
read -p "${question} [${default}]? " answer
fi
if [ x${answer} = x ]; then
answer=${default}
fi
echo ${answer}
}

yesno() {
local dflt question answer

question=$1
dflt=$2
while :; do
answer=$(ask "${question}" "${dflt}")
case "${answer}" in
[Yy]*) return 0;;
[Nn]*) return 1;;
esac
echo "Please answer yes or no."
done
}

delete_account() {
local u g

u=$1
g=$2
if yesno "Do you want me to remove group \"${g}\"" y; then
pw groupdel -n ${g}
echo "Done."
fi
if yesno "Do you want me to remove user \"${u}\"" y; then
pw userdel -n ${u}
echo "Done."
fi
}

[ "$2" = DEINSTALL ] || exit 0

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

if ps -axc | grep -q AquaGatekeeper; then
if yesno "There are some AquaGatekeeper processes running. Shall I kill them" y
then
killall AquaGatekeeper
sleep 2
else
echo "OK ... I hope you know what you are doing."
fi
fi

delete_account ${USER} ${GROUP}
exit 0

pkg-descr

Aqua Gatekeeper 2.0 is H.323 gatekeeper and proxy by Infinet Wireless LTD.
It is compatible with many hardware/software like Cisco H.323 gateways and
Microsoft NetMeeting 3.01 for Windows 2000 and later.

This port presents Aqua Gatekeeper Startup Edition.
It is not a free software but may be used free of charge.
The Aqua Gatekeeper Startup Edition 2.0 is limited to 7 concurrent calls.

WWW: http://www.infinetwireless.com/WirelessEq/tmp/software/docs/agk_manual/agk

- Grosbein
eugen@grosbein.pp.ru

pkg-install

#!/bin/sh

USER=agk
UID=172
GROUP=${USER}
GID=${UID}

ask() {
local question default answer

question=$1
default=$2
if [ -z "${PACKAGE_BUILDING}" ]; then
read -p "${question} [${default}]? " answer
fi
if [ x${answer} = x ]; then
answer=${default}
fi
echo ${answer}
}

yesno() {
local dflt question answer

question=$1
dflt=$2
while :; do
answer=$(ask "${question}" "${dflt}")
case "${answer}" in
[Yy]*) return 0;;
[Nn]*) return 1;;
esac
echo "Please answer yes or no."
done
}

make_account() {
local u g uid gid gcos

u=$1
uid=$2
g=$3
gid=$4
gcos=$5

if pw group show "${g}" >/dev/null 2>&1; then
echo "You already have a group \"${g}\", so I will use it."
else
echo "You need a group \"${g}\"."
if which -s pw && yesno "Would you like me to create it" y; then
pw groupadd -n ${g} -g ${gid} || exit
echo "Done."
else
echo "Please create it, and try again."
if ! grep -q "^${u}:" /etc/passwd; then
echo "While you're at it, please create a user \"${u}\" too,"
echo "with a default group of \"${g}\"."
fi
exit 1
fi
fi

if pw user show "${u}" >/dev/null 2>&1; then
echo "You already have a user \"${u}\", so I will use it."
else
echo "You need a user \"${u}\"."
if which -s pw && yesno "Would you like me to create it" y; then
pw useradd -n ${u} -u ${uid} -g ${g} -h - -d /nonexistent \
-s /nonexistent -c "${gcos}" || exit
echo "Done."
else
echo "Please create it, and try again."
exit 1
fi
fi
}

[ "$2" = POST-INSTALL ] || exit 0

make_account ${USER} ${UID} ${GROUP} ${GID} "AquaGateKeeper"

pkg-message

****************************************************************************
Please read documentation located in %%PREFIX%%/share/doc/AquaGatekeeper
You will need to write configuration file to run the Gatekeeper.
Some examples are in %%PREFIX%%/share/examples/AquaGatekeeper
****************************************************************************

pkg-plist

sbin/AquaGatekeeper
etc/rc.d/agk.sh.sample
etc/AquaGatekeeper.cfg.sample
%%PORTDOCS%%%%DOCSDIR%%/AquaGatekeeper.htm
%%PORTDOCS%%%%DOCSDIR%%/CommandLineOptions.htm
%%PORTDOCS%%%%DOCSDIR%%/ConfigSyntax.htm
%%PORTDOCS%%%%DOCSDIR%%/License.rtf
%%PORTDOCS%%%%DOCSDIR%%/LicenseRus.rtf
%%PORTDOCS%%%%DOCSDIR%%/OperationPrinciples.htm
%%PORTDOCS%%%%DOCSDIR%%/RevisionHistory.htm
%%PORTDOCS%%%%DOCSDIR%%/default.css
%%PORTDOCS%%%%DOCSDIR%%/Rus/AquaGatekeeper.htm
%%PORTDOCS%%%%DOCSDIR%%/Rus/CommandLineOptions.htm
%%PORTDOCS%%%%DOCSDIR%%/Rus/ConfigSyntax.htm
%%PORTDOCS%%%%DOCSDIR%%/Rus/OperationPrinciples.htm
%%PORTDOCS%%%%DOCSDIR%%/Rus/RevisionHistory.htm
%%PORTDOCS%%%%DOCSDIR%%/Rus/default.css
%%EXAMPLESDIR%%/Example.cfg
%%PORTDOCS%%@dirrm %%DOCSDIR%%/Rus
%%PORTDOCS%%@dirrm %%DOCSDIR%%
%%PORTDOCS%%@dirrm %%EXAMPLESDIR%%