changeset 4986:136dc9e528c4

Added option --extra_dir to upload-styles.sh script. This is intended to upload styles from other repositories in addition to the included ones.
author Sascha Wilde <wilde@intevation.de>
date Thu, 05 Mar 2020 11:53:49 +0100
parents 4bd4cd7d8429
children 43ada68487ca
files style-templates/upload-styles.sh
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/style-templates/upload-styles.sh	Thu Mar 05 11:26:31 2020 +0100
+++ b/style-templates/upload-styles.sh	Thu Mar 05 11:53:49 2020 +0100
@@ -29,6 +29,8 @@
   -P, --g_port=GPORT  connect to gemma server at GPORT. Default 8000.
   -g, --g_host=GHOST  connect to gemma server on GHOST. Default "localhost".
   -u, --g_user=GUSER  login to gemma as user GUSER. Default "sophie".
+  -d, --extra_dir=DIR search DIR in addition to the default styles directory.
+                      This option can be specified multiple times.
       --g_pw=GPW      password for GUSER. Default "so2Phie4".
       --help          display this help and exit
 
@@ -47,12 +49,13 @@
 g_host="localhost"
 g_user="sophie"
 g_pw="so2Phie4"
+declare -a extra_dirs
 
 # Parse options:
 
 OPTS=`getopt \
-      -l help,g_port:,g_host:,g_user:,g_pw: \
-      -o P:g:u: -n "$ME" -- "$@"`
+      -l help,g_port:,g_host:,g_user:,g_pw:,extra_dir: \
+      -o P:g:u:d: -n "$ME" -- "$@"`
 [ $? -eq 0 ] || { usage ; exit 1 ; }
 
 eval set -- "$OPTS"
@@ -75,6 +78,10 @@
       g_pw="$2"
       shift 2
       ;;
+    --extra_dir|-d)
+      extra_dirs+=("$2")
+      shift 2
+      ;;
     --help)
       { usage ; exit 0 ; }
       ;;
@@ -109,7 +116,8 @@
   if [ $# -gt 0 ]; then
     files=("$@")
   else
-    files=($(find "$datadir" -name "*.sld-template" -or -name "*.zip"))
+    files=($(find "$datadir" "${extra_dirs[@]}" \
+                  -name "*.sld-template" -or -name "*.zip"))
   fi
   for file in ${files[@]}
   do