commit 1389f0027d09785017e993f4dc61c6b25c2cca1c
| author | 斟酌 鵬兄 <tgckpg@gmail.com> |
| date | 2016-02-21T11:57:15Z |
| subject | uuid fix |
commit 1389f0027d09785017e993f4dc61c6b25c2cca1c
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date: 2016-02-21T11:57:15Z
uuid fix
---
bash/bashrc/rbashrc | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/bash/bashrc/rbashrc b/bash/bashrc/rbashrc
index 4341391..118b092 100644
--- a/bash/bashrc/rbashrc
+++ b/bash/bashrc/rbashrc
@@ -111,17 +111,21 @@ function __cacheDownload {
}
function __uuid {
- which -s uuidgen
+ local __out=$1
+
+ which uuidgen 2&>1 > /dev/null
if [ $? -eq 0 ]; then
- uuidgen
+ local uuid=$( uuidgen )
else
- cat /proc/sys/kernel/random/uuid
+ local uuid=$( cat /proc/sys/kernel/random/uuid )
fi
+ eval $__out="'$uuid'"
}
function rbash_upgrade {
echo "Updating the .bashrc"
- TMPFILE=/tmp/$( __uuid )
+ __uuid TEMP_UUID
+ TMPFILE=/tmp/$TEMP_UUID
curl -s "http://git.astropenguin.net/?p=utils.git;a=blob_plain;f=bash/bashrc/rbashrc;hb=HEAD" > $TMPFILE
if [ -z "$1" ]; then
@@ -132,8 +136,8 @@ function rbash_upgrade {
MCC_NAME=$2
fi
- UUID=$( __uuid )
- PASS=$( __uuid )
+ __uuid UUID
+ __uuid PASS
PMC_NAME=$( echo "#_MACHINE_NAME_#" | sed -e "s/#_/</g" -e "s/_#/>/g" )
PMCC_NAME=$( echo "#_MACHINE_COLORED_NAME_#" | sed -e "s/#_/</g" -e "s/_#/>/g" )
UUID_TOK=$( echo "#_UUID_#" | sed -e "s/#_/</g" -e "s/_#/>/g" )