Modifications pour permettre utilisation du Makefile avec cygwin
This commit is contained in:
parent
bba0198a62
commit
4694cc69a0
@ -1,3 +1,4 @@
|
||||
#
|
||||
# Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
# Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
#
|
||||
@ -36,7 +37,7 @@
|
||||
#
|
||||
# **********************************************************************
|
||||
|
||||
MYSQL=mysql
|
||||
SQL=mysql
|
||||
BASE=dolibarr
|
||||
OPTIONS=
|
||||
|
||||
@ -56,14 +57,15 @@ show:
|
||||
&& make show BASE=$(BASE) OPTIONS=$(OPTIONS)
|
||||
|
||||
drop:
|
||||
$(MYSQL) $(OPTIONS) $(BASE) < drop.sql
|
||||
cd tables \
|
||||
&& make drop
|
||||
|
||||
table:
|
||||
cd tables \
|
||||
&& make create BASE=$(BASE) OPTIONS=$(OPTIONS)
|
||||
|
||||
load:
|
||||
$(MYSQL) $(OPTIONS) $(BASE) < data/data.sql
|
||||
$(SQL) $(OPTIONS) $(BASE) < data/data.sql
|
||||
|
||||
dev:
|
||||
cd data \
|
||||
@ -78,31 +80,31 @@ fulldev: drop table load dev
|
||||
dropall: dropdb droppriv
|
||||
|
||||
droppriv:
|
||||
$(MYSQL) $(OPTIONS) mysql -e "delete from db where Db='$(BASE)' ; "
|
||||
$(SQL) $(OPTIONS) $(SQL) -e "delete from db where Db='$(BASE)' ; "
|
||||
|
||||
dropdb:
|
||||
$(MYSQL) $(OPTIONS) mysql -f -e "drop database if exists $(BASE) ; "
|
||||
$(SQL) $(OPTIONS) $(SQL) -f -e "drop database if exists $(BASE) ; "
|
||||
|
||||
|
||||
|
||||
create: drop createdb createpriv
|
||||
|
||||
createdb:
|
||||
$(MYSQL) $(OPTIONS) mysql -e "create database $(BASE) ; "
|
||||
$(SQL) $(OPTIONS) mysql -e "create database $(BASE) ; "
|
||||
|
||||
createpriv:
|
||||
$(MYSQL) $(OPTIONS) mysql -e "insert into db (Host, Db) values ('localhost', '$(BASE)') ; "
|
||||
$(MYSQL) $(OPTIONS) mysql -e "update db set select_priv = 'Y' where db='$(BASE)' ; "
|
||||
$(MYSQL) $(OPTIONS) mysql -e "update db set insert_priv = 'Y' where db='$(BASE)' ; "
|
||||
$(MYSQL) $(OPTIONS) mysql -e "update db set update_priv = 'Y' where db='$(BASE)' ; "
|
||||
$(MYSQL) $(OPTIONS) mysql -e "update db set delete_priv = 'Y' where db='$(BASE)' ; "
|
||||
$(MYSQL) $(OPTIONS) mysql -e "update db set create_priv = 'Y' where db='$(BASE)' ; "
|
||||
$(MYSQL) $(OPTIONS) mysql -e "update db set drop_priv = 'Y' where db='$(BASE)' ; "
|
||||
$(MYSQL) $(OPTIONS) mysql -e "update db set grant_priv = 'Y' where db='$(BASE)' ; "
|
||||
$(MYSQL) $(OPTIONS) mysql -e "update db set references_priv = 'Y' where db='$(BASE)' ; "
|
||||
$(MYSQL) $(OPTIONS) mysql -e "update db set index_priv = 'Y' where db='$(BASE)' ; "
|
||||
$(MYSQL) $(OPTIONS) mysql -e "update db set alter_priv = 'Y' where db='$(BASE)' ; "
|
||||
$(MYSQL) $(OPTIONS) mysql -e "flush privileges ; "
|
||||
$(SQL) $(OPTIONS) mysql -e "insert into db (Host, Db) values ('localhost', '$(BASE)') ; "
|
||||
$(SQL) $(OPTIONS) mysql -e "update db set select_priv = 'Y' where db='$(BASE)' ; "
|
||||
$(SQL) $(OPTIONS) mysql -e "update db set insert_priv = 'Y' where db='$(BASE)' ; "
|
||||
$(SQL) $(OPTIONS) mysql -e "update db set update_priv = 'Y' where db='$(BASE)' ; "
|
||||
$(SQL) $(OPTIONS) mysql -e "update db set delete_priv = 'Y' where db='$(BASE)' ; "
|
||||
$(SQL) $(OPTIONS) mysql -e "update db set create_priv = 'Y' where db='$(BASE)' ; "
|
||||
$(SQL) $(OPTIONS) mysql -e "update db set drop_priv = 'Y' where db='$(BASE)' ; "
|
||||
$(SQL) $(OPTIONS) mysql -e "update db set grant_priv = 'Y' where db='$(BASE)' ; "
|
||||
$(SQL) $(OPTIONS) mysql -e "update db set references_priv = 'Y' where db='$(BASE)' ; "
|
||||
$(SQL) $(OPTIONS) mysql -e "update db set index_priv = 'Y' where db='$(BASE)' ; "
|
||||
$(SQL) $(OPTIONS) mysql -e "update db set alter_priv = 'Y' where db='$(BASE)' ; "
|
||||
$(SQL) $(OPTIONS) mysql -e "flush privileges ; "
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
# Copyright (C) 2002-2003 Éric Seigne <erics@rycks.com>
|
||||
# Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
# Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -17,42 +17,64 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# General Makefile for postgresql database
|
||||
#
|
||||
# $Id$
|
||||
# $Source$
|
||||
#
|
||||
# **********************************************************************
|
||||
# Ce makefile permet d'initialiser la base de donnée de dolibarr en manuel.
|
||||
# Il n'est utile que si vous n'utilisez pas l'installateur automatique
|
||||
# accessible à http://localhost/dolibarr/install/
|
||||
#
|
||||
# Pour une installation manuelle, créer la base dolibarr puis faire:
|
||||
# make table
|
||||
# make load
|
||||
#
|
||||
# Ou bien, toujours après avoir créer la base dolibarr:
|
||||
# make mysql.sql
|
||||
# mysql dolibarr < mysql.sql
|
||||
#
|
||||
# Le script mysql.sql cotient tous le ordres sql pour créer la base
|
||||
# Tables + Index et Clés + Données
|
||||
#
|
||||
# **********************************************************************
|
||||
|
||||
SQL=psql
|
||||
BASE=dolibarr
|
||||
OPTIONS=-U postgres
|
||||
OWNER=dolibarradm
|
||||
OWNERPASS=azaz
|
||||
FIND=find
|
||||
#FIND="c:/Program files/cygwin/bin/find"
|
||||
|
||||
|
||||
TABLES=$(shell $(FIND) tables/ -name "*sql")
|
||||
|
||||
|
||||
all:
|
||||
cd tables \
|
||||
&& make show
|
||||
cat README
|
||||
|
||||
show:
|
||||
cd tables \
|
||||
&& make show
|
||||
|
||||
drop:
|
||||
cd tables \
|
||||
&& make drop
|
||||
|
||||
table:
|
||||
cd tables \
|
||||
&& make create
|
||||
load:
|
||||
$(SQL) $(OPTIONS) $(BASE) < data/data.sql
|
||||
|
||||
dev:
|
||||
cd data \
|
||||
&& make dev
|
||||
|
||||
fulldev: droptable table load dev
|
||||
|
||||
droptable:
|
||||
cd tables \
|
||||
&& make drop
|
||||
|
||||
load:
|
||||
$(SQL) $(OPTIONS) $(BASE) < data/data.sql
|
||||
fulldev: drop table load dev
|
||||
|
||||
|
||||
drop: droppriv dropdb dropuser
|
||||
|
||||
@ -65,6 +87,8 @@ dropuser:
|
||||
dropdb:
|
||||
$(SQL) $(OPTIONS) template1 -c "drop database $(BASE) ; "
|
||||
|
||||
|
||||
|
||||
create: drop createuser createdb createpriv
|
||||
|
||||
createuser:
|
||||
@ -77,3 +101,9 @@ createpriv:
|
||||
$(SQL) $(OPTIONS) template1 -c "grant all privileges on database $(BASE) to $(OWNER) ; "
|
||||
|
||||
|
||||
pgsql.sql: $(TABLES) data/data.sql Makefile
|
||||
echo "-- Fichier généré par make pgsql.sql" > pgsql.sql
|
||||
echo "-- Contient les ordres de creation des tables + les clés + les données" >> pgsql.sql
|
||||
echo "-- ;" >> pgsql.sql
|
||||
$(FIND) tables/ -name "*sql" | xargs cat | grep -v "^--" | cut -d "-" -f 1 >> pgsql.sql
|
||||
cat data/data.sql | grep -v ^-- >> pgsql.sql
|
||||
|
||||
Loading…
Reference in New Issue
Block a user