mirror of
https://github.com/dockur/windows.git
synced 2026-07-07 05:07:26 +01:00
feat: Normalize boolean option handling (#1784)
This commit is contained in:
+14
-14
@@ -110,7 +110,7 @@ skipInstall() {
|
||||
# Check if the ISO was already processed by our script
|
||||
magic=$(dd if="$iso" bs=1 count=1 status=none | tr -d '\000')
|
||||
magic="$(printf '%s' "$magic" | od -A n -t x1 -v | tr -d ' \n')"
|
||||
byte="16" && [[ "$MANUAL" == [Yy1]* ]] && byte="17"
|
||||
byte="16" && enabled "$MANUAL" && byte="17"
|
||||
|
||||
if [[ "$magic" != "$byte" ]]; then
|
||||
|
||||
@@ -215,7 +215,7 @@ finishInstall() {
|
||||
|
||||
if [[ "$aborted" != [Yy1]* ]]; then
|
||||
# Mark ISO as prepared via magic byte
|
||||
byte="16" && [[ "$MANUAL" == [Yy1]* ]] && byte="17"
|
||||
byte="16" && enabled "$MANUAL" && byte="17"
|
||||
if ! printf '%b' "\x$byte" | dd of="$iso" bs=1 seek=0 count=1 conv=notrunc status=none; then
|
||||
warn "failed to set magic byte in ISO file: $iso"
|
||||
fi
|
||||
@@ -243,7 +243,7 @@ finishInstall() {
|
||||
fi
|
||||
else
|
||||
# Enable secure boot + TPM on manual installs as Win11 requires
|
||||
if [[ "$MANUAL" == [Yy1]* || "$aborted" == [Yy1]* ]]; then
|
||||
if enabled "$MANUAL" || [[ "$aborted" == [Yy1]* ]]; then
|
||||
if [[ "${DETECTED,,}" == "win11"* ]]; then
|
||||
BOOT_MODE="windows_secure"
|
||||
file="$STORAGE/windows.mode"
|
||||
@@ -296,7 +296,7 @@ abortInstall() {
|
||||
local efi
|
||||
|
||||
[[ "${iso,,}" == *".esd" ]] && exit 60
|
||||
[[ "${UNPACK:-}" == [Yy1]* ]] && exit 60
|
||||
enabled "${UNPACK:-}" && exit 60
|
||||
|
||||
efi=$(find "$dir" -maxdepth 1 -type d -iname efi -print -quit)
|
||||
|
||||
@@ -556,7 +556,7 @@ extractImage() {
|
||||
|
||||
fKill "progress.sh"
|
||||
|
||||
if [[ "${UNPACK:-}" != [Yy1]* ]]; then
|
||||
if ! enabled "${UNPACK:-}"; then
|
||||
|
||||
LABEL=$(isoinfo -d -i "$iso" | sed -n 's/Volume id: //p')
|
||||
|
||||
@@ -739,7 +739,7 @@ detectImage() {
|
||||
|
||||
skipVersion "${DETECTED,,}" && return 0
|
||||
|
||||
if ! setXML "" && [[ "$MANUAL" != [Yy1]* ]]; then
|
||||
if ! setXML "" && ! enabled "$MANUAL"; then
|
||||
MANUAL="Y"
|
||||
desc=$(printEdition "$DETECTED" "this version")
|
||||
warn "the answer file for $desc was not found ($DETECTED.xml), $FB."
|
||||
@@ -776,7 +776,7 @@ detectImage() {
|
||||
|
||||
if [ -z "$DETECTED" ]; then
|
||||
msg="Failed to determine Windows version from image"
|
||||
if setXML "" || [[ "$MANUAL" == [Yy1]* ]]; then
|
||||
if setXML "" || enabled "$MANUAL"; then
|
||||
info "${msg}!"
|
||||
else
|
||||
MANUAL="Y"
|
||||
@@ -803,8 +803,8 @@ detectImage() {
|
||||
msg="the answer file for $desc was not found ($DETECTED.xml)"
|
||||
local fallback="/run/assets/${DETECTED%%-*}.xml"
|
||||
|
||||
if setXML "$fallback" || [[ "$MANUAL" == [Yy1]* ]]; then
|
||||
[[ "$MANUAL" != [Yy1]* ]] && warn "${msg}."
|
||||
if setXML "$fallback" || enabled "$MANUAL"; then
|
||||
! enabled "$MANUAL" && warn "${msg}."
|
||||
else
|
||||
MANUAL="Y"
|
||||
warn "${msg}, $FB."
|
||||
@@ -1047,7 +1047,7 @@ updateImage() {
|
||||
|
||||
if [ ! -s "$asset" ] || [ ! -f "$asset" ]; then
|
||||
asset=""
|
||||
if [[ "$MANUAL" != [Yy1]* ]]; then
|
||||
if ! enabled "$MANUAL"; then
|
||||
MANUAL="Y"
|
||||
warn "no answer file provided, $FB."
|
||||
fi
|
||||
@@ -1093,7 +1093,7 @@ updateImage() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$MANUAL" != [Yy1]* ]]; then
|
||||
if ! enabled "$MANUAL"; then
|
||||
|
||||
xml=$(basename "$asset")
|
||||
info "Adding $xml for automatic installation..."
|
||||
@@ -1111,7 +1111,7 @@ updateImage() {
|
||||
|
||||
fi
|
||||
|
||||
if [[ "$MANUAL" == [Yy1]* ]]; then
|
||||
if enabled "$MANUAL"; then
|
||||
|
||||
wimlib-imagex update "$wim" "$index" --command "delete --force /$file" > /dev/null || true
|
||||
|
||||
@@ -1124,11 +1124,11 @@ updateImage() {
|
||||
fi
|
||||
|
||||
local find="$file"
|
||||
[[ "$MANUAL" == [Yy1]* ]] && find="$org"
|
||||
enabled "$MANUAL" && find="$org"
|
||||
path=$(find "$dir" -maxdepth 1 -type f -iname "$find" -print -quit)
|
||||
|
||||
if [ -f "$path" ]; then
|
||||
if [[ "$MANUAL" != [Yy1]* ]]; then
|
||||
if ! enabled "$MANUAL"; then
|
||||
mv -f "$path" "${path%.*}.org"
|
||||
else
|
||||
mv -f "$path" "${path%.*}.xml"
|
||||
|
||||
Reference in New Issue
Block a user