Show
Ignore:
Timestamp:
03/30/09 08:45:10 (3 years ago)
Author:
mloskot
Message:

[wktraster] Completed implementation of targets drop, create and check in the Makefile.rt.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • spike/wktraster/scripts/Makefile.rt

    • Property svn:keywords set to Id
    r3944 r3945  
    1 DBNAME=sistest 
     1############################################################################# 
     2# $Id$  
     3# 
     4# Makefile used to simplify creation of PostGIS and WKT Raster enabled 
     5# database. Run make -f Makefile.rt to see usage message. 
     6# 
     7############################################################################# 
     8# Copyright (C) 2009 Mateusz Loskot <mateusz@loskot.net> 
     9# 
     10# This is free software; you can redistribute and/or modify it under 
     11# the terms of the GNU General Public Licence. See the COPYING file. 
     12# 
     13############################################################################# 
     14# 
     15# Instructions: 
     16# Provide location of SQL scripts of PostGIS and WKT Raster extensions 
     17# 
     18### BEGIN OF CONFIGURATION ################################################## 
    219POSTGIS = /usr/share/postgresql/8.3/contrib 
    320WKTRASTER = /home/mloskot/dev/wktraster/_svn/trunk 
    4 DATA=/home/mloskot/data/test 
    5 QUIET = 
     21### END OF CONFIGURATION #################################################### 
     22# 
     23# *** DO NOT EDIT ANYTHING BELOW *** 
     24 
     25ifdef NOERR 
     26        ERROUT=2>&1 
     27endif 
    628 
    729all: 
    8         @echo "****** Usage ******" 
    9         @echo "*** Create PostGIS and WKT Raster enabled database 'mydb' ******" 
    10         @echo "DBNAME=mydb make -f Makefile.rt" 
    11         @echo "*** Drop PostGIS and WKT Raster enabled database 'mydb' ******" 
    12         @echo "DBNAME=mydb make -f Makefile.rt clean" 
     30        @echo "****** Makefile.rt usage ******" 
     31        @echo "*** Create PostGIS and WKT Raster enabled database:" 
     32        @echo "\tDBNAME=mydb make -f Makefile.rt create" 
     33        @echo "*** Drop PostGIS and WKT Raster enabled database:" 
     34        @echo "\tDBNAME=mydb make -f Makefile.rt drop" 
    1335 
    14 clean: 
    15         @echo "****** BEGIN ******" 
     36drop: 
     37        @echo "****** Makefile.rt ******" 
     38ifdef DBNAME 
    1639        @echo "*** Dropping database '$(DBNAME)'..." 
    17         @dropdb $(DBNAME) 
    18         @echo "****** END. ******" 
     40        @dropdb $(DBNAME) > /dev/null $(ERROUT); 
     41        @echo "****** END. *******" 
     42else 
     43        @echo "****** Missing DBNAME option. Aborting." 
     44endif 
    1945 
    20 db: 
    21         @echo "****** BEGIN ******" 
     46create: 
     47        @echo "****** Makefile.rt ******" 
     48ifdef DBNAME 
    2249        @echo "****** Creating database '$(DBNAME)'..." 
    23         @createdb $(DBNAME) 
    24         @createlang plpgsql $(DBNAME) 
     50        @createdb $(DBNAME) > /dev/null $(ERROUT); 
     51        @createlang plpgsql $(DBNAME) > /dev/null $(ERROUT); 
    2552        @echo "****** Loading PostGIS into '$(DBNAME)'..." 
    26         @psql -d $(DBNAME) -f $(POSTGIS)/postgis.sql > /dev/null; 
    27         @psql -d $(DBNAME) -f $(POSTGIS)/spatial_ref_sys.sql > /dev/null; 
     53        @psql -d $(DBNAME) -f $(POSTGIS)/postgis.sql > /dev/null $(ERROUT); 
     54        @psql -d $(DBNAME) -f $(POSTGIS)/spatial_ref_sys.sql > /dev/null $(ERROUT); 
    2855        @echo "****** Loading WKT Raster into '$(DBNAME)'..." 
    29         @psql -d $(DBNAME) -f $(WKTRASTER)/rt_pg/rtpostgis.sql > /dev/null; 
     56        @psql -d $(DBNAME) -f $(WKTRASTER)/rt_pg/rtpostgis.sql > /dev/null $(ERROUT); 
    3057        @echo "****** END. *******" 
     58else 
     59        @echo "****** Missing DBNAME option. Aborting." 
     60endif 
     61 
     62check: 
     63        @echo "****** Makefile.rt ******" 
     64ifeq ($(shell psql -l | grep ' $(DBNAME) '  | wc -l), 1) 
     65        @echo "****** Database '$(DBNAME)' found" 
     66else 
     67        @echo "****** Database '$(DBNAME)' not found" 
     68endif