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 {
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