style: Clean up start_docker.sh
* Address syntax issues exposed by linter
This commit is contained in:
1 parent
c586473a8b
commit
71084aac23
1 file changed
+16
-16
+16
-16
@@ -19,7 +19,7 @@ Options:
|
||||
-h,--help Print this help message and exit
|
||||
|
||||
EOF
|
||||
exit $1
|
||||
exit "$1"
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ while [[ $# -gt 0 ]]; do
|
||||
if [[ "${#port_mappings[@]}" -gt 0 ]]; then
|
||||
next_ports=" $next_ports"
|
||||
fi
|
||||
port_mappings+="$next_ports"
|
||||
port_mappings+=("$next_ports")
|
||||
shift 2
|
||||
;;
|
||||
-m)
|
||||
@@ -125,8 +125,8 @@ if [[ -z "$image_name" ]]; then
|
||||
image_name="bluetradingsystems/spark-crypto-dev"
|
||||
fi
|
||||
|
||||
declare host_name="$(hostname)"
|
||||
if [[ ! -z "$cont_name" ]]; then
|
||||
host_name="$(hostname)"
|
||||
if [[ -n "$cont_name" ]]; then
|
||||
host_name="$host_name.$cont_name"
|
||||
fi
|
||||
|
||||
@@ -143,11 +143,11 @@ if [[ -z "$docker_user" ]]; then
|
||||
docker_user="$USER"
|
||||
fi
|
||||
|
||||
declare home_src=$HOME/.spark-dev/mounts/$mount_name
|
||||
declare home_tgt=$HOME
|
||||
declare repo_src=$(git rev-parse --show-superproject-working-tree)
|
||||
declare repo_tgt=$HOME/$(basename $repo_src)
|
||||
declare working_dir=$HOME
|
||||
home_src=$HOME/.spark-dev/mounts/$mount_name
|
||||
home_tgt=$HOME
|
||||
repo_src=$(git rev-parse --show-superproject-working-tree)
|
||||
repo_tgt=$HOME/$(basename "$repo_src")
|
||||
working_dir=$HOME
|
||||
|
||||
if [[ -e $home_src ]]; then
|
||||
# Don't overwrite existing dir (might be mounted in another container)
|
||||
@@ -155,7 +155,7 @@ if [[ -e $home_src ]]; then
|
||||
print_help_and_exit 1
|
||||
fi
|
||||
|
||||
mkdir -p $home_src
|
||||
mkdir -p "$home_src"
|
||||
|
||||
if [[ "${#port_mappings[@]}" -eq 0 ]]; then
|
||||
port_mappings=("8000:8000" "8001:8001" "8002:8002" "8003:8003")
|
||||
@@ -202,9 +202,9 @@ docker run \
|
||||
|
||||
# Add user w/ same uid and gid as the current user outside of docker, so the
|
||||
# user inside the docker has file permissions in the mounted dir.
|
||||
declare docker_group="$docker_user"
|
||||
declare docker_user_uid="$(id -u $USER)"
|
||||
declare docker_user_gid="$(id -g $USER)"
|
||||
docker_group="$docker_user"
|
||||
docker_user_uid="$(id -u "$USER")"
|
||||
docker_user_gid="$(id -g "$USER")"
|
||||
|
||||
echo "Adding user in container '$cont_name'
|
||||
name : $docker_user
|
||||
@@ -216,8 +216,8 @@ if [[ -z "$docker_pass" ]]; then
|
||||
echo "Giving user '$docker_user' a secure password: $docker_pass"
|
||||
fi
|
||||
|
||||
docker exec -u root -it "$cont_name" groupadd -g $docker_user_gid "$docker_group"
|
||||
docker exec -u root -it "$cont_name" useradd -u $docker_user_uid -g $docker_user_gid "$docker_user"
|
||||
docker exec -u root -it "$cont_name" usermod --password "$(openssl passwd -1 $docker_pass)" "$docker_user"
|
||||
docker exec -u root -it "$cont_name" groupadd -g "$docker_user_gid" "$docker_group"
|
||||
docker exec -u root -it "$cont_name" useradd -u "$docker_user_uid" -g "$docker_user_gid" "$docker_user"
|
||||
docker exec -u root -it "$cont_name" usermod --password "$(openssl passwd -1 "$docker_pass")" "$docker_user"
|
||||
docker exec -u root -it "$cont_name" usermod -aG sudo "$docker_user"
|
||||
docker exec -u root -it "$cont_name" "$repo_tgt/externals/src/emumba/install_emumba-deribit-connector.sh"
|
||||
Reference in new issue
Block a user