diff options
Diffstat (limited to 'databases/msql')
-rw-r--r-- | databases/msql/Makefile | 7 | ||||
-rw-r--r-- | databases/msql/distinfo | 2 | ||||
-rw-r--r-- | databases/msql/pkg-deinstall | 20 | ||||
-rw-r--r-- | databases/msql/pkg-install | 34 | ||||
-rw-r--r-- | databases/msql/scripts/createuser | 50 |
5 files changed, 58 insertions, 55 deletions
diff --git a/databases/msql/Makefile b/databases/msql/Makefile index 71ee6fdefbcc..1530397c4540 100644 --- a/databases/msql/Makefile +++ b/databases/msql/Makefile @@ -6,15 +6,14 @@ # PORTNAME= msql -PORTVERSION= 2.0.11 -PORTREVISION= 2 +PORTVERSION= 2.0.12 CATEGORIES= databases MAINTAINER= ports@FreeBSD.org INSTALLS_SHLIB= YES -# Not free for commercial use. Must create a user on the local system +# Not free for commercial use. NO_PACKAGE= YES RESTRICTED= "restrictive copyright (no commercial use)" @@ -35,7 +34,7 @@ do-configure: pre-install: @${SETENV} ${MAKE_ENV} ${PERL} ${SCRIPTDIR}/check_old_version - @${SETENV} ${MAKE_ENV} ${PERL} ${SCRIPTDIR}/createuser + PKG_PREFIX=${PREFIX} ./pkg-install ${PKGNAME} PRE-INSTALL post-install: @${INSTALL_SCRIPT} ${WRKSRC}/scripts/run_daemon ${PREFIX}/bin diff --git a/databases/msql/distinfo b/databases/msql/distinfo index d43a362eaf34..84b34837941b 100644 --- a/databases/msql/distinfo +++ b/databases/msql/distinfo @@ -1 +1 @@ -MD5 (msql-2.0.11.tar.gz) = 199890d9cd536d878f68458f4f5db3e5 +MD5 (msql-2.0.12.tar.gz) = 920eaf4fd6128d8fd4dfa66301f86dcc diff --git a/databases/msql/pkg-deinstall b/databases/msql/pkg-deinstall new file mode 100644 index 000000000000..964422e53c10 --- /dev/null +++ b/databases/msql/pkg-deinstall @@ -0,0 +1,20 @@ +#!/bin/sh +# $FreeBSD$ +# + +if [ "$2" != "POST-DEINSTALL" ]; then + exit 0 +fi + +USER=msql + +if pw usershow "${USER}" 2>/dev/null 1>&2; then + if pw userdel ${USER}; then + echo "Delete user/group \"${USER}\"." + else + echo "Deleting user/group \"${USER}\" failed..." + exit 1 + fi +fi + +exit 0 diff --git a/databases/msql/pkg-install b/databases/msql/pkg-install new file mode 100644 index 000000000000..f140382da510 --- /dev/null +++ b/databases/msql/pkg-install @@ -0,0 +1,34 @@ +#!/bin/sh +# $FreeBSD$ +# + +if [ "$2" != "PRE-INSTALL" ]; then + exit 0 +fi + +USER=msql +GROUP=${USER} +UID=87 +GID=${UID} + +if ! pw groupshow "${GROUP}" 2>/dev/null 1>&2; then + if pw groupadd ${GROUP} -g ${GID}; then + echo "Added group \"${GROUP}\"." + else + echo "Adding group \"${GROUP}\" failed..." + exit 1 + fi +fi + +if ! pw usershow "${USER}" 2>/dev/null 1>&2; then + if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \ + -s "/bin/sh" -d "/var/db/msqldb" \ + -c "mSQL-2 pseudo-user"; \ + then + echo "Added user \"${USER}\"." + else + echo "Adding user \"${USER}\" failed..." + exit 1 + fi +fi +exit 0 diff --git a/databases/msql/scripts/createuser b/databases/msql/scripts/createuser deleted file mode 100644 index 67928eedf9eb..000000000000 --- a/databases/msql/scripts/createuser +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/perl -# - -eval '(exit $?0)' && eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' -& eval 'exec /usr/bin/perl -S $0 $argv:q' -if 0; - -if( $> ) { - print "\nYou must be root to run this step!\n\n"; - exit 1; -} - -if( getpwnam( "msql" ) ) { - ( $null, $null, $msqlUID ) = getpwnam( "msql" ); -} else { - $msqlUID = 87; - while( getpwuid( $msqlUID ) ) { - $msqlUID++; - } -} - -if( getgrnam( "msql" ) ) { - ( $null, $null, $msqlGID ) = getgrnam( "msql" ); -} else { - $msqlGID = 87; - while( getgrgid( $msqlGID ) ) { - $msqlGID++; - } - &append_file( "/etc/group", "msql:*:$msqlGID:" ); -} - -print "msql user using uid $msqlUID\n"; -print "msql user using gid $msqlGID\n"; - -system( "/usr/bin/chpass -a \"msql:*:$msqlUID:$msqlGID\::0:0:mSQL-2 pseudo-user:/var/db/msqldb:/bin/sh\"" ); - -sub append_file { - local($file,@list) = @_; - local($LOCK_EX) = 2; - local($LOCK_NB) = 4; - local($LOCK_UN) = 8; - - open(F, ">> $file") || die "$file: $!\n"; - while( ! flock( F, $LOCK_EX | $LOCK_NB ) ) { - exit 1; - } - print F join( "\n", @list) . "\n"; - close F; - flock( F, $LOCK_UN ); -} |