Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #707 from cd1989/bash-scripts-options
Browse files Browse the repository at this point in the history
Add options for bash scripts
  • Loading branch information
starnop authored Jul 25, 2019
2 parents 92b4fe5 + 835ba13 commit 9033f63
Show file tree
Hide file tree
Showing 15 changed files with 68 additions and 5 deletions.
4 changes: 4 additions & 0 deletions hack/after-install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash

set -o nounset
set -o errexit
set -o pipefail

ln -s /opt/dragonfly/df-client/dfget /usr/local/bin/dfget
ln -s /opt/dragonfly/df-client/dfdaemon /usr/local/bin/dfdaemon
4 changes: 4 additions & 0 deletions hack/before-remove.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash

set -o nounset
set -o errexit
set -o pipefail

rm -f /usr/local/bin/dfget
rm -f /usr/local/bin/dfdaemon
7 changes: 6 additions & 1 deletion hack/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/bin/bash

set -o nounset
set -o errexit
set -o pipefail

DFDAEMON_BINARY_NAME=dfdaemon
DFGET_BINARY_NAME=dfget
SUPERNODE_BINARY_NAME=supernode
Expand Down Expand Up @@ -100,7 +105,7 @@ main() {
esac
else
echo "Begin to build in the local environment."
case "$1" in
case "${1-}" in
dfdaemon)
build-dfdaemon-local
;;
Expand Down
5 changes: 5 additions & 0 deletions hack/check-docker.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/bin/bash

set -o nounset
set -o errexit
set -o pipefail

check() {
which docker > /dev/null && docker ps > /dev/null 2>&1
if [[ $? != 0 ]]; then
Expand Down
5 changes: 5 additions & 0 deletions hack/check.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/bin/bash

set -o nounset
set -o errexit
set -o pipefail

curDir=$(cd "$(dirname "$0")" && pwd)
cd "${curDir}/../" || return

Expand Down
6 changes: 5 additions & 1 deletion hack/docker-build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

set -o nounset
set -o errexit
set -o pipefail

DF_VERSION=${DF_VERSION:-"latest"}
curDir=$(cd "$(dirname "$0")" && pwd)
cd "${curDir}/../" || return
Expand All @@ -13,7 +17,7 @@ docker-build::build-supernode(){
}

main() {
case "$1" in
case "${1-}" in
dfclient)
docker-build::build-dfclient
;;
Expand Down
4 changes: 4 additions & 0 deletions hack/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -o nounset
set -o errexit
set -o pipefail

export INSTALL_HOME=/opt/dragonfly
export INSTALL_CLIENT_PATH=df-client
export INSTALL_SUPERNODE_PATH=df-supernode
Expand Down
5 changes: 4 additions & 1 deletion hack/generate-contributors.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash
set -e

set -o nounset
set -o errexit
set -o pipefail

# see also ".mailmap" for how email addresses and names are deduplicated

Expand Down
6 changes: 5 additions & 1 deletion hack/generate-docs.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

set -o nounset
set -o errexit
set -o pipefail

curDir=$(cd "$(dirname "$0")" && pwd)
cd "${curDir}" || return

Expand All @@ -17,7 +21,7 @@ generate-cli-docs(){
}

main () {
case "$1" in
case "${1-}" in
cli)
generate-cli-docs
;;
Expand Down
5 changes: 4 additions & 1 deletion hack/generate-super-mock-mgr.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash
set -e

set -o nounset
set -o errexit
set -o pipefail

# This script is used to generate mock files for interfaces.

Expand Down
4 changes: 4 additions & 0 deletions hack/generate-swagger-models.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

set -o nounset
set -o errexit
set -o pipefail

# Here is details of the swagger binary we use.
# $ swagger version
# version: 0.19.0
Expand Down
5 changes: 5 additions & 0 deletions hack/install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/bin/bash

set -o nounset
set -o errexit
set -o pipefail

BIN_DIR="../bin"
DFDAEMON_BINARY_NAME=dfdaemon
DFGET_BINARY_NAME=dfget
Expand Down
4 changes: 4 additions & 0 deletions hack/package.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

set -o nounset
set -o errexit
set -o pipefail

USE_DOCKER=${USE_DOCKER:-"0"}
VERSION=${VERSION:-"0.0.$(date +%s)"}

Expand Down
4 changes: 4 additions & 0 deletions hack/start-supernode.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/bin/env bash

set -o nounset
set -o errexit
set -o pipefail

nginx

/opt/dragonfly/df-supernode/supernode "$@"
5 changes: 5 additions & 0 deletions hack/unit-test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/bin/bash

set -o nounset
set -o errexit
set -o pipefail

curDir=$(cd "$(dirname "$0")" && pwd)
cd "${curDir}" || return

Expand Down

0 comments on commit 9033f63

Please sign in to comment.