#!/bin/sh
-srcdir=`dirname $0`
+srcdir=$(dirname "$0")
test -z "$srcdir" && srcdir=.
-ORIGDIR=`pwd`
-cd "$srcdir"
+ORIGDIR=$(pwd)
+cd "$srcdir" || exit 1
PROJECT=Transmission
GETTEXTIZE="glib-gettextize"
$GETTEXTIZE --version < /dev/null > /dev/null 2>&1
if test $? -ne 0; then
- GETTEXTIZE=""
+ GETTEXTIZE=""
fi
LIBTOOLIZE=libtoolize
-if libtoolize --help >/dev/null 2>&1
-then
+if libtoolize --help > /dev/null 2>&1; then
:
-elif glibtoolize --help >/dev/null 2>&1
-then
+elif glibtoolize --help > /dev/null 2>&1; then
LIBTOOLIZE=glibtoolize
fi
export LIBTOOLIZE
./update-version-h.sh
-autoreconf -fi || exit 1;
-
+autoreconf -fi || exit 1
if test "$GETTEXTIZE"; then
echo "Creating aclocal.m4 ..."
cd "$ORIGDIR" || exit $?
if test -z "$AUTOGEN_SUBDIR_MODE"; then
- echo Running $srcdir/configure "$@"
- $srcdir/configure "$@"
+ echo Running $srcdir/configure "$@"
+ $srcdir/configure "$@"
- echo
- echo "Now type 'make' to compile $PROJECT."
+ echo
+ echo "Now type 'make' to compile $PROJECT."
fi
-
# Generate files to be included: only overwrite them if changed so make
# won't rebuild everything unless necessary
-replace_if_differs ()
-{
- if cmp $1 $2 > /dev/null 2>&1; then
- rm -f $1
- else
- mv -f $1 $2
- fi
+replace_if_differs() {
+ if cmp "$1" "$2" > /dev/null 2>&1; then
+ rm -f "$1"
+ else
+ mv -f "$1" "$2"
+ fi
}
echo "creating libtransmission/version.h"
-user_agent_prefix=`grep m4_define configure.ac | sed "s/[][)(]/,/g" | grep user_agent_prefix | cut -d , -f 6`
+user_agent_prefix=$(grep m4_define configure.ac | sed "s/[][)(]/,/g" | grep user_agent_prefix | cut -d , -f 6)
-peer_id_prefix=`grep m4_define configure.ac | sed "s/[][)(]/,/g" | grep peer_id_prefix | cut -d , -f 6`
+peer_id_prefix=$(grep m4_define configure.ac | sed "s/[][)(]/,/g" | grep peer_id_prefix | cut -d , -f 6)
-major_version=`echo ${user_agent_prefix} | awk -F . '{print $1}'`
-minor_version=`echo ${user_agent_prefix} | awk -F . '{print $2 + 0}'`
+major_version=$(echo "${user_agent_prefix}" | awk -F . '{print $1}')
+minor_version=$(echo "${user_agent_prefix}" | awk -F . '{print $2 + 0}')
vcs_revision=
vcs_revision_file=REVISION
-if [ -n "$JENKINS_URL" -a -n "$GIT_COMMIT" ]; then
- vcs_revision=$GIT_COMMIT
-elif [ -n "$TEAMCITY_PROJECT_NAME" -a -n "$BUILD_VCS_NUMBER" ]; then
- vcs_revision=$BUILD_VCS_NUMBER
-elif [ -d ".git" ] && type git >/dev/null 2>&1; then
- vcs_revision=`git rev-list --max-count=1 HEAD`
+if [ -n "$JENKINS_URL" ] && [ -n "$GIT_COMMIT" ]; then
+ vcs_revision=$GIT_COMMIT
+elif [ -n "$TEAMCITY_PROJECT_NAME" ] && [ -n "$BUILD_VCS_NUMBER" ]; then
+ vcs_revision=$BUILD_VCS_NUMBER
+elif [ -d ".git" ] && type git > /dev/null 2>&1; then
+ vcs_revision=$(git rev-list --max-count=1 HEAD)
elif [ -f "$vcs_revision_file" ]; then
- vcs_revision=`cat "$vcs_revision_file"`
+ vcs_revision=$(cat "$vcs_revision_file")
fi
-vcs_revision=`echo $vcs_revision`
-
if [ -n "$vcs_revision" ]; then
- [ -f "$vcs_revision_file" ] && [ "`cat "$vcs_revision_file"`" = "$vcs_revision" ] || echo "$vcs_revision" > "$vcs_revision_file"
+ [ -f "$vcs_revision_file" ] && [ "$(cat "$vcs_revision_file")" = "$vcs_revision" ] || echo "$vcs_revision" > "$vcs_revision_file"
else
- vcs_revision=0
- rm -f "$vcs_revision_file"
+ vcs_revision=0
+ rm -f "$vcs_revision_file"
fi
-vcs_revision=`echo $vcs_revision | head -c10`
+vcs_revision=$(echo $vcs_revision | head -c10)
cat > libtransmission/version.h.new << EOF
#pragma once
# Add a release definition
case "${peer_id_prefix}" in
- *X-) echo '#define TR_BETA_RELEASE 1' ;;
- *Z-) echo '#define TR_NIGHTLY_RELEASE 1' ;;
- *) echo '#define TR_STABLE_RELEASE 1' ;;
+ *X-) echo '#define TR_BETA_RELEASE 1' ;;
+ *Z-) echo '#define TR_NIGHTLY_RELEASE 1' ;;
+ *) echo '#define TR_STABLE_RELEASE 1' ;;
esac >> "libtransmission/version.h.new"
replace_if_differs libtransmission/version.h.new libtransmission/version.h