imbajin commented on code in PR #2403:
URL:
https://github.com/apache/incubator-hugegraph/pull/2403#discussion_r1440157626
##########
hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh:
##########
@@ -268,12 +275,17 @@ function get_ip() {
function download() {
local path=$1
local link_url=$2
-
- if command_available "wget"; then
+ if command_available "curl"; then
+ if [ ! -d "$path" ]; then
+ mkdir -p "$path" || {
+ echo "Failed to create directory: $path"
+ exit 1
+ }
+ fi
+ curl -L "${link_url}" -o "${path}/$(basename "${link_url}")"
+ elif command_available "wget"; then
wget --help | grep -q '\--show-progress' && progress_opt="-q
--show-progress" || progress_opt=""
wget "${link_url}" -P "${path}" $progress_opt
- elif command_available "curl"; then
- curl "${link_url}" -o "${path}"/"${link_url}"
else
echo "Required wget or curl but they are unavailable"
Review Comment:
```suggestion
echo "Required curl or wget but they are unavailable"
```
##########
hugegraph-server/hugegraph-dist/download_keystore.sh:
##########
@@ -0,0 +1,35 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to You under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+
+curl --version >/dev/null 2>&1 ||
+ {
+ echo 'ERROR: Please install `curl` first if you need
`hugegraph-server.keystore`'
+ exit
+ }
+
+# TODO: perhaps it's necessary verify the checksum before reusing the existing
tar
+if [[ ! -f hugegraph-server.keystore ]]; then
+ curl -s -S -L -o hugegraph-server.keystore \
+
https://github.com/apache/hugegraph-doc/raw/binary-1.0/dist/server/hugegraph-server.keystore
||
+ {
+ echo 'ERROR: Download `hugegraph-server.keystore` failed, please check
your network connection'
Review Comment:
```suggestion
echo 'ERROR: Download `hugegraph-server.keystore` from GitHub failed,
please check your network connection'
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]