comparison style-templates/upload-styles.sh @ 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
comparison
equal deleted inserted replaced
4985:4bd4cd7d8429 4986:136dc9e528c4
27 27
28 Options: 28 Options:
29 -P, --g_port=GPORT connect to gemma server at GPORT. Default 8000. 29 -P, --g_port=GPORT connect to gemma server at GPORT. Default 8000.
30 -g, --g_host=GHOST connect to gemma server on GHOST. Default "localhost". 30 -g, --g_host=GHOST connect to gemma server on GHOST. Default "localhost".
31 -u, --g_user=GUSER login to gemma as user GUSER. Default "sophie". 31 -u, --g_user=GUSER login to gemma as user GUSER. Default "sophie".
32 -d, --extra_dir=DIR search DIR in addition to the default styles directory.
33 This option can be specified multiple times.
32 --g_pw=GPW password for GUSER. Default "so2Phie4". 34 --g_pw=GPW password for GUSER. Default "so2Phie4".
33 --help display this help and exit 35 --help display this help and exit
34 36
35 EOF 37 EOF
36 } 38 }
45 47
46 g_port=8000 48 g_port=8000
47 g_host="localhost" 49 g_host="localhost"
48 g_user="sophie" 50 g_user="sophie"
49 g_pw="so2Phie4" 51 g_pw="so2Phie4"
52 declare -a extra_dirs
50 53
51 # Parse options: 54 # Parse options:
52 55
53 OPTS=`getopt \ 56 OPTS=`getopt \
54 -l help,g_port:,g_host:,g_user:,g_pw: \ 57 -l help,g_port:,g_host:,g_user:,g_pw:,extra_dir: \
55 -o P:g:u: -n "$ME" -- "$@"` 58 -o P:g:u:d: -n "$ME" -- "$@"`
56 [ $? -eq 0 ] || { usage ; exit 1 ; } 59 [ $? -eq 0 ] || { usage ; exit 1 ; }
57 60
58 eval set -- "$OPTS" 61 eval set -- "$OPTS"
59 62
60 while true ; do 63 while true ; do
71 g_user="$2" 74 g_user="$2"
72 shift 2 75 shift 2
73 ;; 76 ;;
74 --g_pw) 77 --g_pw)
75 g_pw="$2" 78 g_pw="$2"
79 shift 2
80 ;;
81 --extra_dir|-d)
82 extra_dirs+=("$2")
76 shift 2 83 shift 2
77 ;; 84 ;;
78 --help) 85 --help)
79 { usage ; exit 0 ; } 86 { usage ; exit 0 ; }
80 ;; 87 ;;
107 then 114 then
108 echo "== Configuring geoserver styles" >&2 115 echo "== Configuring geoserver styles" >&2
109 if [ $# -gt 0 ]; then 116 if [ $# -gt 0 ]; then
110 files=("$@") 117 files=("$@")
111 else 118 else
112 files=($(find "$datadir" -name "*.sld-template" -or -name "*.zip")) 119 files=($(find "$datadir" "${extra_dirs[@]}" \
120 -name "*.sld-template" -or -name "*.zip"))
113 fi 121 fi
114 for file in ${files[@]} 122 for file in ${files[@]}
115 do 123 do
116 style=$(basename $(basename "$file" .zip) .sld-template) 124 style=$(basename $(basename "$file" .zip) .sld-template)
117 echo "uploading ${style} ..." 125 echo "uploading ${style} ..."