diff options
Diffstat (limited to 'databases/mysql50-server/pkg-install')
-rw-r--r-- | databases/mysql50-server/pkg-install | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/databases/mysql50-server/pkg-install b/databases/mysql50-server/pkg-install new file mode 100644 index 0000000..1c5dd86 --- /dev/null +++ b/databases/mysql50-server/pkg-install @@ -0,0 +1,38 @@ +#!/bin/sh + +PATH=/usr/sbin + +case $2 in +POST-INSTALL) + USER=mysql + GROUP=${USER} + UID=88 + GID=${UID} + + if pw group show "${GROUP}" 2>/dev/null; then + echo "You already have a group \"${GROUP}\", so I will use it." + else + if pw groupadd ${GROUP} -g ${GID}; then + echo "Added group \"${GROUP}\"." + else + echo "Adding group \"${GROUP}\" failed..." + exit 1 + fi + fi + + if pw user show "${USER}" 2>/dev/null; then + echo "You already have a user \"${USER}\", so I will use it." + else + if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \ + -d /var/db/mysql -s /sbin/nologin -c "MySQL Daemon" + then + echo "Added user \"${USER}\"." + else + echo "Adding user \"${USER}\" failed..." + exit 1 + fi + fi + + chown -R ${USER}.${GROUP} /var/db/mysql + ;; +esac |