From e85c9d9b7aab1e30bfc0e01e517065d4442d59c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Sun, 7 Aug 2022 22:23:15 +0800 Subject: [PATCH] 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" ) PMCC_NAME=$( echo "#_MACHINE_COLORED_NAME_#" | sed -e "s/#_//g" ) UUID_TOK=$( echo "#_UUID_#" | sed -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