diff --git a/.work/extra/service_example/hooks/after_start.sh b/.work/extra/service_example/hooks/after_start.sh index 0b01c7b..ec8131c 100644 --- a/.work/extra/service_example/hooks/after_start.sh +++ b/.work/extra/service_example/hooks/after_start.sh @@ -1,4 +1,4 @@ #!/bin/sh # include sdk of sparrow. -source .work/include/sdk.sh +. .work/include/sdk.sh diff --git a/.work/extra/service_example/hooks/after_stop.sh b/.work/extra/service_example/hooks/after_stop.sh index 0b01c7b..ec8131c 100644 --- a/.work/extra/service_example/hooks/after_stop.sh +++ b/.work/extra/service_example/hooks/after_stop.sh @@ -1,4 +1,4 @@ #!/bin/sh # include sdk of sparrow. -source .work/include/sdk.sh +. .work/include/sdk.sh diff --git a/.work/extra/service_example/hooks/before_start.sh b/.work/extra/service_example/hooks/before_start.sh index 0b01c7b..ec8131c 100644 --- a/.work/extra/service_example/hooks/before_start.sh +++ b/.work/extra/service_example/hooks/before_start.sh @@ -1,4 +1,4 @@ #!/bin/sh # include sdk of sparrow. -source .work/include/sdk.sh +. .work/include/sdk.sh diff --git a/.work/extra/service_example/hooks/before_stop.sh b/.work/extra/service_example/hooks/before_stop.sh index 0b01c7b..ec8131c 100644 --- a/.work/extra/service_example/hooks/before_stop.sh +++ b/.work/extra/service_example/hooks/before_stop.sh @@ -1,4 +1,4 @@ #!/bin/sh # include sdk of sparrow. -source .work/include/sdk.sh +. .work/include/sdk.sh diff --git a/.work/extra/service_example/make_app_image/run.sh b/.work/extra/service_example/make_app_image/run.sh index 8f25c78..5c532a1 100644 --- a/.work/extra/service_example/make_app_image/run.sh +++ b/.work/extra/service_example/make_app_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="{{SERVICE}}" @@ -11,7 +10,7 @@ service_name="{{SERVICE}}" print_stage "try to pull/build sparrow-basic-${service_name} $IMAGE_BASIC_{{SERVICE_UPPER}}_VERSION" if pull basic $service_name $IMAGE_BASIC_{{SERVICE_UPPER}}_VERSION; then print_info "pull success" -elif source "./${service_name}/make_basic_image/run.sh"; then +elif . "./${service_name}/make_basic_image/run.sh"; then print_info "build success" else print_error "pull/build failed" diff --git a/.work/extra/service_example/make_basic_image/run.sh b/.work/extra/service_example/make_basic_image/run.sh index 4c14ea1..5f19d01 100644 --- a/.work/extra/service_example/make_basic_image/run.sh +++ b/.work/extra/service_example/make_basic_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="{{SERVICE}}" diff --git a/.work/include/internal/constant.sh b/.work/include/internal/constant.sh index 914c991..e527475 100644 --- a/.work/include/internal/constant.sh +++ b/.work/include/internal/constant.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # only define variables, these variables may used defined environment variables in /env file. diff --git a/.work/include/internal/dockerhub.sh b/.work/include/internal/dockerhub.sh index 7324314..d2dd256 100644 --- a/.work/include/internal/dockerhub.sh +++ b/.work/include/internal/dockerhub.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # login of $DOCKERHUB_DOMAIN. # to be safety, never allow login with account in the command, you must login manually in your local system firstly. diff --git a/.work/include/internal/helper.sh b/.work/include/internal/helper.sh index 47d8883..baa4ee2 100644 --- a/.work/include/internal/helper.sh +++ b/.work/include/internal/helper.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # -----------------------define some basic helpers----------------------- @@ -200,7 +199,7 @@ pull_or_build_app_image() { version=$(eval echo "$"$version_name) if pull app $service $version; then print_info "pull success: pull app $service $version" - elif source "./$service/make_app_image/run.sh"; then + elif . "./$service/make_app_image/run.sh"; then print_info "build success: run $service/make_app_image/run.sh" else print_error "pull and build sparrow-app-$service image error" diff --git a/.work/include/sdk.sh b/.work/include/sdk.sh index 06aa5ae..18e15fc 100644 --- a/.work/include/sdk.sh +++ b/.work/include/sdk.sh @@ -1,15 +1,14 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # only include defined variables and functions. # this is no side effects. -source .work/include/internal/constant.sh -source .work/include/internal/helper.sh -source .work/include/internal/dockerhub.sh +. .work/include/internal/constant.sh +. .work/include/internal/helper.sh +. .work/include/internal/dockerhub.sh # update /env file and export env variables. if ! upenv; then diff --git a/.work/tests/run.sh b/.work/tests/run.sh index c9c114e..69f23c1 100644 --- a/.work/tests/run.sh +++ b/.work/tests/run.sh @@ -1,7 +1,7 @@ #!/bin/sh # include sdk of sparrow. -source .work/include/sdk.sh +. .work/include/sdk.sh testhttp() { if is_mac; then diff --git a/_install.sh b/_install.sh index 2ca5c3c..dbd1e83 100644 --- a/_install.sh +++ b/_install.sh @@ -5,13 +5,16 @@ # To maintain consistency and facilitate management, the filenames of these scripts all use the underscore (_) prefix. # _install.sh +# define the base path of project. +CUR_PATH=$(cd "$(dirname "$0")" && pwd) +SPARROW_BASE_PATH=$CUR_PATH + # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # include sdk of sparrow. -source .work/include/sdk.sh +. .work/include/sdk.sh # chmod files. chmod_files() { diff --git a/_uninstall.sh b/_uninstall.sh index a20d09e..0cf3c5b 100644 --- a/_uninstall.sh +++ b/_uninstall.sh @@ -5,10 +5,13 @@ # To maintain consistency and facilitate management, the filenames of these scripts all use the underscore (_) prefix. # _uninstall.sh +# define the base path of project. +CUR_PATH=$(cd "$(dirname "$0")" && pwd) +SPARROW_BASE_PATH=$CUR_PATH + # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # command interface. read -p "do you want to uninstall?(input y): " confirmation @@ -22,7 +25,7 @@ fi # =================== choose sure =================== # include sdk of sparrow. -source .work/include/sdk.sh +. .work/include/sdk.sh # remove files. remove_files() { diff --git a/_update.sh b/_update.sh index 53ce4b8..6b3f086 100644 --- a/_update.sh +++ b/_update.sh @@ -5,13 +5,16 @@ # To maintain consistency and facilitate management, the filenames of these scripts all use the underscore (_) prefix. # _update.sh +# define the base path of project. +CUR_PATH=$(cd "$(dirname "$0")" && pwd) +SPARROW_BASE_PATH=$CUR_PATH + # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # include sdk of sparrow. -source .work/include/sdk.sh +. .work/include/sdk.sh # update project. update_project() { diff --git a/etcd/hooks/after_start.sh b/etcd/hooks/after_start.sh index 5374f78..d477445 100644 --- a/etcd/hooks/after_start.sh +++ b/etcd/hooks/after_start.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/etcd/hooks/after_stop.sh b/etcd/hooks/after_stop.sh index 5374f78..d477445 100644 --- a/etcd/hooks/after_stop.sh +++ b/etcd/hooks/after_stop.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/etcd/hooks/before_start.sh b/etcd/hooks/before_start.sh index 5374f78..d477445 100644 --- a/etcd/hooks/before_start.sh +++ b/etcd/hooks/before_start.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/etcd/hooks/before_stop.sh b/etcd/hooks/before_stop.sh index 5374f78..d477445 100644 --- a/etcd/hooks/before_stop.sh +++ b/etcd/hooks/before_stop.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/etcd/make_app_image/run.sh b/etcd/make_app_image/run.sh index 766436a..157823d 100644 --- a/etcd/make_app_image/run.sh +++ b/etcd/make_app_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="etcd" @@ -11,7 +10,7 @@ service_name="etcd" print_stage "try to pull/build sparrow-basic-${service_name} $IMAGE_BASIC_ETCD_VERSION" if pull basic $service_name $IMAGE_BASIC_ETCD_VERSION; then print_info "pull success" -elif source "./${service_name}/make_basic_image/run.sh"; then +elif . "./${service_name}/make_basic_image/run.sh"; then print_info "build success" else print_error "pull/build failed" diff --git a/etcd/make_basic_image/run.sh b/etcd/make_basic_image/run.sh index 2e5d18b..3d50b83 100644 --- a/etcd/make_basic_image/run.sh +++ b/etcd/make_basic_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="etcd" diff --git a/etcdkeeper/hooks/after_start.sh b/etcdkeeper/hooks/after_start.sh index 5374f78..d477445 100644 --- a/etcdkeeper/hooks/after_start.sh +++ b/etcdkeeper/hooks/after_start.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/etcdkeeper/hooks/after_stop.sh b/etcdkeeper/hooks/after_stop.sh index 5374f78..d477445 100644 --- a/etcdkeeper/hooks/after_stop.sh +++ b/etcdkeeper/hooks/after_stop.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/etcdkeeper/hooks/before_start.sh b/etcdkeeper/hooks/before_start.sh index 5374f78..d477445 100644 --- a/etcdkeeper/hooks/before_start.sh +++ b/etcdkeeper/hooks/before_start.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/etcdkeeper/hooks/before_stop.sh b/etcdkeeper/hooks/before_stop.sh index 5374f78..d477445 100644 --- a/etcdkeeper/hooks/before_stop.sh +++ b/etcdkeeper/hooks/before_stop.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/etcdkeeper/make_app_image/run.sh b/etcdkeeper/make_app_image/run.sh index 1497b0c..3ba189b 100644 --- a/etcdkeeper/make_app_image/run.sh +++ b/etcdkeeper/make_app_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="etcdkeeper" @@ -11,7 +10,7 @@ service_name="etcdkeeper" print_stage "try to pull/build sparrow-basic-${service_name} $IMAGE_BASIC_ETCDKEEPER_VERSION" if pull basic $service_name $IMAGE_BASIC_ETCDKEEPER_VERSION; then print_info "pull success" -elif source "./${service_name}/make_basic_image/run.sh"; then +elif . "./${service_name}/make_basic_image/run.sh"; then print_info "build success" else print_error "pull/build failed" diff --git a/etcdkeeper/make_basic_image/run.sh b/etcdkeeper/make_basic_image/run.sh index 2974ec3..7bb17a4 100644 --- a/etcdkeeper/make_basic_image/run.sh +++ b/etcdkeeper/make_basic_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="etcdkeeper" diff --git a/go/hooks/after_start.sh b/go/hooks/after_start.sh index 5374f78..d477445 100644 --- a/go/hooks/after_start.sh +++ b/go/hooks/after_start.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/go/hooks/after_stop.sh b/go/hooks/after_stop.sh index 5374f78..d477445 100644 --- a/go/hooks/after_stop.sh +++ b/go/hooks/after_stop.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/go/hooks/before_start.sh b/go/hooks/before_start.sh index 1bf1156..045b32f 100644 --- a/go/hooks/before_start.sh +++ b/go/hooks/before_start.sh @@ -2,7 +2,7 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh if [ ! -d "$GO_PATH" ]; then if ! mkdir -p "$GO_PATH"; then diff --git a/go/hooks/before_stop.sh b/go/hooks/before_stop.sh index 5374f78..d477445 100644 --- a/go/hooks/before_stop.sh +++ b/go/hooks/before_stop.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/go/make_app_image/run.sh b/go/make_app_image/run.sh index 893fcc3..de92d08 100644 --- a/go/make_app_image/run.sh +++ b/go/make_app_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="go" @@ -11,7 +10,7 @@ service_name="go" print_stage "try to pull/build sparrow-basic-${service_name} $IMAGE_BASIC_GO_VERSION" if pull basic $service_name $IMAGE_BASIC_GO_VERSION; then print_info "pull success" -elif source "./${service_name}/make_basic_image/run.sh"; then +elif . "./${service_name}/make_basic_image/run.sh"; then print_info "build success" else print_error "pull/build failed" diff --git a/go/make_basic_image/run.sh b/go/make_basic_image/run.sh index ebcb583..8d7f16c 100644 --- a/go/make_basic_image/run.sh +++ b/go/make_basic_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="go" diff --git a/jupyter/hooks/after_start.sh b/jupyter/hooks/after_start.sh index 0b01c7b..ec8131c 100644 --- a/jupyter/hooks/after_start.sh +++ b/jupyter/hooks/after_start.sh @@ -1,4 +1,4 @@ #!/bin/sh # include sdk of sparrow. -source .work/include/sdk.sh +. .work/include/sdk.sh diff --git a/jupyter/hooks/after_stop.sh b/jupyter/hooks/after_stop.sh index 0b01c7b..ec8131c 100644 --- a/jupyter/hooks/after_stop.sh +++ b/jupyter/hooks/after_stop.sh @@ -1,4 +1,4 @@ #!/bin/sh # include sdk of sparrow. -source .work/include/sdk.sh +. .work/include/sdk.sh diff --git a/jupyter/hooks/before_start.sh b/jupyter/hooks/before_start.sh index 0b01c7b..ec8131c 100644 --- a/jupyter/hooks/before_start.sh +++ b/jupyter/hooks/before_start.sh @@ -1,4 +1,4 @@ #!/bin/sh # include sdk of sparrow. -source .work/include/sdk.sh +. .work/include/sdk.sh diff --git a/jupyter/hooks/before_stop.sh b/jupyter/hooks/before_stop.sh index 0b01c7b..ec8131c 100644 --- a/jupyter/hooks/before_stop.sh +++ b/jupyter/hooks/before_stop.sh @@ -1,4 +1,4 @@ #!/bin/sh # include sdk of sparrow. -source .work/include/sdk.sh +. .work/include/sdk.sh diff --git a/jupyter/make_app_image/run.sh b/jupyter/make_app_image/run.sh index e42e962..3df403b 100644 --- a/jupyter/make_app_image/run.sh +++ b/jupyter/make_app_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="jupyter" @@ -11,7 +10,7 @@ service_name="jupyter" print_stage "try to pull/build sparrow-basic-${service_name} $IMAGE_BASIC_JUPYTER_VERSION" if pull basic $service_name $IMAGE_BASIC_JUPYTER_VERSION; then print_info "pull success" -elif source "./${service_name}/make_basic_image/run.sh"; then +elif . "./${service_name}/make_basic_image/run.sh"; then print_info "build success" else print_error "pull/build failed" diff --git a/jupyter/make_basic_image/run.sh b/jupyter/make_basic_image/run.sh index e5d84ec..cdf8997 100644 --- a/jupyter/make_basic_image/run.sh +++ b/jupyter/make_basic_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="jupyter" diff --git a/kafka/hooks/after_start.sh b/kafka/hooks/after_start.sh index 3954de4..014f85d 100644 --- a/kafka/hooks/after_start.sh +++ b/kafka/hooks/after_start.sh @@ -2,7 +2,7 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh back_kafka_broker_container="sparrow_container_${CONTAINER_NAMESPACE}_kafka1" output=$(docker container ps -a | grep "$back_kafka_broker_container") diff --git a/kafka/hooks/after_stop.sh b/kafka/hooks/after_stop.sh index 397d67a..0499b7f 100644 --- a/kafka/hooks/after_stop.sh +++ b/kafka/hooks/after_stop.sh @@ -2,7 +2,7 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh output=$(docker container ps -a | grep 'sparrow_container_${CONTAINER_NAMESPACE}_kafka1') if [ -n "$output" ]; then diff --git a/kafka/hooks/before_start.sh b/kafka/hooks/before_start.sh index c777f4b..1c29aef 100644 --- a/kafka/hooks/before_start.sh +++ b/kafka/hooks/before_start.sh @@ -2,7 +2,7 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh # Due to the dependency of the Kafka service on the ZooKeeper service, it is necessary to start ZooKeeper first. if docker container inspect -f '{{.State.Running}}' "sparrow_container_${CONTAINER_NAMESPACE}_zookeeper" &> /dev/null; then diff --git a/kafka/hooks/before_stop.sh b/kafka/hooks/before_stop.sh index 5374f78..d477445 100644 --- a/kafka/hooks/before_stop.sh +++ b/kafka/hooks/before_stop.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/kafka/make_app_image/run.sh b/kafka/make_app_image/run.sh index 1cdea8f..ccff3ab 100644 --- a/kafka/make_app_image/run.sh +++ b/kafka/make_app_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="kafka" @@ -11,7 +10,7 @@ service_name="kafka" print_stage "try to pull/build sparrow-basic-${service_name} $IMAGE_BASIC_KAFKA_VERSION" if pull basic $service_name $IMAGE_BASIC_KAFKA_VERSION; then print_info "pull success" -elif source "./${service_name}/make_basic_image/run.sh"; then +elif . "./${service_name}/make_basic_image/run.sh"; then print_info "build success" else print_error "pull/build failed" diff --git a/kafka/make_basic_image/run.sh b/kafka/make_basic_image/run.sh index cd3b000..72e4413 100644 --- a/kafka/make_basic_image/run.sh +++ b/kafka/make_basic_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="kafka" diff --git a/kafkaui/hooks/after_start.sh b/kafkaui/hooks/after_start.sh index 5374f78..d477445 100644 --- a/kafkaui/hooks/after_start.sh +++ b/kafkaui/hooks/after_start.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/kafkaui/hooks/after_stop.sh b/kafkaui/hooks/after_stop.sh index 5374f78..d477445 100644 --- a/kafkaui/hooks/after_stop.sh +++ b/kafkaui/hooks/after_stop.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/kafkaui/hooks/before_start.sh b/kafkaui/hooks/before_start.sh index 5374f78..d477445 100644 --- a/kafkaui/hooks/before_start.sh +++ b/kafkaui/hooks/before_start.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/kafkaui/hooks/before_stop.sh b/kafkaui/hooks/before_stop.sh index 5374f78..d477445 100644 --- a/kafkaui/hooks/before_stop.sh +++ b/kafkaui/hooks/before_stop.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/kafkaui/make_app_image/run.sh b/kafkaui/make_app_image/run.sh index 109d293..c7900e1 100644 --- a/kafkaui/make_app_image/run.sh +++ b/kafkaui/make_app_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="kafkaui" @@ -11,7 +10,7 @@ service_name="kafkaui" print_stage "try to pull/build sparrow-basic-${service_name} $IMAGE_BASIC_KAFKAUI_VERSION" if pull basic $service_name $IMAGE_BASIC_KAFKAUI_VERSION; then print_info "pull success" -elif source "./${service_name}/make_basic_image/run.sh"; then +elif . "./${service_name}/make_basic_image/run.sh"; then print_info "build success" else print_error "pull/build failed" diff --git a/kafkaui/make_basic_image/run.sh b/kafkaui/make_basic_image/run.sh index 6e16034..8eb6ef0 100644 --- a/kafkaui/make_basic_image/run.sh +++ b/kafkaui/make_basic_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="kafkaui" diff --git a/langchain/hooks/after_start.sh b/langchain/hooks/after_start.sh index 6cbec95..b9dc087 100644 --- a/langchain/hooks/after_start.sh +++ b/langchain/hooks/after_start.sh @@ -2,7 +2,7 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh echo "after start, please reset your OPENAI_API_KEY inside the container manually: export OPENAI_API_KEY=''" docker exec -d sparrow_container_${CONTAINER_NAMESPACE}_langchain bash /home/sparrow/langchain/init/init.sh diff --git a/langchain/hooks/after_stop.sh b/langchain/hooks/after_stop.sh index 0b01c7b..ec8131c 100644 --- a/langchain/hooks/after_stop.sh +++ b/langchain/hooks/after_stop.sh @@ -1,4 +1,4 @@ #!/bin/sh # include sdk of sparrow. -source .work/include/sdk.sh +. .work/include/sdk.sh diff --git a/langchain/hooks/before_start.sh b/langchain/hooks/before_start.sh index 0b01c7b..ec8131c 100644 --- a/langchain/hooks/before_start.sh +++ b/langchain/hooks/before_start.sh @@ -1,4 +1,4 @@ #!/bin/sh # include sdk of sparrow. -source .work/include/sdk.sh +. .work/include/sdk.sh diff --git a/langchain/hooks/before_stop.sh b/langchain/hooks/before_stop.sh index 0b01c7b..ec8131c 100644 --- a/langchain/hooks/before_stop.sh +++ b/langchain/hooks/before_stop.sh @@ -1,4 +1,4 @@ #!/bin/sh # include sdk of sparrow. -source .work/include/sdk.sh +. .work/include/sdk.sh diff --git a/langchain/make_app_image/run.sh b/langchain/make_app_image/run.sh index 71f2a31..9d137ae 100644 --- a/langchain/make_app_image/run.sh +++ b/langchain/make_app_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="langchain" @@ -11,7 +10,7 @@ service_name="langchain" print_stage "try to pull/build sparrow-basic-${service_name} $IMAGE_BASIC_LANGCHAIN_VERSION" if pull basic $service_name $IMAGE_BASIC_LANGCHAIN_VERSION; then print_info "pull success" -elif source "./${service_name}/make_basic_image/run.sh"; then +elif . "./${service_name}/make_basic_image/run.sh"; then print_info "build success" else print_error "pull/build failed" diff --git a/langchain/make_basic_image/run.sh b/langchain/make_basic_image/run.sh index 11f13f8..1091267 100644 --- a/langchain/make_basic_image/run.sh +++ b/langchain/make_basic_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="langchain" diff --git a/mysql/hooks/after_start.sh b/mysql/hooks/after_start.sh index f5f2487..107ba74 100644 --- a/mysql/hooks/after_start.sh +++ b/mysql/hooks/after_start.sh @@ -2,6 +2,6 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh docker exec -d sparrow_container_${CONTAINER_NAMESPACE}_mysql bash /home/sparrow/mysql/init/init.sh diff --git a/mysql/hooks/after_stop.sh b/mysql/hooks/after_stop.sh index 5374f78..d477445 100644 --- a/mysql/hooks/after_stop.sh +++ b/mysql/hooks/after_stop.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/mysql/hooks/before_start.sh b/mysql/hooks/before_start.sh index 5374f78..d477445 100644 --- a/mysql/hooks/before_start.sh +++ b/mysql/hooks/before_start.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/mysql/hooks/before_stop.sh b/mysql/hooks/before_stop.sh index 5374f78..d477445 100644 --- a/mysql/hooks/before_stop.sh +++ b/mysql/hooks/before_stop.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/mysql/make_app_image/run.sh b/mysql/make_app_image/run.sh index 3441dc4..585ee6b 100644 --- a/mysql/make_app_image/run.sh +++ b/mysql/make_app_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="mysql" @@ -11,7 +10,7 @@ service_name="mysql" print_stage "try to pull/build sparrow-basic-${service_name} $IMAGE_BASIC_MYSQL_VERSION" if pull basic $service_name $IMAGE_BASIC_MYSQL_VERSION; then print_info "pull success" -elif source "./${service_name}/make_basic_image/run.sh"; then +elif . "./${service_name}/make_basic_image/run.sh"; then print_info "build success" else print_error "pull/build failed" diff --git a/mysql/make_basic_image/run.sh b/mysql/make_basic_image/run.sh index e62ab0a..11def0f 100644 --- a/mysql/make_basic_image/run.sh +++ b/mysql/make_basic_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="mysql" diff --git a/nginx/hooks/after_start.sh b/nginx/hooks/after_start.sh index 5374f78..d477445 100644 --- a/nginx/hooks/after_start.sh +++ b/nginx/hooks/after_start.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/nginx/hooks/after_stop.sh b/nginx/hooks/after_stop.sh index 5374f78..d477445 100644 --- a/nginx/hooks/after_stop.sh +++ b/nginx/hooks/after_stop.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/nginx/hooks/before_start.sh b/nginx/hooks/before_start.sh index 5374f78..d477445 100644 --- a/nginx/hooks/before_start.sh +++ b/nginx/hooks/before_start.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/nginx/hooks/before_stop.sh b/nginx/hooks/before_stop.sh index 5374f78..d477445 100644 --- a/nginx/hooks/before_stop.sh +++ b/nginx/hooks/before_stop.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/nginx/make_app_image/run.sh b/nginx/make_app_image/run.sh index 3edf4a6..b91ce73 100644 --- a/nginx/make_app_image/run.sh +++ b/nginx/make_app_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="nginx" @@ -11,7 +10,7 @@ service_name="nginx" print_stage "try to pull/build sparrow-basic-${service_name} $IMAGE_BASIC_NGINX_VERSION" if pull basic $service_name $IMAGE_BASIC_NGINX_VERSION; then print_info "pull success" -elif source "./${service_name}/make_basic_image/run.sh"; then +elif . "./${service_name}/make_basic_image/run.sh"; then print_info "build success" else print_error "pull/build failed" diff --git a/nginx/make_basic_image/run.sh b/nginx/make_basic_image/run.sh index 0995aca..218f7d2 100644 --- a/nginx/make_basic_image/run.sh +++ b/nginx/make_basic_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="nginx" diff --git a/nodejs/hooks/after_start.sh b/nodejs/hooks/after_start.sh index 0b01c7b..ec8131c 100644 --- a/nodejs/hooks/after_start.sh +++ b/nodejs/hooks/after_start.sh @@ -1,4 +1,4 @@ #!/bin/sh # include sdk of sparrow. -source .work/include/sdk.sh +. .work/include/sdk.sh diff --git a/nodejs/hooks/after_stop.sh b/nodejs/hooks/after_stop.sh index 0b01c7b..ec8131c 100644 --- a/nodejs/hooks/after_stop.sh +++ b/nodejs/hooks/after_stop.sh @@ -1,4 +1,4 @@ #!/bin/sh # include sdk of sparrow. -source .work/include/sdk.sh +. .work/include/sdk.sh diff --git a/nodejs/hooks/before_start.sh b/nodejs/hooks/before_start.sh index 0b01c7b..ec8131c 100644 --- a/nodejs/hooks/before_start.sh +++ b/nodejs/hooks/before_start.sh @@ -1,4 +1,4 @@ #!/bin/sh # include sdk of sparrow. -source .work/include/sdk.sh +. .work/include/sdk.sh diff --git a/nodejs/hooks/before_stop.sh b/nodejs/hooks/before_stop.sh index 0b01c7b..ec8131c 100644 --- a/nodejs/hooks/before_stop.sh +++ b/nodejs/hooks/before_stop.sh @@ -1,4 +1,4 @@ #!/bin/sh # include sdk of sparrow. -source .work/include/sdk.sh +. .work/include/sdk.sh diff --git a/nodejs/make_app_image/run.sh b/nodejs/make_app_image/run.sh index 87efe41..2e7c273 100644 --- a/nodejs/make_app_image/run.sh +++ b/nodejs/make_app_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="nodejs" @@ -11,7 +10,7 @@ service_name="nodejs" print_stage "try to pull/build sparrow-basic-${service_name} $IMAGE_BASIC_NODEJS_VERSION" if pull basic $service_name $IMAGE_BASIC_NODEJS_VERSION; then print_info "pull success" -elif source "./${service_name}/make_basic_image/run.sh"; then +elif . "./${service_name}/make_basic_image/run.sh"; then print_info "build success" else print_error "pull/build failed" diff --git a/nodejs/make_basic_image/run.sh b/nodejs/make_basic_image/run.sh index 85a1416..8ad702a 100644 --- a/nodejs/make_basic_image/run.sh +++ b/nodejs/make_basic_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="nodejs" diff --git a/phpfpm/hooks/after_start.sh b/phpfpm/hooks/after_start.sh index 3cedb2d..2e6f96f 100644 --- a/phpfpm/hooks/after_start.sh +++ b/phpfpm/hooks/after_start.sh @@ -2,6 +2,6 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh docker exec -e PHPFPM_LARAVEL_APP_LOG_PATH=$PHPFPM_LARAVEL_APP_LOG_PATH -d sparrow_container_${CONTAINER_NAMESPACE}_phpfpm bash /home/sparrow/phpfpm/init/init.sh diff --git a/phpfpm/hooks/after_stop.sh b/phpfpm/hooks/after_stop.sh index 5374f78..d477445 100644 --- a/phpfpm/hooks/after_stop.sh +++ b/phpfpm/hooks/after_stop.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/phpfpm/hooks/before_start.sh b/phpfpm/hooks/before_start.sh index 5374f78..d477445 100644 --- a/phpfpm/hooks/before_start.sh +++ b/phpfpm/hooks/before_start.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/phpfpm/hooks/before_stop.sh b/phpfpm/hooks/before_stop.sh index 5374f78..d477445 100644 --- a/phpfpm/hooks/before_stop.sh +++ b/phpfpm/hooks/before_stop.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/phpfpm/make_app_image/run.sh b/phpfpm/make_app_image/run.sh index 1313d20..1c4265c 100644 --- a/phpfpm/make_app_image/run.sh +++ b/phpfpm/make_app_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="phpfpm" @@ -11,7 +10,7 @@ service_name="phpfpm" print_stage "try to pull/build sparrow-basic-${service_name} $IMAGE_BASIC_PHPFPM_VERSION" if pull basic $service_name $IMAGE_BASIC_PHPFPM_VERSION; then print_info "pull success" -elif source "./${service_name}/make_basic_image/run.sh"; then +elif . "./${service_name}/make_basic_image/run.sh"; then print_info "build success" else print_error "pull/build failed" diff --git a/phpfpm/make_basic_image/run.sh b/phpfpm/make_basic_image/run.sh index 7cc6967..db2d8f1 100644 --- a/phpfpm/make_basic_image/run.sh +++ b/phpfpm/make_basic_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="phpfpm" diff --git a/postgres/hooks/after_start.sh b/postgres/hooks/after_start.sh index 5374f78..d477445 100644 --- a/postgres/hooks/after_start.sh +++ b/postgres/hooks/after_start.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/postgres/hooks/after_stop.sh b/postgres/hooks/after_stop.sh index 5374f78..d477445 100644 --- a/postgres/hooks/after_stop.sh +++ b/postgres/hooks/after_stop.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/postgres/hooks/before_start.sh b/postgres/hooks/before_start.sh index 5374f78..d477445 100644 --- a/postgres/hooks/before_start.sh +++ b/postgres/hooks/before_start.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/postgres/hooks/before_stop.sh b/postgres/hooks/before_stop.sh index 5374f78..d477445 100644 --- a/postgres/hooks/before_stop.sh +++ b/postgres/hooks/before_stop.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/postgres/make_app_image/run.sh b/postgres/make_app_image/run.sh index d9ff7df..5f34fa6 100644 --- a/postgres/make_app_image/run.sh +++ b/postgres/make_app_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="postgres" @@ -11,7 +10,7 @@ service_name="postgres" print_stage "try to pull/build sparrow-basic-${service_name} $IMAGE_BASIC_POSTGRES_VERSION" if pull basic $service_name $IMAGE_BASIC_POSTGRES_VERSION; then print_info "pull success" -elif source "./${service_name}/make_basic_image/run.sh"; then +elif . "./${service_name}/make_basic_image/run.sh"; then print_info "build success" else print_error "pull/build failed" diff --git a/postgres/make_basic_image/run.sh b/postgres/make_basic_image/run.sh index e99274d..3e2e418 100644 --- a/postgres/make_basic_image/run.sh +++ b/postgres/make_basic_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="postgres" diff --git a/python/hooks/after_start.sh b/python/hooks/after_start.sh index 5374f78..d477445 100644 --- a/python/hooks/after_start.sh +++ b/python/hooks/after_start.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/python/hooks/after_stop.sh b/python/hooks/after_stop.sh index 5374f78..d477445 100644 --- a/python/hooks/after_stop.sh +++ b/python/hooks/after_stop.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/python/hooks/before_start.sh b/python/hooks/before_start.sh index 5374f78..d477445 100644 --- a/python/hooks/before_start.sh +++ b/python/hooks/before_start.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/python/hooks/before_stop.sh b/python/hooks/before_stop.sh index 5374f78..d477445 100644 --- a/python/hooks/before_stop.sh +++ b/python/hooks/before_stop.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/python/make_app_image/run.sh b/python/make_app_image/run.sh index 99250c9..5516d70 100644 --- a/python/make_app_image/run.sh +++ b/python/make_app_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="python" @@ -11,7 +10,7 @@ service_name="python" print_stage "try to pull/build sparrow-basic-${service_name} $IMAGE_BASIC_PYTHON_VERSION" if pull basic $service_name $IMAGE_BASIC_PYTHON_VERSION; then print_info "pull success" -elif source "./${service_name}/make_basic_image/run.sh"; then +elif . "./${service_name}/make_basic_image/run.sh"; then print_info "build success" else print_error "pull/build failed" diff --git a/python/make_basic_image/run.sh b/python/make_basic_image/run.sh index 3c7902c..09cacd4 100644 --- a/python/make_basic_image/run.sh +++ b/python/make_basic_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="python" diff --git a/redis/hooks/after_start.sh b/redis/hooks/after_start.sh index 5374f78..d477445 100644 --- a/redis/hooks/after_start.sh +++ b/redis/hooks/after_start.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/redis/hooks/after_stop.sh b/redis/hooks/after_stop.sh index 5374f78..d477445 100644 --- a/redis/hooks/after_stop.sh +++ b/redis/hooks/after_stop.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/redis/hooks/before_start.sh b/redis/hooks/before_start.sh index 5374f78..d477445 100644 --- a/redis/hooks/before_start.sh +++ b/redis/hooks/before_start.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/redis/hooks/before_stop.sh b/redis/hooks/before_stop.sh index 5374f78..d477445 100644 --- a/redis/hooks/before_stop.sh +++ b/redis/hooks/before_stop.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/redis/make_app_image/run.sh b/redis/make_app_image/run.sh index a8a029c..6a96b2a 100644 --- a/redis/make_app_image/run.sh +++ b/redis/make_app_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="redis" @@ -11,7 +10,7 @@ service_name="redis" print_stage "try to pull/build sparrow-basic-${service_name} $IMAGE_BASIC_REDIS_VERSION" if pull basic $service_name $IMAGE_BASIC_REDIS_VERSION; then print_info "pull success" -elif source "./${service_name}/make_basic_image/run.sh"; then +elif . "./${service_name}/make_basic_image/run.sh"; then print_info "build success" else print_error "pull/build failed" diff --git a/redis/make_basic_image/run.sh b/redis/make_basic_image/run.sh index 60437e5..072551b 100644 --- a/redis/make_basic_image/run.sh +++ b/redis/make_basic_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="redis" diff --git a/sparrow b/sparrow index b1aab4c..f382dae 100755 --- a/sparrow +++ b/sparrow @@ -1,9 +1,12 @@ #!/bin/sh +# define the base path of project. +CUR_PATH=$(cd "$(dirname "$0")" && pwd) +SPARROW_BASE_PATH=$CUR_PATH + # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # extract command COMMAND=$1 @@ -31,7 +34,7 @@ else fi # include sdk of sparrow. -source .work/include/sdk.sh +. .work/include/sdk.sh # do sparrow hook hook() { @@ -39,7 +42,7 @@ hook() { hook_file="$2/hooks/$1.sh" if [ -f "${hook_file}" ]; then print_info "do hook: ${hook_file}" - source "${hook_file}" + . "${hook_file}" fi } @@ -98,7 +101,7 @@ updateone() { # build app image print_stage "do build sparrow-app-${1} image..." - if ! source "./${1}/make_app_image/run.sh"; then + if ! . "./${1}/make_app_image/run.sh"; then print_error "failed to build sparrow-app-${1} image" exit 1 fi diff --git a/sparrowtool b/sparrowtool index 83d2805..0fef6d2 100755 --- a/sparrowtool +++ b/sparrowtool @@ -1,9 +1,12 @@ #!/bin/sh +# define the base path of project. +CUR_PATH=$(cd "$(dirname "$0")" && pwd) +SPARROW_BASE_PATH=$CUR_PATH + # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # extract command COMMAND=$1 @@ -33,7 +36,7 @@ else fi # include sdk of sparrow. -source .work/include/sdk.sh +. .work/include/sdk.sh # new something. new() { diff --git a/zookeeper/hooks/after_start.sh b/zookeeper/hooks/after_start.sh index 5374f78..d477445 100644 --- a/zookeeper/hooks/after_start.sh +++ b/zookeeper/hooks/after_start.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/zookeeper/hooks/after_stop.sh b/zookeeper/hooks/after_stop.sh index 5374f78..d477445 100644 --- a/zookeeper/hooks/after_stop.sh +++ b/zookeeper/hooks/after_stop.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/zookeeper/hooks/before_start.sh b/zookeeper/hooks/before_start.sh index 5374f78..d477445 100644 --- a/zookeeper/hooks/before_start.sh +++ b/zookeeper/hooks/before_start.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/zookeeper/hooks/before_stop.sh b/zookeeper/hooks/before_stop.sh index 5374f78..d477445 100644 --- a/zookeeper/hooks/before_stop.sh +++ b/zookeeper/hooks/before_stop.sh @@ -2,4 +2,4 @@ # not need to include sdk of sparrow. # because the execution of hook scripts must be within the sparrow script, sdk.sh has already been imported at this point. -# source .work/include/sdk.sh +# . .work/include/sdk.sh diff --git a/zookeeper/make_app_image/run.sh b/zookeeper/make_app_image/run.sh index f8a8dd9..1d9aeec 100644 --- a/zookeeper/make_app_image/run.sh +++ b/zookeeper/make_app_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="zookeeper" @@ -11,7 +10,7 @@ service_name="zookeeper" print_stage "try to pull/build sparrow-basic-${service_name} $IMAGE_BASIC_ZOOKEEPER_VERSION" if pull basic $service_name $IMAGE_BASIC_ZOOKEEPER_VERSION; then print_info "pull success" -elif source "./${service_name}/make_basic_image/run.sh"; then +elif . "./${service_name}/make_basic_image/run.sh"; then print_info "build success" else print_error "pull/build failed" diff --git a/zookeeper/make_basic_image/run.sh b/zookeeper/make_basic_image/run.sh index b8641ab..4e667f0 100644 --- a/zookeeper/make_basic_image/run.sh +++ b/zookeeper/make_basic_image/run.sh @@ -1,9 +1,8 @@ #!/bin/sh # cd base dir of project. -CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) -cd $CUR_PATH && cd ../../ -BATH_PATH=$(pwd) +# the process is in the same shell as the starting shell. +cd $SPARROW_BASE_PATH # define this service. service_name="zookeeper"