even more shellchecking

This commit is contained in:
Jeffrey Crowell 2015-06-16 22:59:01 -04:00
parent ddd58c7b25
commit 5812c52a15
10 changed files with 35 additions and 28 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
#A=`hg diff $@ | grep -v '+++' | grep ^+ |wc -l`
#B=`hg diff $@ | grep -v -- '---' | grep ^- |wc -l`
A=`git diff $* | grep -v '+++' | grep ^+ |wc -l`
B=`git diff $* | grep -v -- '---' | grep ^- |wc -l`
echo $((A-B))
A="$(git diff "$@" | grep -v '+++' | grep -c ^+)"
B="$(git diff "$@" | grep -v -- '---' | grep -c ^-)"
echo "$((A-B))"

View File

@ -1,7 +1,7 @@
#!/bin/sh
# find root
cd `dirname $PWD/$0`
cd "$(dirname "$PWD/$0")"
./clone-r2-bindings.sh
cd ..
@ -11,7 +11,7 @@ cat sys/CONFIG
echo "============="
[ -z "${PREFIX}" ] && PREFIX=/usr
ID=`id -u`
ID="$(id -u)"
if [ "$ID" = 0 ]; then
SUDO=
else
@ -20,9 +20,9 @@ fi
[ -n "${NOSUDO}" ] && SUDO=
cd radare2-bindings
./configure --prefix=${PREFIX} --enable=lua || exit 1
./configure --prefix="${PREFIX}" --enable=lua || exit 1
cd lua
make clean
make
[ ! "$1" = --no-install ] && \
${SUDO} make install DESTDIR=${DESTDIR}
${SUDO} make install DESTDIR="${DESTDIR}"

View File

@ -1,5 +1,5 @@
#!/bin/sh
cd `dirname $PWD/$0`
cd "$(dirname "$PWD/$0")"
cd _work
curl -o python-2.7.9.msi http://www.python.org/ftp/python/2.7.9/python-2.7.9.msi
msiexec /i python-2.7.9.msi

View File

@ -1,5 +1,5 @@
#!/bin/sh
cd `dirname $PWD/$0`
cd "$(dirname "$PWD/$0")"
./clone-r2-bindings.sh
cd ../radare2-bindings
@ -16,7 +16,7 @@ elif [ -x /usr/bin/pacman ]; then
C=i486-mingw32-gcc
H=i486-unknown-windows
G=i486-mingw32-g++
elif [ `uname` = Darwin ]; then
elif [ "$(uname)" = Darwin ]; then
C=i386-mingw32-gcc
H=i386-unknown-windows
G=i386-mingw32-g++

View File

@ -1,6 +1,6 @@
#!/bin/sh
# find root
cd `dirname $PWD/$0` ; cd ..
cd "$(dirname "$PWD/$0")" ; cd ..
#TODO: add support for ccache
# XXX. fails with >1
@ -21,7 +21,7 @@ elif [ -x /usr/bin/i686-w64-mingw32-gcc ]; then
elif [ -x /usr/bin/pacman ]; then
C=i486-mingw32-gcc
H=i486-unknown-windows
elif [ `uname` = Darwin ]; then
elif [ "$(uname)" = Darwin ]; then
C=i386-mingw32-gcc
H=i386-unknown-windows
elif [ -x /usr/bin/apt-get ]; then
@ -37,3 +37,5 @@ make mrproper
./configure ${CFGFLAGS} --with-compiler=$C --host=$H && \
make -s -j ${MAKE_JOBS} CC="${C} -static-libgcc" && \
make w32dist
LDFLAGS="${OLD_LDFLAGS}"

View File

@ -1,10 +1,10 @@
#!/bin/sh
# find root
cd `dirname $PWD/$0`
cd "$(dirname "$PWD/$0")"
if [ `uname` = Linux ]; then
case `uname -m` in
if [ "$(uname)" = "Linux" ]; then
case $(uname -m) in
i?86)
URL="http://downloads.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win64/Automated%20Builds/mingw-w64-bin_i686-linux_20110831.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmingw-w64%2Ffiles%2FToolchains%2520targetting%2520Win64%2FAutomated%2520Builds%2F&ts=1315999254&use_mirror=switch"
;;

View File

@ -3,7 +3,7 @@
MAKE_JOBS=8
# find root
cd `dirname $PWD/$0` ; cd ..
cd "$(dirname "$PWD/$0")" ; cd ..
export PATH=${PWD}/sys/_work/mingw64/bin:${PATH}
# TODO: add support for ccache

View File

@ -10,13 +10,16 @@ fi
#------------------------------------------#
PROGDIR=`dirname $0`
PROGDIR=`cd $PROGDIR && pwd`
PROGDIR=$(dirname "$0")
PROGDIR=$(cd "$PROGDIR" && pwd)
ANDROID_KITKAT=19
ANDROID_LOLIPOP=21
OS=`uname | tr 'A-Z' 'a-z'`
# shellcheck disable=SC2086
# shellcheck disable=SC2018
# shellcheck disable=SC2019
OS="$(uname | tr 'A-Z' 'a-z')"
[ "${OS}" = macos ] && OS=darwin
ARCH2=${ARCH}
@ -64,9 +67,11 @@ PROGDIR=${NDK}
PLATFORM=android-${ANDROID_SDK_VERSION}
PLATFORM_ROOT=${PROGDIR}/platforms/${PLATFORM}/arch-${ARCH2}
PLATFORM_PATH=${PLATFORM_ROOT}/usr
NDK_BINS=`ls ${PROGDIR}/toolchains/*/prebuilt/${OS}*/bin |grep prebuilt | grep "/${ARCH}-" |sort |tail -n 1`
#shellcheck disable=SC2010
NDK_BINS=$(ls "${PROGDIR}"/toolchains/*/prebuilt/"${OS}"*/bin |grep prebuilt | grep "/${ARCH}-" |sort |tail -n 1)
#shellcheck disable=SC2010
[ -z "${NDK_BINS}" ] && \
NDK_BINS=`ls ${PROGDIR}/toolchains/*/prebuilt/${OS}*/bin |grep prebuilt | grep "/${ARCH}" |sort |tail -n 1`
NDK_BINS=$(ls "${PROGDIR}"/toolchains/*/prebuilt/"${OS}"*/bin |grep prebuilt | grep "/${ARCH}" |sort |tail -n 1)
#echo "ls ${PROGDIR}/toolchains/*/prebuilt/linux*/bin |grep prebuilt | grep "/${ARCH}-" |sort |tail -n 1"
#echo NDKBINS=${NDK_BINS}
if [ -z "${NDK_BINS}" ]; then
@ -101,4 +106,4 @@ EXT_SO=so
export PATH=${NDK_BINS}:$PATH
export EXT_SO AR CC CFLAGS LDFLAGS PATH
# echo ${CC} ${CFLAGS} ${LDFLAGS} $*"
${CC} ${CFLAGS} ${LDFLAGS} $*
${CC} "${CFLAGS}" "${LDFLAGS}" "$@"

View File

@ -5,18 +5,18 @@ cd /
pkgutil --files ${PKG} > /dev/null || exit 1
# delete files
FILES=`pkgutil --only-files --files ${PKG}`
FILES="$(pkgutil --only-files --files ${PKG})"
for a in ${FILES} ; do
if [ -f ${a} ]; then
if [ -f "${a}" ]; then
rm "$a"
# | xargs rm -i
fi
done
# delete empty directories
FILES=`pkgutil --only-dirs --files ${PKG}`
FILES="$(pkgutil --only-dirs --files ${PKG})"
for a in ${FILES} ; do
if [ -d ${a} ]; then
if [ -d "${a}" ]; then
rmdir "$a"
fi
done

View File

@ -7,7 +7,7 @@
# sudo pkgutil --forget org.radare.radare2
SRC=/tmp/r2osx
DST=`pwd`/sys/osx-pkg/radare2.unpkg
DST="$(pwd)/sys/osx-pkg/radare2.unpkg"
VERSION=0.9.9
rm -rf "${SRC}"
@ -19,7 +19,7 @@ make install PREFIX=/usr DESTDIR=${SRC} || exit 1
if [ -d "${SRC}" ]; then
(
cd ${SRC} && \
find . | cpio -o --format odc | gzip -c > ${DST}/Payload
find . | cpio -o --format odc | gzip -c > "${DST}/Payload"
)
mkbom ${SRC} "${DST}/Bom"