From 3b1e4ff40b2ca87695dc964e07c3dd5d2529a540 Mon Sep 17 00:00:00 2001 From: Ing Date: Sat, 28 Dec 2024 15:59:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=94=9F=E6=88=90=E9=9A=8F?= =?UTF-8?q?=E6=9C=BA=E6=95=B0=E5=AD=97=E7=9A=84=E5=87=BD=E6=95=B0=20genRan?= =?UTF-8?q?domDigit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- files/initrd/opt/rr/include/functions.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/files/initrd/opt/rr/include/functions.sh b/files/initrd/opt/rr/include/functions.sh index 6a8a0edc..ab1df3bb 100755 --- a/files/initrd/opt/rr/include/functions.sh +++ b/files/initrd/opt/rr/include/functions.sh @@ -76,6 +76,13 @@ function randomhex() { printf "%02X" $((RANDOM % 255 + 1)) } + +############################################################################### +# Generate a random digit (0-9A-Z) +function genRandomDigit() { + echo {0..9} | tr ' ' '\n' | sort -R | head -1 +} + ############################################################################### # Generate a random letter function genRandomLetter() { @@ -429,7 +436,6 @@ function connectwlanif() { ############################################################################### # Find and mount the DSM root filesystem -# (based on pocopico's TCRP code) function findDSMRoot() { local DSMROOTS="" [ -z "${DSMROOTS}" ] && DSMROOTS="$(mdadm --detail --scan 2>/dev/null | grep -E "name=SynologyNAS:0|name=DiskStation:0|name=SynologyNVR:0|name=BeeStation:0" | awk '{print $2}' | uniq)"