penguin/utils

my env utils

commit fdeee997a486a73a92692a933ba6186d5351cdf2

author斟酌 鵬兄 <tgckpg@gmail.com>
date2015-03-23T07:59:03Z
subjectBug fixes
commit fdeee997a486a73a92692a933ba6186d5351cdf2
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date:   2015-03-23T07:59:03Z

    Bug fixes
---
 bash/bashrc/package.sh | 20 +++++++++++---------
 bash/bashrc/rbashrc    |  9 ++++++++-
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/bash/bashrc/package.sh b/bash/bashrc/package.sh
index 36859d4..0258e2c 100644
--- a/bash/bashrc/package.sh
+++ b/bash/bashrc/package.sh
@@ -12,12 +12,14 @@ function __func_help() {
 # Run through all sources
 SDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/sources
 
-echo "Begin source:"
-for i in $( find $SDIR -maxdepth 1 -type f -perm +111 | sort )
-do
-    echo "  Source:" $( basename $i )
-    . $i
-    if [[ $? -ne 0 ]]; then
-        echo "    .. failed"
-    fi
-done
+if [ -d "$SDIR" ]; then
+    echo "Begin source:"
+    for i in $( find $SDIR -maxdepth 1 -type f -perm +111 | sort )
+    do
+        echo "  Source:" $( basename $i )
+        . $i
+        if [[ $? -ne 0 ]]; then
+            echo "    .. failed"
+        fi
+    done
+fi
diff --git a/bash/bashrc/rbashrc b/bash/bashrc/rbashrc
index df02650..e8d0da7 100644
--- a/bash/bashrc/rbashrc
+++ b/bash/bashrc/rbashrc
@@ -152,8 +152,14 @@ export EDITOR=vim
 # User specific aliases and functions
 echo "Source:"
 function __ns {
+    if [ -z "$2" ]; then
+        PATH="sources/$1"
+    else
+        PATH=$1
+    fi
+
     echo "  $1"
-    __cacheDownload "http://git.astropenguin.net/?p=utils.git;a=blob_plain;f=bash/bashrc/sources/$1;hb=HEAD"
+    __cacheDownload "http://git.astropenguin.net/?p=utils.git;a=blob_plain;f=bash/bashrc/$PATH;hb=HEAD"
     shift
     TMPFILE=/tmp/$( cat /proc/sys/kernel/random/uuid )
     __cryptd "$__CFILE" "$TMPFILE"
@@ -161,6 +167,7 @@ function __ns {
     rm $TMPFILE
 }
 
+__ns "package.sh" 1
 __ns "10_aliases"
 __ns "20_fast-greps"
 __ns "30_mysql"