[X2Go-Commits] [x2goclient] 52/59: macbuild.sh: add new get_nesting_level() helper function.

git-admin at x2go.org git-admin at x2go.org
Wed Jun 3 03:11:00 CEST 2015


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch bugfix/osx
in repository x2goclient.

commit 4d1e75d9113f157b2dc097ac827cc67dc46b29b8
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sun May 3 23:22:49 2015 +0200

    macbuild.sh: add new get_nesting_level() helper function.
---
 debian/changelog |    1 +
 macbuild.sh      |   14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index c17afcd..b7d96aa 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -95,6 +95,7 @@ x2goclient (4.0.4.1-0x2go1) UNRELEASED; urgency=low
     - macbuild.sh: add new MACPORTS_PREFIX detection/variable.
     - macbuild.sh: add new dependency_error() helper function.
     - macbuild.sh: add new lazy_canonical_path() helper function.
+    - macbuild.sh: add new get_nesting_level() helper function.
 
  -- X2Go Release Manager <git-admin at x2go.org>  Tue, 26 May 2015 21:42:09 +0200
 
diff --git a/macbuild.sh b/macbuild.sh
index f222df8..4d24e52 100755
--- a/macbuild.sh
+++ b/macbuild.sh
@@ -65,6 +65,20 @@ lazy_canonical_path() {
 	printf "${old_path}"
 }
 
+get_nesting_level() {
+set -x
+	typeset -i level=0
+	typeset path="${1}"
+
+	while [ -n "${path}" ] && [ "${path}" != "." ] && [ "${path}" != "/" ]; do
+		i="$((${i} + 1))"
+		path="$(dirname "${path}")"
+	done
+
+	printf "${level}"
+set +x
+}
+
 MATCH_HELP='(^((-h)|(--help))([ 	]|$))|([ 	]+((-h)|(--help))([ 	]|$))'
 [ -n "${*}" ] && [[ "${*}" =~ ${MATCH_HELP} ]] && usage
 

--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list