Format all shell scripts in tools folder

Change-Id: Ieef2eb93d56c03972b4dc63a1c55aabf1fb0d169
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2020-01-06 00:29:59 +08:00
parent 390ebd504f
commit 3b9efc95a2
23 changed files with 1205 additions and 1213 deletions
+52 -52
View File
@@ -53,16 +53,16 @@ usage="USAGE: $0 [-nofat] <topdir>"
# Verify if we have the optional "-nofat"
if [ "$nofat" == "-nofat" ]; then
echo "We will not mount a FAT/RAMDISK!"
usefat=false
echo "We will not mount a FAT/RAMDISK!"
usefat=false
else
topdir=$1
topdir=$1
fi
if [ -z "$topdir" -o ! -d "$topdir" ]; then
echo "The full path to the NuttX base directory must be provided on the command line"
echo $usage
exit 1
echo "The full path to the NuttX base directory must be provided on the command line"
echo $usage
exit 1
fi
# Extract all values from the .config in the $topdir that contains all of the NuttX
@@ -71,9 +71,9 @@ fi
# to make that practical
if [ ! -r $topdir/.config ]; then
echo "No readable file at $topdir/.config"
echo "Has NuttX been configured?"
exit 1
echo "No readable file at $topdir/.config"
echo "Has NuttX been configured?"
exit 1
fi
romfsetc=`grep CONFIG_NSH_ROMFSETC= $topdir/.config | cut -d'=' -f2`
@@ -102,42 +102,42 @@ fi
# Mountpoint support must be enabled
if [ "X$disablempt" = "Xy" ]; then
echo "Mountpoint support is required for this feature"
echo "Set CONFIG_DISABLE_MOUNTPOINT=n to continue"
exit 1
echo "Mountpoint support is required for this feature"
echo "Set CONFIG_DISABLE_MOUNTPOINT=n to continue"
exit 1
fi
# Scripting support must be enabled
if [ "X$disablescript" = "Xy" ]; then
echo "NSH scripting support is required for this feature"
echo "Set CONFIG_NSH_DISABLESCRIPT=n to continue"
exit 1
echo "NSH scripting support is required for this feature"
echo "Set CONFIG_NSH_DISABLESCRIPT=n to continue"
exit 1
fi
# We need at least 5 file descriptors: One for the ROMFS mount and one for
# FAT mount performed in rcS, plus three for stdio.
if [ -z "$ndescriptors" -o "$ndescriptors" -lt 5 ]; then
echo "Insufficient file descriptors have been allocated"
echo "Set CONFIG_NFILE_DESCRIPTORS to value greater than 4"
exit 1
echo "Insufficient file descriptors have been allocated"
echo "Set CONFIG_NFILE_DESCRIPTORS to value greater than 4"
exit 1
fi
# ROMFS support is required, of course
if [ "X$romfs" != "Xy" ]; then
echo "ROMFS support is disabled in the NuttX configuration"
echo "Set CONFIG_FS_ROMFS=y to continue"
exit 0
echo "ROMFS support is disabled in the NuttX configuration"
echo "Set CONFIG_FS_ROMFS=y to continue"
exit 0
fi
# If it is the default rcS.template, then it also requires FAT FS support
if [ "$usefat" = true -a "X$fatfs" != "Xy" ]; then
echo "FAT FS support is disabled in the NuttX configuration"
echo "Set CONFIG_FS_FAT=y to continue"
exit 0
echo "FAT FS support is disabled in the NuttX configuration"
echo "Set CONFIG_FS_FAT=y to continue"
exit 0
fi
# Verify that genromfs has been installed
@@ -151,16 +151,16 @@ genromfs -h 1>/dev/null 2>&1 || { \
# Supply defaults for all un-defined ROMFS settings
if [ -z "$romfsmpt" ]; then
romfsmpt="/etc"
romfsmpt="/etc"
fi
if [ -z "$initscript" ]; then
initscript="init.d/rcS"
initscript="init.d/rcS"
fi
if [ -z "$romfsdevno" ]; then
romfsdevno=0
romfsdevno=0
fi
if [ -z "$romfssectsize" ]; then
romfssectsize=64
romfssectsize=64
fi
# If FAT FS is a requirement
@@ -170,16 +170,16 @@ if [ "$usefat" = true ]; then
# Supply defaults for all un-defined FAT FS settings
if [ -z "$fatdevno" ]; then
fatdevno=1
fatdevno=1
fi
if [ -z "$fatsectsize" ]; then
fatsectsize=512
fatsectsize=512
fi
if [ -z "$fatnsectors" ]; then
fatnsectors=1024
fatnsectors=1024
fi
if [ -z "$fatmpt" ]; then
fatmpt="/tmp"
fatmpt="/tmp"
fi
fi
@@ -187,50 +187,50 @@ fi
# /., /./*, /.., or /../*
if [ ${romfsmpt:0:1} != "\"" ]; then
echo "CONFIG_NSH_ROMFSMOUNTPT must be a string"
echo "Change it so that it is enclosed in quotes."
exit 1
echo "CONFIG_NSH_ROMFSMOUNTPT must be a string"
echo "Change it so that it is enclosed in quotes."
exit 1
fi
uromfsmpt=`echo $romfsmpt | sed -e "s/\"//g"`
if [ ${uromfsmpt:0:1} != "/" ]; then
echo "CONFIG_NSH_ROMFSMOUNTPT must be an absolute path in the target FS"
echo "Change it so that it begins with the character '/'. Eg. /etc"
exit 1
echo "CONFIG_NSH_ROMFSMOUNTPT must be an absolute path in the target FS"
echo "Change it so that it begins with the character '/'. Eg. /etc"
exit 1
fi
tmpdir=$uromfsmpt
while [ ${tmpdir:0:1} == "/" ]; do
tmpdir=${tmpdir:1}
tmpdir=${tmpdir:1}
done
if [ -z "$tmpdir" -o "X$tmpdir" = "Xdev" -o "X$tmpdir" = "." -o \
${tmpdir:0:2} = "./" -o "X$tmpdir" = ".." -o ${tmpdir:0:3} = "../" ]; then
echo "Invalid CONFIG_NSH_ROMFSMOUNTPT selection."
exit 1
echo "Invalid CONFIG_NSH_ROMFSMOUNTPT selection."
exit 1
fi
# Verify that the path to the init file is a relative path and not ., ./*, .., or ../*
if [ ${initscript:0:1} != "\"" ]; then
echo "CONFIG_NSH_INITSCRIPT must be a string"
echo "Change it so that it is enclosed in quotes."
exit 1
echo "CONFIG_NSH_INITSCRIPT must be a string"
echo "Change it so that it is enclosed in quotes."
exit 1
fi
uinitscript=`echo $initscript | sed -e "s/\"//g"`
if [ ${uinitscript:0:1} == "/" ]; then
echo "CONFIG_NSH_INITSCRIPT must be an relative path in under $romfsmpt"
echo "Change it so that it begins with the character '/'. Eg. init.d/rcS. "
exit 1
echo "CONFIG_NSH_INITSCRIPT must be an relative path in under $romfsmpt"
echo "Change it so that it begins with the character '/'. Eg. init.d/rcS. "
exit 1
fi
if [ "X$uinitscript" = "." -o ${uinitscript:0:2} = "./" -o \
"X$uinitscript" = ".." -o ${uinitscript:0:3} = "../" ]; then
echo "Invalid CONFIG_NSH_INITSCRIPT selection. Must not begin with . or .."
exit 1
echo "Invalid CONFIG_NSH_INITSCRIPT selection. Must not begin with . or .."
exit 1
fi
# Create a working directory
@@ -241,9 +241,9 @@ mkdir -p $workingdir || { echo "Failed to created the new $workingdir"; exit 1;
# Create the rcS file from the rcS.template
if [ ! -r $rcstemplate ]; then
echo "$rcstemplate does not exist"
rmdir $workingdir
exit 1
echo "$rcstemplate does not exist"
rmdir $workingdir
exit 1
fi
# If we are using FAT FS with RAMDISK we need to setup it