[DebianGIS-dev] r2072 - packages/gmt-coast-low/trunk/debian
frankie at alioth.debian.org
frankie at alioth.debian.org
Wed Mar 25 22:52:01 UTC 2009
Author: frankie
Date: 2009-03-25 22:52:01 +0000 (Wed, 25 Mar 2009)
New Revision: 2072
Added:
packages/gmt-coast-low/trunk/debian/gmt-coastline-download
Log:
Added gmt-coastline-download
Added: packages/gmt-coast-low/trunk/debian/gmt-coastline-download
===================================================================
--- packages/gmt-coast-low/trunk/debian/gmt-coastline-download (rev 0)
+++ packages/gmt-coast-low/trunk/debian/gmt-coastline-download 2009-03-25 22:52:01 UTC (rev 2072)
@@ -0,0 +1,132 @@
+#!/bin/bash
+#
+# Copyright (C) 2008 Francesco P. Lovergine <frankie at debian.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2,
+# as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+usage() {
+ echo "usage: $0 [high|full|high-full|low|all]"
+}
+
+set -e
+
+if [ $(id -u) -ne 0 ]; then
+ echo "Run this script as root"
+ exit 1
+fi
+
+#
+# Default is downloading both full and high res coast lines.
+#
+if [ $# -eq 0 ]; then
+ COAST_LINES=high-full
+else
+ case "$1" in
+ high-full)
+ COAST_LINES=high-full
+ ;;
+ high)
+ COAST_LINES=high
+ ;;
+ low)
+ COAST_LINES=low
+ ;;
+ full)
+ COAST_LINES=full
+ ;;
+ all)
+ COAST_LINES=all
+ ;;
+ help|-h|--help)
+ usage
+ exit 5
+ ;;
+ *)
+ echo "Unknown argument '$1'" && usage
+ exit 4
+ ;;
+ esac
+fi
+
+MIRROR[1]=ftp://ftp.soest.hawaii.edu/gmt
+MIRROR[2]=ftp://ibis.grdl.noaa.gov/pub/gmt
+MIRROR[3]=ftp://ftp.iris.washington.edu/pub/gmt
+MIRROR[4]=ftp://ftp.iag.usp.br/pub/gmt
+MIRROR[5]=ftp://ftp.geologi.uio.no/pub/gmt
+MIRROR[6]=ftp://gd.tuwien.ac.at/pub/gmt
+MIRROR[7]=ftp://ftp.scc.u-tokai.ac.jp/pub/gmt
+MIRROR[8]=ftp://mirror.geosci.usyd.edu.au/pub/gmt
+
+cat <<EOF
+
+ This script downloads both high-resolution and full resolution coast lines
+ for GMT (Generic Mapping Tools) and installs the resulting CDF files under
+ /usr/share/gmt/coast for use.
+
+ Choose a mirror site (default 1):
+
+ 1) ${MIRROR[1]}
+ 2) ${MIRROR[2]}
+ 3) ${MIRROR[3]}
+ 4) ${MIRROR[4]}
+ 5) ${MIRROR[5]}
+ 6) ${MIRROR[6]}
+ 7) ${MIRROR[7]}
+ 8) ${MIRROR[8]}
+
+EOF
+
+echo -n "Insert a mirror ID: "
+read -n 1 mirror
+
+case "$mirror" in
+ [1-9]) SITE=${MIRROR[$mirror]}
+ ;;
+ *) SITE=${MIRROR[1]}
+ ;;
+esac
+
+SHARE_DIR=/usr/share/gmt
+
+if [ ! -d $SHARE_DIR ]; then
+ echo "GMT target directory $SHARE_DIR not found"
+ exit 2
+fi
+
+TMPDIR=`mktemp -t -d gmt-coast.XXXXXXXX` || exit 3
+
+URL_HIGH="$SITE/GSHHS_high.tar.bz2"
+URL_FULL="$SITE/GSHHS_full.tar.bz2"
+if [ -x /usr/bin/wget ]; then
+ GET_HIGH="wget --progress=bar -O$TMPDIR/GSHHS_high.tar.bz2 $URL_HIGH"
+ GET_FULL="wget --progress=bar -O$TMPDIR/GSHHS_full.tar.bz2 $URL_FULL"
+ else if [ -x /usr/bin/curl ]; then
+ GET_HIGH="curl --progress-bar -o$TMPDIR/GSHHS_high.tar.bz2 $URL_HIGH"
+ GET_FULL="curl --progress-bar -o$TMPDIR/GSHHS_full.tar.bz2 $URL_FULL"
+ fi
+fi
+
+echo $GET_HIGH && $GET_HIGH && tar xjvf $TMPDIR/GSHHS_high.tar.bz2 -C $SHARE_DIR/coast --strip 2 share/coast
+echo $GET_FULL && $GET_FULL && tar xjvf $TMPDIR/GSHHS_full.tar.bz2 -C $SHARE_DIR/coast --strip 2 share/coast
+
+rm -rf $TMPDIR
+
+cat <<EOF
+
+ Coast lines downloaded and installed under $SHARE_DIR/coast.
+
+EOF
+
+exit 0
More information about the Pkg-grass-devel
mailing list