openbsd-ports/databases/mysql/patches/patch-scripts_mysql_install_db_sh
robert 0bb447be4f update to version 5.0.45 that includes bugfixes and a couple of security
fixes too;

move to a new way of documenting the usage of mysql,
based on the documentation that can found in postgresql port

the original diff was from Brad; fixes from Stuart Henderson and me;

ok naddy@, espie@, pvalchev@
2007-08-08 21:33:51 +00:00

75 lines
2.2 KiB
Plaintext

$OpenBSD: patch-scripts_mysql_install_db_sh,v 1.8 2007/08/08 21:33:51 robert Exp $
--- scripts/mysql_install_db.sh.orig Wed Jul 4 09:06:09 2007
+++ scripts/mysql_install_db.sh Sat Jul 14 16:19:38 2007
@@ -21,7 +21,8 @@
in_rpm=0
windows=0
defaults=""
-user=""
+user=_mysql
+group=_mysql
case "$1" in
--no-defaults|--defaults-file=*|--defaults-extra-file=*)
@@ -59,6 +60,7 @@ parse_arguments() {
# as 'user' (crucial e.g. if log-bin=/some_other_path/
# where a chown of datadir won't help)
user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
+ --group=*) group=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--skip-name-resolve) ip_only=1 ;;
--verbose) verbose=1 ;; # Obsolete
--rpm) in_rpm=1 ;;
@@ -252,20 +254,18 @@ fi
# Create database directories mysql & test
if test ! -d $ldata; then
- mkdir $ldata;
+ mkdir -p $ldata;
chmod 700 $ldata ;
fi
if test ! -d $ldata/mysql; then
- mkdir $ldata/mysql;
+ mkdir -p $ldata/mysql;
chmod 700 $ldata/mysql ;
fi
if test ! -d $ldata/test; then
- mkdir $ldata/test;
+ mkdir -p $ldata/test;
chmod 700 $ldata/test ;
fi
-if test -w / -a ! -z "$user"; then
- chown $user $ldata $ldata/mysql $ldata/test;
-fi
+chown -f $user:$group $ldata $ldata/mysql $ldata/test
if test -n "$user"; then
args="$args --user=$user"
@@ -300,11 +300,6 @@ then
fi
fi
- s_echo ""
- s_echo "To start mysqld at boot time you have to copy"
- s_echo "support-files/mysql.server to the right place for your system"
- s_echo
-
if test "$windows" -eq 0
then
# A root password should of course also be set on Windows!
@@ -319,15 +314,6 @@ then
echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'"
echo "See the manual for more instructions."
- if test "$in_rpm" = "0"
- then
- echo "You can start the MySQL daemon with:"
- echo "cd @prefix@ ; $bindir/mysqld_safe &"
- echo
- echo "You can test the MySQL daemon with mysql-test-run.pl"
- echo "cd mysql-test ; perl mysql-test-run.pl"
- echo
- fi
echo "Please report any problems with the @scriptdir@/mysqlbug script!"
echo
echo "The latest information about MySQL is available on the web at"