Skip to content

Commit 453ec73

Browse files
authored
feat: Remove non-printable characters (#228)
1 parent cdf3e9d commit 453ec73

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ RUN apk --update --no-cache add unzip && \
1010
rm -rf /tmp/* /var/tmp/* /var/cache/apk/*
1111

1212
FROM scratch AS runner
13-
COPY --from=qemux/qemu:7.04 / /
13+
COPY --from=qemux/qemu:7.05 / /
1414

1515
ARG VERSION_ARG="0.0"
1616
ARG VERSION_KVM_OPENCORE="v21"

src/boot.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,14 @@ else
168168
fi
169169

170170
CLOCKSOURCE="tsc"
171-
[[ "${ARCH,,}" == "arm64" ]] && CLOCKSOURCE="arch_sys_counter"
171+
[[ "${ARCH,,}" == "arm64" ]] && CLOCKSOURCE="arch_sys_counter"
172172
CLOCK="/sys/devices/system/clocksource/clocksource0/current_clocksource"
173173

174174
if [ ! -f "$CLOCK" ]; then
175175
warn "file \"$CLOCK\" cannot not found?"
176176
else
177177
result=$(<"$CLOCK")
178+
result="${result//[![:print:]]/}"
178179
case "${result,,}" in
179180
"${CLOCKSOURCE,,}" ) ;;
180181
"kvm-clock" )

src/install.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,12 @@ generateID() {
154154

155155
[ -n "$UUID" ] && return 0
156156
[ -s "$file" ] && UUID=$(<"$file")
157+
UUID="${UUID//[![:print:]]/}"
157158
[ -n "$UUID" ] && return 0
158159

159160
UUID=$(cat /proc/sys/kernel/random/uuid 2> /dev/null || uuidgen --random)
160161
UUID="${UUID^^}"
162+
UUID="${UUID//[![:print:]]/}"
161163
echo "$UUID" > "$file"
162164

163165
return 0
@@ -169,6 +171,7 @@ generateAddress() {
169171

170172
[ -n "$MAC" ] && return 0
171173
[ -s "$file" ] && MAC=$(<"$file")
174+
MAC="${MAC//[![:print:]]/}"
172175
[ -n "$MAC" ] && return 0
173176

174177
# Generate Apple MAC address based on Docker container ID in hostname
@@ -187,6 +190,8 @@ generateSerial() {
187190
[ -n "$SN" ] && [ -n "$MLB" ] && return 0
188191
[ -s "$file" ] && SN=$(<"$file")
189192
[ -s "$file2" ] && MLB=$(<"$file2")
193+
SN="${SN//[![:print:]]/}"
194+
MLB="${MLB//[![:print:]]/}"
190195
[ -n "$SN" ] && [ -n "$MLB" ] && return 0
191196

192197
# Generate unique serial numbers for machine
@@ -213,6 +218,7 @@ fi
213218
STORED_VERSION=""
214219
if [ -f "$BASE_VERSION" ]; then
215220
STORED_VERSION=$(<"$BASE_VERSION")
221+
STORED_VERSION="${STORED_VERSION//[![:print:]]/}"
216222
fi
217223

218224
if [ "$VERSION" != "$STORED_VERSION" ]; then

0 commit comments

Comments
 (0)