maybe this will get some comments/feedback once it's actually in the ports
tree, Fake MySQL port
This commit is contained in:
parent
10a54dca08
commit
164aaec289
@ -1,11 +1,11 @@
|
||||
# $OpenBSD: Makefile,v 1.21 2000/03/31 06:10:35 brad Exp $
|
||||
# $OpenBSD: Makefile,v 1.22 2000/04/07 19:07:20 brad Exp $
|
||||
# $FreeBSD: Makefile,v 1.44 1999/03/04 21:27:58 dirk Exp $
|
||||
|
||||
BROKEN= installs files automatically in /etc
|
||||
#BROKEN= installs files automatically in /etc
|
||||
|
||||
DISTNAME= mysql-3.22.32
|
||||
CATEGORIES= databases
|
||||
NEED_VERSION= 1.73
|
||||
NEED_VERSION= 1.234
|
||||
MASTER_SITES= http://web.tryc.on.ca/mysql/Downloads/MySQL-3.22/ \
|
||||
http://mysql.he.net/Downloads/MySQL-3.22/ \
|
||||
http://www.buoy.com/mysql/Downloads/MySQL-3.22/ \
|
||||
@ -26,18 +26,18 @@ PERMIT_DISTFILES_FTP= Yes
|
||||
BROKEN= "pthreads are currently not working on the SPARC architecture"
|
||||
.endif
|
||||
|
||||
DB_DIR?= /var/mysql
|
||||
FAKE= Yes
|
||||
|
||||
GNU_CONFIGURE= Yes
|
||||
CONFIGURE_ARGS+= ${CONFIGURE_SHARED}
|
||||
CONFIGURE_ARGS+= --enable-static \
|
||||
--localstatedir="${DB_DIR}" \
|
||||
--localstatedir="/var/mysql" \
|
||||
--without-perl \
|
||||
--without-debug \
|
||||
--without-readline \
|
||||
--without-bench \
|
||||
--without-mit-threads \
|
||||
--with-unix-socket-path="${DB_DIR}/mysql.sock"
|
||||
--with-unix-socket-path="/var/mysql/mysql.sock"
|
||||
CONFIGURE_ENV= CFLAGS="${CFLAGS} -pthread" \
|
||||
CXXFLAGS="${CXXFLAGS} -pthread"
|
||||
|
||||
@ -50,39 +50,13 @@ pre-build:
|
||||
@echo "*** for the 'limit' or 'ulimit' command."
|
||||
@echo ""
|
||||
|
||||
pre-install:
|
||||
@sed -e "s|@PREFIX@|${PREFIX}|" ${FILESDIR}/startup.sh > ${WRKDIR}/startup.sh
|
||||
.if !defined(PACKAGE_BUILDING)
|
||||
.if exists(${DB_DIR}) && !defined(OVERWRITE_DB)
|
||||
@echo "You appear to already have a mysql database directory in ${DB_DIR}."
|
||||
@echo ""
|
||||
@echo "In order to preserve your existing data, you should:"
|
||||
@echo " - dump all your databases"
|
||||
@echo " - kill mysql if it is running"
|
||||
@echo " - delete the ${DB_DIR} directory"
|
||||
@echo " - run 'make install'"
|
||||
@echo " - start up mysql"
|
||||
@echo " - re-create all of your database"
|
||||
@echo " - re-load your data"
|
||||
@echo ""
|
||||
@echo "If you understand the consequences of this upgrade, please re-build this"
|
||||
@echo "port with the environment variable OVERWRITE_DB defined."
|
||||
@false
|
||||
.endif
|
||||
@PKG_PREFIX="${PREFIX}" PKG_DB_DIR="${DB_DIR}" sh ${PKGDIR}/INSTALL ${DISTNAME} PRE-INSTALL
|
||||
.endif
|
||||
|
||||
post-install:
|
||||
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/mysql
|
||||
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/mysql/Img
|
||||
@sed -e "s|@PREFIX@|${PREFIX}|" ${FILESDIR}/startup.sh > ${WRKDIR}/startup.sh
|
||||
${INSTALL_SCRIPT} ${WRKDIR}/startup.sh ${PREFIX}/lib/mysql
|
||||
cd ${WRKSRC}/Docs; ${INSTALL_DATA} manual.html manual.ps \
|
||||
manual_toc.html manual.txt ${PREFIX}/share/doc/mysql
|
||||
${INSTALL_DATA} ${WRKSRC}/Docs/Img/*.gif ${PREFIX}/share/doc/mysql/Img
|
||||
@install-info ${PREFIX}/info/mysql.info ${PREFIX}/info/dir
|
||||
@${LDCONFIG} -m ${PREFIX}/lib/mysql
|
||||
.if !defined(PACKAGE_BUILDING)
|
||||
@PKG_PREFIX="${PREFIX}" PKG_DB_DIR="${DB_DIR}" sh ${PKGDIR}/INSTALL ${DISTNAME} POST-INSTALL
|
||||
.endif
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
# $OpenBSD: INSTALL,v 1.3 2000/02/06 23:32:38 brad Exp $
|
||||
# $OpenBSD: INSTALL,v 1.4 2000/04/07 19:07:21 brad Exp $
|
||||
#
|
||||
# Pre/post-installation setup of MySQL
|
||||
|
||||
@ -11,10 +11,29 @@ PREFIX=${PKG_PREFIX:-/usr/local}
|
||||
DB_DIR=${PKG_DB_DIR:-/var/mysql}
|
||||
MYSQLGID=40
|
||||
MYSQLUID=40
|
||||
PASS=`dd if=/dev/urandom count=1 bs=12 2> /dev/null | encrypt -b 6`
|
||||
|
||||
# Function: install the mysql user account and group
|
||||
# and create the MySQL database directory
|
||||
# Function: tell the user that an existing database directory was
|
||||
# found on their system
|
||||
do_notice_pre_install()
|
||||
{
|
||||
echo
|
||||
echo "+---------------"
|
||||
echo "| You appear to already have a MySQL database directory in ${DB_DIR}"
|
||||
echo "|"
|
||||
echo "| In order to preserve your existing data, you should:"
|
||||
echo "| - dump all your databases"
|
||||
echo "| - kill MySQL if it's running"
|
||||
echo "| - delete the ${DB_DIR} directory"
|
||||
echo "| - install MySQL"
|
||||
echo "| - start up MySQL"
|
||||
echo "| - re-create all of your database"
|
||||
echo "| - re-load your data"
|
||||
echo "+---------------"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Function: install the MySQL user account and group
|
||||
#
|
||||
do_pre_install()
|
||||
{
|
||||
@ -27,37 +46,40 @@ fi
|
||||
# Add user 'mysql' in /etc/passwd
|
||||
if [ "`egrep '^mysql:' /etc/passwd`" = "" ]; then
|
||||
echo "===> Creating mysql user, uid $MYSQLUID"
|
||||
adduser -batch mysql mysql "MySQL Account,,," ${PASS} > /dev/null 2>&1 /dev/null
|
||||
adduser -batch mysql mysql "MySQL Account" "" > /dev/null 2>&1 /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "===> Using account mysql for MySQL, uid $MYSQLUID, gid $MYSQLGID"
|
||||
echo "===> Account setup with random password. Use 'passwd mysql' to set a password."
|
||||
else
|
||||
echo "===> Problem creating account mysql"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create Database Directory mode 775
|
||||
mkdir -p -m 775 ${DB_DIR}
|
||||
chown mysql.mysql ${DB_DIR}
|
||||
echo "===> Created ${DB_DIR} directory to store db files and mysql.sock"
|
||||
}
|
||||
|
||||
# Function: create inital database
|
||||
# Function: create database directory and the initial database
|
||||
#
|
||||
do_post_install()
|
||||
{
|
||||
install -d -o mysql -g mysql -m 775 ${DB_DIR}
|
||||
|
||||
# The shell is switched back to /bin/sh to ensure that the database
|
||||
# creation can proceed successfully
|
||||
chpass -s /bin/sh mysql
|
||||
su mysql -c ${PREFIX}/bin/mysql_install_db
|
||||
chpass -s /sbin/nologin mysql
|
||||
}
|
||||
|
||||
# Verify/process the command
|
||||
#
|
||||
case $2 in
|
||||
PRE-INSTALL)
|
||||
do_pre_install $1
|
||||
if [ -d $DB_DIR ]; then
|
||||
do_notice_pre_install $1
|
||||
fi
|
||||
do_pre_install
|
||||
;;
|
||||
POST-INSTALL)
|
||||
do_post_install $1
|
||||
do_post_install
|
||||
;;
|
||||
*)
|
||||
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
|
||||
|
Loading…
Reference in New Issue
Block a user