Fixed funny __uuid function

This commit is contained in:
斟酌 鵬兄 2022-08-07 22:23:15 +08:00
parent 26888c1b95
commit e85c9d9b7a

View File

@ -131,20 +131,17 @@ function __download {
} }
function __uuid { function __uuid {
local __out=$1
which uuidgen 2>&1 > /dev/null which uuidgen 2>&1 > /dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
local uuid=$( uuidgen ) uuidgen
else else
local uuid=$( cat /proc/sys/kernel/random/uuid ) head -n1 /proc/sys/kernel/random/uuid
fi fi
eval $__out="'$uuid'"
} }
function rbash_upgrade { function rbash_upgrade {
echo "Updating $__SCRIPT" echo "Updating $__SCRIPT"
__uuid TMPID TMPID=`__uuid`
TMPFILE=/tmp/$TMPID TMPFILE=/tmp/$TMPID
__download "https://git.k8s.astropenguin.net/penguin/utils/raw/branch/master/bash/bashrc/rbashrc" > $TMPFILE __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 MCC_NAME=$2
fi fi
__uuid UUID UUID=`__uuid`
__uuid PASS PASS=`__uuid`
PMC_NAME=$( echo "#_MACHINE_NAME_#" | sed -e "s/#_/</g" -e "s/_#/>/g" ) 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" ) PMCC_NAME=$( echo "#_MACHINE_COLORED_NAME_#" | sed -e "s/#_/</g" -e "s/_#/>/g" )
UUID_TOK=$( echo "#_UUID_#" | 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" echo "Getting: $1"
__cacheDownload "https://git.k8s.astropenguin.net/penguin/utils/raw/branch/master/$1" __cacheDownload "https://git.k8s.astropenguin.net/penguin/utils/raw/branch/master/$1"
shift shift
__uuid TMPID TMPID=`__uuid`
TMPFILE=/tmp/$TMPID TMPFILE=/tmp/$TMPID
__cryptd "$__CFILE" "$TMPFILE" __cryptd "$__CFILE" "$TMPFILE"
@ -205,7 +202,7 @@ function __ns {
echo " $1" echo " $1"
__cacheDownload "https://git.k8s.astropenguin.net/penguin/utils/raw/branch/master/bash/bashrc/$FPATH" __cacheDownload "https://git.k8s.astropenguin.net/penguin/utils/raw/branch/master/bash/bashrc/$FPATH"
shift shift
__uuid TMPID TMPID=`__uuid`
TMPFILE=/tmp/$TMPID TMPFILE=/tmp/$TMPID
__cryptd "$__CFILE" "$TMPFILE" __cryptd "$__CFILE" "$TMPFILE"
. $TMPFILE . $TMPFILE