You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.2 KiB

  1. #!/bin/sh
  2. #
  3. # postinstall script for the MySQL Startup Item Installation package
  4. #
  5. # This script modifies /etc/hostconfig in the following ways:
  6. #
  7. # - On Mac OS X Server, it disables the startup of the default MySQL
  8. # installation by changing the "MYSQL" start variable to "-NO-".
  9. # - If not existent already, it adds a "MYSQLCOM" start variable, which
  10. # defaults to "-YES-". An already existing MYSQLCOM variable will remain
  11. # untouched.
  12. #
  13. # (c) 2003 MySQL AB
  14. # Author: Lenz Grimmer <lenz@mysql.com>
  15. #
  16. CONFFILE="/etc/hostconfig"
  17. TMPFILE=`basename $CONFFILE` || exit 1
  18. TMPFILE=`mktemp -t $TMPFILE.tmp` || exit 1
  19. test -e $CONFFILE || exit 1
  20. # Disable the startup of the default MySQL installation that ships with
  21. # Mac OS X Server to avoid conflicts with our installation on bootup
  22. sed -e s/^MYSQL=-YES-/MYSQL=-NO-/g < $CONFFILE > $TMPFILE
  23. # Add our MYSQLCOM startup variable (enabled by default)
  24. grep -q "^MYSQLCOM" $CONFFILE > /dev/null 2>&1
  25. if [ $? -ne 0 ] ; then
  26. echo "MYSQLCOM=-YES-" >> $TMPFILE
  27. fi
  28. # Install the modified file into the default location
  29. cp -f $CONFFILE $CONFFILE~ || exit 1
  30. mv -f $TMPFILE $CONFFILE || echo "Error while installing new $CONFFILE!"
  31. chmod 644 $CONFFILE