mirror of
https://github.com/AuxXxilium/arc.git
synced 2024-11-24 00:19:52 +07:00
functions: fix random serial
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
0331738af9
commit
7bd80d8e47
@ -72,17 +72,17 @@ function genRandomValue() {
|
||||
# 1 - Model
|
||||
# Returns serial number
|
||||
function generateSerial() {
|
||||
PREFIX="$(readConfigArray "${1}.prefix" "${S_FILE}" | sort -R | tail -1)"
|
||||
MIDDLE="$(readConfigArray "${1}.middle" "${S_FILE}" | sort -R | tail -1)"
|
||||
SUFFIX="$(readConfigKey "${1}.suffix" "${S_FILE}")"
|
||||
PREFIX="$(readConfigArray "${1}.prefix" "${S_FILE}" 2>/dev/null | sort -R | tail -1)"
|
||||
MIDDLE="$(readConfigArray "${1}.middle" "${S_FILE}" 2>/dev/null | sort -R | tail -1)"
|
||||
SUFFIX="$(readConfigKey "${1}.suffix" "${S_FILE}" 2>/dev/null)"
|
||||
|
||||
SERIAL="${PREFIX:-"0000"}${MIDDLE:-"XXX"}"
|
||||
case "${SUFFIX}" in
|
||||
case "${SUFFIX:-"alpha"}" in
|
||||
numeric)
|
||||
SUFFIX="$(random)"
|
||||
SERIAL+="$(random)"
|
||||
;;
|
||||
alpha)
|
||||
SUFFIX="$(genRandomLetter)$(genRandomValue)$(genRandomValue)$(genRandomValue)$(genRandomValue)$(genRandomLetter)"
|
||||
SERIAL+="$(genRandomLetter)$(genRandomValue)$(genRandomValue)$(genRandomValue)$(genRandomValue)$(genRandomLetter)"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user