[Fuego] [PATCH 1/9] Remove unused variables from docker build/create/run scripts

Tim.Bird at sony.com Tim.Bird at sony.com
Sun Jan 28 19:27:38 UTC 2018



> -----Original Message-----
> From: Guilherme Campos Camargo
> 
> The DIR variable is only being used by the CREATE scripts. There's no
> reason to keep it in the BUILD/REMOVE/START scripts as well.
> 
> Signed-off-by: Guilherme Campos Camargo <guicc at profusion.mobi>
> ---
>  fuego-host-scripts/docker-build-image.sh      | 9 +--------
>  fuego-host-scripts/docker-remove-container.sh | 8 --------
>  fuego-host-scripts/docker-remove-image.sh     | 9 +--------
>  fuego-host-scripts/docker-start-container.sh  | 8 --------
>  4 files changed, 2 insertions(+), 32 deletions(-)
> 
> diff --git a/fuego-host-scripts/docker-build-image.sh b/fuego-host-
> scripts/docker-build-image.sh
> index a197dc5..7c11b11 100755
> --- a/fuego-host-scripts/docker-build-image.sh
> +++ b/fuego-host-scripts/docker-build-image.sh
> @@ -1,12 +1,5 @@
> +#!/bin/bash
>  # $1 - name for the docker image (default: fuego)
> -SOURCE="${BASH_SOURCE[0]}"
> -while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a
> symlink
> -  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
> -  SOURCE="$(readlink "$SOURCE")"
> -  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a
> relative symlink, we need to resolve it relative to the path where the symlink
> file was located
> -done
> -DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
> -
>  DOCKERIMAGE=${1:-fuego}
> 
>  if [ "$(id -u)" == "0" ]; then
> diff --git a/fuego-host-scripts/docker-remove-container.sh b/fuego-host-
> scripts/docker-remove-container.sh
> index 2aae6a9..00c7ac9 100755
> --- a/fuego-host-scripts/docker-remove-container.sh
> +++ b/fuego-host-scripts/docker-remove-container.sh
> @@ -1,13 +1,5 @@
>  #!/bin/bash
>  # $1 - name for the docker container (default: fuego-container)
> -SOURCE="${BASH_SOURCE[0]}"
> -while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a
> symlink
> -  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
> -  SOURCE="$(readlink "$SOURCE")"
> -  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a
> relative symlink, we need to resolve it relative to the path where the symlink
> file was located
> -done
> -DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
> -
>  DOCKERCONTAINER=${1:-fuego-container}
> 
>  sudo docker rm ${DOCKERCONTAINER}
> diff --git a/fuego-host-scripts/docker-remove-image.sh b/fuego-host-
> scripts/docker-remove-image.sh
> index 91dbda7..4c24684 100755
> --- a/fuego-host-scripts/docker-remove-image.sh
> +++ b/fuego-host-scripts/docker-remove-image.sh
> @@ -1,12 +1,5 @@
> +#!/bin/bash
>  # $1 - name for the docker image (default: fuego)
> -SOURCE="${BASH_SOURCE[0]}"
> -while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a
> symlink
> -  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
> -  SOURCE="$(readlink "$SOURCE")"
> -  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a
> relative symlink, we need to resolve it relative to the path where the symlink
> file was located
> -done
> -DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
> -
>  DOCKERIMAGE=${1:-fuego}
> 
>  sudo docker rmi ${DOCKERIMAGE}
> diff --git a/fuego-host-scripts/docker-start-container.sh b/fuego-host-
> scripts/docker-start-container.sh
> index d9de85a..d0cee1a 100755
> --- a/fuego-host-scripts/docker-start-container.sh
> +++ b/fuego-host-scripts/docker-start-container.sh
> @@ -1,13 +1,5 @@
>  #!/bin/bash
>  # $1 - name for the docker container (default: fuego-container)
> -SOURCE="${BASH_SOURCE[0]}"
> -while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a
> symlink
> -  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
> -  SOURCE="$(readlink "$SOURCE")"
> -  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a
> relative symlink, we need to resolve it relative to the path where the symlink
> file was located
> -done
> -DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
> -
>  DOCKERCONTAINER=${1:-fuego-container}
> 
>  echo "Starting Fuego container (${DOCKERCONTAINER})"
> --
> 2.15.1


Nice cleanup.  Thanks.
Applied.
 -- Tim



More information about the Fuego mailing list