]> git.nbdom.net Git - nb.git/commitdiff
busybox
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 29 Nov 2016 09:32:39 +0000 (09:32 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 29 Nov 2016 09:32:39 +0000 (09:32 +0000)
etc/profile
etc/profile.d/envs
etc/profile.d/functions

index 0f66d78dc085cdcb08aaf9fc2467f0f641f67191..42e9414294ab54a387217edcaa067da1ecb35f3d 100755 (executable)
@@ -62,6 +62,7 @@ else
   #echo $NB_CURRENT_DIR; return
 
   [ -e "$NB_CURRENT_DIR/profile.d/functions" ] && . "$NB_CURRENT_DIR/profile.d/functions"
+  echo $(realpath $NB_CURRENT_DIR/..)
   export NB_ROOT=$(realpath $NB_CURRENT_DIR/.. 2>/dev/null)
   [ -n "$NB_DEBUG" ] && $NB_DEBUG "NB_ROOT=$NB_ROOT"
 
index 220c48e42fa5d447dbc37d24c7b3a7a1c7861896..77bb4e2967cc9fcbd407126bd28894aa19c1dd56 100644 (file)
@@ -70,12 +70,11 @@ case "$BASH" in
   */sh) SHELL_NAME=sh ;;
   */bash) SHELL_NAME=bash ;;
   *)
-    case "$(realpath /bin/grep)" in
-      *busybox*) SHELL_NAME="busybox" ;;
-      *)
-        [ -n "$ZSH_NAME" ] && SHELL_NAME=zsh
-      ;;
-    esac
+    if ls --help 2>&1 | grep -qm1 ^BusyBox; then
+      SHELL_NAME="busybox"
+    elif [ -n "$ZSH_NAME" ]; then
+      SHELL_NAME=zsh
+    fi
   ;;
 esac
 export SHELL_NAME
index ce826dde9e2acc8f5cf5105b7db2dd4523d38e34..317eb8daf8d655e01e9c5ffb259c1676272b2dcb 100644 (file)
@@ -160,18 +160,18 @@ env_add_path() {
   [ -z "$env_value" ] || echo "$env_value"
 }
 
+if !which realpath 2>/dev/null; then
 realpath() {
-  if [ -x /usr/bin/realpath ]; then
-    /usr/bin/realpath "$1"
-  elif which perl &> /dev/null; then
+  if which perl &> /dev/null; then
     perl -MFile::Spec -MCwd -e 'print File::Spec->rel2abs( Cwd::abs_path($ARGV[0]) )."\n" if -e $ARGV[0]' "$1"
   else
     case "$OSTYPE" in
-      darwin*) readlinks "$1" ;;
-      *) readlinks -f "$1" ;;
+      darwin*) readlink "$1" ;;
+      *) readlink -f "$1" ;;
     esac
   fi
 }
+fi
 
 ascii() {