feat: Remove non-printable characters (#228)

This commit is contained in:
Kroese 2025-03-24 14:01:17 +01:00 committed by GitHub
parent cdf3e9df63
commit 453ec734ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 2 deletions

View file

@ -10,7 +10,7 @@ RUN apk --update --no-cache add unzip && \
rm -rf /tmp/* /var/tmp/* /var/cache/apk/*
FROM scratch AS runner
COPY --from=qemux/qemu:7.04 / /
COPY --from=qemux/qemu:7.05 / /
ARG VERSION_ARG="0.0"
ARG VERSION_KVM_OPENCORE="v21"

View file

@ -168,13 +168,14 @@ else
fi
CLOCKSOURCE="tsc"
[[ "${ARCH,,}" == "arm64" ]] && CLOCKSOURCE="arch_sys_counter"
[[ "${ARCH,,}" == "arm64" ]] && CLOCKSOURCE="arch_sys_counter"
CLOCK="/sys/devices/system/clocksource/clocksource0/current_clocksource"
if [ ! -f "$CLOCK" ]; then
warn "file \"$CLOCK\" cannot not found?"
else
result=$(<"$CLOCK")
result="${result//[![:print:]]/}"
case "${result,,}" in
"${CLOCKSOURCE,,}" ) ;;
"kvm-clock" )

View file

@ -154,10 +154,12 @@ generateID() {
[ -n "$UUID" ] && return 0
[ -s "$file" ] && UUID=$(<"$file")
UUID="${UUID//[![:print:]]/}"
[ -n "$UUID" ] && return 0
UUID=$(cat /proc/sys/kernel/random/uuid 2> /dev/null || uuidgen --random)
UUID="${UUID^^}"
UUID="${UUID//[![:print:]]/}"
echo "$UUID" > "$file"
return 0
@ -169,6 +171,7 @@ generateAddress() {
[ -n "$MAC" ] && return 0
[ -s "$file" ] && MAC=$(<"$file")
MAC="${MAC//[![:print:]]/}"
[ -n "$MAC" ] && return 0
# Generate Apple MAC address based on Docker container ID in hostname
@ -187,6 +190,8 @@ generateSerial() {
[ -n "$SN" ] && [ -n "$MLB" ] && return 0
[ -s "$file" ] && SN=$(<"$file")
[ -s "$file2" ] && MLB=$(<"$file2")
SN="${SN//[![:print:]]/}"
MLB="${MLB//[![:print:]]/}"
[ -n "$SN" ] && [ -n "$MLB" ] && return 0
# Generate unique serial numbers for machine
@ -213,6 +218,7 @@ fi
STORED_VERSION=""
if [ -f "$BASE_VERSION" ]; then
STORED_VERSION=$(<"$BASE_VERSION")
STORED_VERSION="${STORED_VERSION//[![:print:]]/}"
fi
if [ "$VERSION" != "$STORED_VERSION" ]; then