Skip to content

Commit

Permalink
third_party: Reformat shell scripts
Browse files Browse the repository at this point in the history
shfmt -w -p -i 0 -fn third_party/update.sh
shfmt -w -p -i 0 -fn third_party/waf/update.sh

Signed-off-by: Andreas Schneider <[email protected]>
Reviewed-by: Pavel Filipenský <[email protected]>

Autobuild-User(master): Pavel Filipensky <[email protected]>
Autobuild-Date(master): Wed Aug 10 14:14:04 UTC 2022 on sn-devel-184
  • Loading branch information
cryptomilk authored and Pavel Filipensky committed Aug 10, 2022
1 parent bb2e062 commit 042141e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
4 changes: 2 additions & 2 deletions third_party/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# our source tree for users that don't have them installed on their system

# Third party directory
THIRD_PARTY_DIR="`dirname $0`"
THIRD_PARTY_DIR="$(dirname $0)"
# Library directory where projects live that haven't been migrated to
# $THIRD_PARTY_DIR yet.
WORKDIR="`mktemp -d`"
WORKDIR="$(mktemp -d)"

echo "Updating zlib..."
git clone git://git.samba.org/third_party/zlib "$WORKDIR/zlib"
Expand Down
39 changes: 20 additions & 19 deletions third_party/waf/update.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash

if [[ $# -lt 1 ]]; then
echo "Usage: update.sh VERSION"
exit 1
echo "Usage: update.sh VERSION"
exit 1
fi

WAF_VERSION="${1}"
Expand All @@ -16,19 +16,21 @@ echo "GIT URL: ${WAF_GIT}"
echo "WAF SAMBA DIR: ${WAF_SAMBA_DIR}"
echo "WAF TMP DIR: ${WAF_TMPDIR}"

cleanup_tmpdir() {
popd 2>/dev/null || true
rm -rf "$WAF_TMPDIR"
cleanup_tmpdir()
{
popd 2>/dev/null || true
rm -rf "$WAF_TMPDIR"
}
trap cleanup_tmpdir SIGINT

cleanup_and_exit() {
cleanup_tmpdir
if test "$1" = 0 -o -z "$1" ; then
exit 0
else
exit "$1"
fi
cleanup_and_exit()
{
cleanup_tmpdir
if test "$1" = 0 -o -z "$1"; then
exit 0
else
exit "$1"
fi
}

# Checkout the git tree
Expand All @@ -38,17 +40,16 @@ pushd "${WAF_TMPDIR}" || cleanup_and_exit 1
git clone "${WAF_GIT}"
ret=$?
if [ $ret -ne 0 ]; then
echo "ERROR: Failed to clone repository"
cleanup_and_exit 1
echo "ERROR: Failed to clone repository"
cleanup_and_exit 1
fi


pushd waf || cleanup_and_exit 1
git checkout -b "waf-${WAF_VERSION}" "waf-${WAF_VERSION}"
ret=$?
if [ $ret -ne 0 ]; then
echo "ERROR: Failed to checkout waf-${WAF_VERSION} repository"
cleanup_and_exit 1
echo "ERROR: Failed to checkout waf-${WAF_VERSION} repository"
cleanup_and_exit 1
fi
popd || cleanup_and_exit 1

Expand All @@ -62,8 +63,8 @@ rm -rf waflib/
rsync -av "${WAF_TMPDIR}/waf/waflib" .
ret=$?
if [ $ret -ne 0 ]; then
echo "ERROR: Failed copy waflib"
cleanup_and_exit 1
echo "ERROR: Failed copy waflib"
cleanup_and_exit 1
fi
chmod -x waflib/Context.py

Expand Down

0 comments on commit 042141e

Please sign in to comment.