| 1 |
# vim: ft=make ts=4 sw=4 noet |
| 2 |
# |
| 3 |
# $Id: gar.common.mk 2363 2008-11-26 15:24:13Z dmichelsen $ |
| 4 |
# |
| 5 |
# Copyright 2006 Cory Omand |
| 6 |
# |
| 7 |
# Redistribution and/or use, with or without modification, is |
| 8 |
# permitted. This software is without warranty of any kind. The |
| 9 |
# author(s) shall not be liable in the event that use of the |
| 10 |
# software causes damage. |
| 11 |
# |
| 12 |
# gar.common.mk - General routines used by multiple packages. For instance, |
| 13 |
# setting up server instances prior to testing. |
| 14 |
# |
| 15 |
|
| 16 |
# |
| 17 |
# Power up MySQL for testing purposes (used by DBI/DBD CPAN modules) |
| 18 |
# |
| 19 |
mysql-powerup: |
| 20 |
@echo " ==> Cleaning up mysql directory" |
| 21 |
@( $(DESTDIR)$(sharedstatedir)/mysql/mysql.server stop || true ) |
| 22 |
@rm -rf $(DESTDIR)$(localstatedir) |
| 23 |
@echo " ==> Configuring mysql db for tests" |
| 24 |
@$(DESTDIR)$(bindir)/mysql_install_db |
| 25 |
@echo " ==> Adding $(DB_USER) user" |
| 26 |
@if test "X$(shell getent group $(DB_GROUP))" = "X"; then \ |
| 27 |
groupadd $(DB_GROUP) ; \ |
| 28 |
fi |
| 29 |
@if test "X$(shell getent passwd $(DB_USER))" = "X"; then \ |
| 30 |
useradd -g $(DB_GROUP) \ |
| 31 |
-d $(DESTDIR)$(localstatedir) \ |
| 32 |
-s /bin/false $(DB_USER) ; \ |
| 33 |
passwd -l $(DB_USER) ; \ |
| 34 |
fi |
| 35 |
@chown -R $(DB_USER):$(DB_GROUP) $(DESTDIR)$(localstatedir) |
| 36 |
@$(DESTDIR)$(sharedstatedir)/mysql/mysql.server start |
| 37 |
@echo " ==> Mysql started and ready for testing" |
| 38 |
|
| 39 |
# |
| 40 |
# Power down MySQL after testing (used by DBI/DBD CPAN modules) |
| 41 |
# |
| 42 |
mysql-powerdown: |
| 43 |
@echo " ==> Cleaning up mysql directory" |
| 44 |
@( $(DESTDIR)$(sharedstatedir)/mysql/mysql.server stop || true ) |
| 45 |
@echo " ==> Removing $(DB_USER) user" |
| 46 |
@( userdel $(DB_USER) || true ) |
| 47 |
@( userdel $(DB_GROUP) || true ) |
| 48 |
@rm -rf $(DESTDIR)$(localstatedir) |
| 49 |
|