Skip to content

Commit

Permalink
Merge pull request #40 from xiaoxiang781216/fix-shell-script-format
Browse files Browse the repository at this point in the history
tools/*.sh:  Format all shell scripts in tools folder
  • Loading branch information
patacongo authored Jan 5, 2020
2 parents 390ebd5 + 3b9efc9 commit 7179f29
Show file tree
Hide file tree
Showing 23 changed files with 1,227 additions and 1,235 deletions.
6 changes: 3 additions & 3 deletions tools/configure.bat
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ echo -f:
echo Informs the tool that it should use POSIX style paths like /usr/local/bin.
echo By default, Windows style paths like C:\\Program Files are used.
echo -l selects the Linux (l) host environment. The [-c^|u^|n] options
echo select one of the Windows environments. Default: Use host setup
echo in the defconfig file
echo select one of the Windows environments. Default: Use host setup
echo in the defconfig file
echo [-c^|u^|n] selects the Windows host and a Windows environment: Cygwin (c),
echo Ubuntu under Windows 10 (u), or Windows native (n). Default Cygwin
echo Ubuntu under Windows 10 (u), or Windows native (n). Default Cygwin
echo -a ^<app-dir^>:
echo Informs the configuration tool where the application build
echo directory. This is a relative path from the top-level NuttX
Expand Down
156 changes: 78 additions & 78 deletions tools/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,52 +75,52 @@ skip=0

while [ ! -z "$1" ]; do
case "$1" in
-a )
shift
appdir=$1
;;
-c )
host=windows
wenv=cygwin
;;
-d )
debug=y
set -x
;;
-g )
host=windows
wenv=msys
;;
-h )
-a )
shift
appdir=$1
;;
-c )
host=windows
wenv=cygwin
;;
-d )
debug=y
set -x
;;
-g )
host=windows
wenv=msys
;;
-h )
echo "$USAGE"
exit 0
;;
-l )
host=linux
;;
-m )
host=macos
;;
-n )
host=windows
wenv=native
;;
-s )
skip=1
;;
-u )
host=windows
wenv=ubuntu
;;
*)
if [ ! -z "${boardconfig}" ]; then
echo ""
echo "<board/config> defined twice"
echo "$USAGE"
exit 0
;;
-l )
host=linux
;;
-m )
host=macos
;;
-n )
host=windows
wenv=native
;;
-s )
skip=1
;;
-u )
host=windows
wenv=ubuntu
;;
*)
if [ ! -z "${boardconfig}" ]; then
echo ""
echo "<board/config> defined twice"
echo "$USAGE"
exit 1
fi
boardconfig=$1
;;
exit 1
fi
boardconfig=$1
;;
esac
shift
done
Expand Down Expand Up @@ -330,43 +330,43 @@ if [ ! -z "$host" ]; then
sed -i -e "/CONFIG_SIM_X8664_SYSTEMV/d" ${dest_config}

case "$host" in
"linux")
echo " Select CONFIG_HOST_LINUX=y"
echo "CONFIG_HOST_LINUX=y" >> "${dest_config}"
echo "CONFIG_SIM_X8664_SYSTEMV=y" >> "${dest_config}"
"linux")
echo " Select CONFIG_HOST_LINUX=y"
echo "CONFIG_HOST_LINUX=y" >> "${dest_config}"
echo "CONFIG_SIM_X8664_SYSTEMV=y" >> "${dest_config}"
;;

"macos")
echo " Select CONFIG_HOST_MACOS=y"
echo "CONFIG_HOST_MACOS=y" >> "${dest_config}"
;;

"windows")
echo " Select CONFIG_HOST_WINDOWS=y"
echo "CONFIG_HOST_WINDOWS=y" >> "${dest_config}"
echo "CONFIG_SIM_X8664_MICROSOFT=y" >> "${dest_config}"

case "$wenv" in
"cygwin")
echo " Select CONFIG_WINDOWS_CYGWIN=y"
echo "CONFIG_WINDOWS_CYGWIN=y" >> "${dest_config}"
;;

"macos")
echo " Select CONFIG_HOST_MACOS=y"
echo "CONFIG_HOST_MACOS=y" >> "${dest_config}"
"msys")
echo " Select CONFIG_WINDOWS_MSYS=y"
echo "CONFIG_WINDOWS_MSYS=y" >> "${dest_config}"
;;

"windows")
echo " Select CONFIG_HOST_WINDOWS=y"
echo "CONFIG_HOST_WINDOWS=y" >> "${dest_config}"
echo "CONFIG_SIM_X8664_MICROSOFT=y" >> "${dest_config}"

case "$wenv" in
"cygwin")
echo " Select CONFIG_WINDOWS_CYGWIN=y"
echo "CONFIG_WINDOWS_CYGWIN=y" >> "${dest_config}"
;;

"msys")
echo " Select CONFIG_WINDOWS_MSYS=y"
echo "CONFIG_WINDOWS_MSYS=y" >> "${dest_config}"
;;

"ubuntu")
echo " Select CONFIG_WINDOWS_UBUNTU=y"
echo "CONFIG_WINDOWS_UBUNTU=y" >> "${dest_config}"
;;

*)
echo " Select CONFIG_WINDOWS_NATIVE=y"
echo "CONFIG_WINDOWS_NATIVE=y" >> "${dest_config}"
;;
esac
"ubuntu")
echo " Select CONFIG_WINDOWS_UBUNTU=y"
echo "CONFIG_WINDOWS_UBUNTU=y" >> "${dest_config}"
;;

*)
echo " Select CONFIG_WINDOWS_NATIVE=y"
echo "CONFIG_WINDOWS_NATIVE=y" >> "${dest_config}"
;;
esac
esac
fi

Expand Down
4 changes: 2 additions & 2 deletions tools/copydir.bat
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ goto :End
:ShowUsage
echo USAGE: %0 ^<src^> ^<dest^>
echo Where:
echo ^<src^> is the source directory to be copied
echo ^<dest^> is the destination directory to be created
echo ^<src^> is the source directory to be copied
echo ^<dest^> is the destination directory to be created

:End
41 changes: 20 additions & 21 deletions tools/copydir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ dest=$2
# Verify that arguments were provided

if [ -z "${src}" -o -z "${dest}" ]; then
echo "Missing src and/or dest arguments"
exit 1
echo "Missing src and/or dest arguments"
exit 1
fi

# Check if something already exists at the destination path replace it with
Expand All @@ -62,40 +62,39 @@ fi
# report that it does not exist.

if [ -h "${dest}" ]; then
rm -f "${dest}"
rm -f "${dest}"
else

# If the path exists and is a directory that contains the "fake link"
# mark, then treat it like a soft link (i.e., remove the directory)
# If the path exists and is a directory that contains the "fake link"
# mark, then treat it like a soft link (i.e., remove the directory)

if [ -d "${dest}" -a -f "${dest}/.fakelnk" ]; then
rm -rf "${dest}"
else
if [ -d "${dest}" -a -f "${dest}/.fakelnk" ]; then
rm -rf "${dest}"
else

# Does anything exist at the destination path?
# Does anything exist at the destination path?

if [ -e "${dest}" ]; then
if [ -e "${dest}" ]; then

# It is something else (like a file) or directory that does
# not contain the "fake link" mark
# It is something else (like a file) or directory that does
# not contain the "fake link" mark

echo "${dest} already exists but is not a symbolic link"
exit 1
fi
fi
echo "${dest} already exists but is not a symbolic link"
exit 1
fi
fi
fi

# Verify that a directory exists at the source path

if [ ! -d "${src}" ]; then
echo "No directory at ${src}"
exit 1
echo "No directory at ${src}"
exit 1
fi

# Copy the directory

cp -a "${src}" "${dest}" || \
{ echo "Failed to create link: $dest" ; rm -rf ${dest} ; exit 1 ; }
{ echo "Failed to create link: $dest" ; rm -rf ${dest} ; exit 1 ; }
touch "${dest}/.fakelnk" || \
{ echo "Failed to touch ${dest}/.fakelnk" ; rm -rf ${dest} ; exit 1 ; }

{ echo "Failed to touch ${dest}/.fakelnk" ; rm -rf ${dest} ; exit 1 ; }
18 changes: 9 additions & 9 deletions tools/define.bat
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,14 @@ echo definitions arguments for a variety of diffent ccpaths in a variety of
echo compilation environments"
echo USAGE:%progname% [-h] ^<compiler-path^> [-val ^<^val1^>] [^<def2^> [-val ^<val2^>] [^<def3^> [-val ^<val3^>] ...]]
echo Where:"
echo ^<compiler-path^>
echo The full path to your ccpath
echo ^<def1^> ^<def2^> ^<def3^> ...
echo A list of pre-preprocesser variable names to be defined.
echo [-val ^<val1^>] [-val ^<val2^>] [-val ^<val3^>] ...
echo optional values to be assigned to each pre-processor variable.
echo If not supplied, the variable will be defined with no explicit value.
echo -h
echo Show this text and exit
echo ^<compiler-path^>
echo The full path to your ccpath
echo ^<def1^> ^<def2^> ^<def3^> ...
echo A list of pre-preprocesser variable names to be defined.
echo [-val ^<val1^>] [-val ^<val2^>] [-val ^<val3^>] ...
echo optional values to be assigned to each pre-processor variable.
echo If not supplied, the variable will be defined with no explicit value.
echo -h
echo Show this text and exit

:End
Loading

0 comments on commit 7179f29

Please sign in to comment.