[LEDE-DEV] [PATCH] build: do not fail if subversion is not installed

Hauke Mehrtens hauke at hauke-m.de
Sun Jul 31 07:55:51 PDT 2016


check if svn is installed in ipkg-build before assigning it. This
script is run with set -e and will fail if "which svn" does not return
0.

Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 scripts/ipkg-build | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/scripts/ipkg-build b/scripts/ipkg-build
index e026c7a..7e87fee 100755
--- a/scripts/ipkg-build
+++ b/scripts/ipkg-build
@@ -13,14 +13,18 @@ version=1.0
 FIND="$(which find)"
 FIND="${FIND:-$(which gfind)}"
 TAR="${TAR:-$(which tar)}"
-SVN="$(which svn)"
-GIT="$(which git)"
+if [ $(which svn) ]; then
+	SVN="$(which svn)"
+fi
+if [ $(which git) ]; then
+	GIT="$(which git)"
+fi
 GZIP="$(which gzip)"
 
 # look up date of last commit
-if [ -d "$TOPDIR/.git" ]; then
+if [ -n $GIT ] && [ -d "$TOPDIR/.git" ]; then
 	TIMESTAMP=$(cd $TOPDIR; $GIT log -1 -s --format=%ci)
-elif [ -d "$TOPDIR/.svn" ]; then
+elif [ -n $SVN ] && [ -d "$TOPDIR/.svn" ]; then
 	TIMESTAMP=$($SVN info "$TOPDIR" | sed -n "s/^Last Changed Date: \(.*\)/\1/p")
 else
 	TIMESTAMP=$(date)
-- 
2.8.1




More information about the Lede-dev mailing list