penguin/utils

my env utils

commit e85c9d9b7aab1e30bfc0e01e517065d4442d59c3

author斟酌 鵬兄 <tgckpg@gmail.com>
date2022-08-07T14:23:15Z
subjectFixed funny __uuid function
commit e85c9d9b7aab1e30bfc0e01e517065d4442d59c3
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date:   2022-08-07T14:23:15Z

    Fixed funny __uuid function
---
 bash/bashrc/rbashrc | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/bash/bashrc/rbashrc b/bash/bashrc/rbashrc
index 23458c8..efd85c6 100644
--- a/bash/bashrc/rbashrc
+++ b/bash/bashrc/rbashrc
@@ -131,20 +131,17 @@ function __download {
 }
 
 function __uuid {
-    local __out=$1
-
     which uuidgen 2>&1 > /dev/null
     if [ $? -eq 0 ]; then
-        local uuid=$( uuidgen )
+        uuidgen
     else
-        local uuid=$( cat /proc/sys/kernel/random/uuid )
+        head -n1 /proc/sys/kernel/random/uuid
     fi
-    eval $__out="'$uuid'"
 }
 
 function rbash_upgrade {
     echo "Updating $__SCRIPT"
-    __uuid TMPID
+    TMPID=`__uuid`
     TMPFILE=/tmp/$TMPID
     __download "https://git.k8s.astropenguin.net/penguin/utils/raw/branch/master/bash/bashrc/rbashrc" > $TMPFILE
 
@@ -156,8 +153,8 @@ function rbash_upgrade {
         MCC_NAME=$2
     fi
 
-    __uuid UUID
-    __uuid PASS
+    UUID=`__uuid`
+    PASS=`__uuid`
     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" )
@@ -181,7 +178,7 @@ function rbash_run {
     echo "Getting: $1"
     __cacheDownload "https://git.k8s.astropenguin.net/penguin/utils/raw/branch/master/$1"
     shift
-    __uuid TMPID
+    TMPID=`__uuid`
     TMPFILE=/tmp/$TMPID
     __cryptd "$__CFILE" "$TMPFILE"
 
@@ -205,7 +202,7 @@ function __ns {
     echo "  $1"
     __cacheDownload "https://git.k8s.astropenguin.net/penguin/utils/raw/branch/master/bash/bashrc/$FPATH"
     shift
-    __uuid TMPID
+    TMPID=`__uuid`
     TMPFILE=/tmp/$TMPID
     __cryptd "$__CFILE" "$TMPFILE"
     . $TMPFILE