diff --git a/src/install.sh b/src/install.sh index ac96d5b..cd8bb53 100644 --- a/src/install.sh +++ b/src/install.sh @@ -254,7 +254,7 @@ if ! touch "$SYSTEM"; then error "Could not create file $SYSTEM for the system disk." && exit 98 fi -! setOwner "$SYSTEM" && warn "failed to set the owner for \"$SYSTEM\" !" +setOwner "$SYSTEM" || warn "failed to set the owner for \"$SYSTEM\" !" if [[ "${FS,,}" == "btrfs" ]]; then { chattr +C "$SYSTEM"; } || : @@ -329,7 +329,7 @@ fakeroot -- bash -c "set -Eeu;\ rm -rf "$MOUNT" echo "$BASE" > "$STORAGE/dsm.ver" -! setOwner "$STORAGE/dsm.ver" && warn "failed to set the owner for \"$STORAGE/dsm.ver\" !" +setOwner "$STORAGE/dsm.ver" || warn "failed to set the owner for \"$STORAGE/dsm.ver\" !" if [[ "$URL" == "file://$STORAGE/$BASE.pat" ]]; then rm -f "$PAT" @@ -338,11 +338,11 @@ else fi if [ -f "$STORAGE/$BASE.pat" ]; then - ! setOwner "$STORAGE/$BASE.pat" && warn "failed to set the owner for \"$STORAGE/$BASE.pat\" !" + setOwner "$STORAGE/$BASE.pat" || warn "failed to set the owner for \"$STORAGE/$BASE.pat\" !" fi mv -f "$BOOT" "$STORAGE/$BASE.boot.img" -! setOwner "$STORAGE/$BASE.boot.img" && warn "failed to set the owner for \"$STORAGE/$BASE.boot.img\" !" +setOwner "$STORAGE/$BASE.boot.img" || warn "failed to set the owner for \"$STORAGE/$BASE.boot.img\" !" rm -rf "$TMP" diff --git a/src/power.sh b/src/power.sh index 25b17fb..c700bc0 100644 --- a/src/power.sh +++ b/src/power.sh @@ -108,8 +108,8 @@ forceKillQemu() { local reason="$1" local pid display - ! readQemuPid pid && return 0 - ! isAlive "$pid" && return 0 + readQemuPid pid || return 0 + isAlive "$pid" || return 0 display=$(displayReason "$reason") error "Forcefully terminating $(app), reason: $display..." @@ -305,7 +305,7 @@ waitForShutdown() { local slp=$! # Stop waiting if the process has exited - ! isAlive "$pid" && break + isAlive "$pid" || break # Workaround for stale/zombie QEMU pid file [ ! -s "$QEMU_START_PID" ] && [ ! -s "$QEMU_PID" ] && break @@ -372,7 +372,7 @@ graceful_shutdown() { finish "$code" } -! enabled "$SHUTDOWN" && return 0 +enabled "$SHUTDOWN" || return 0 [ -n "${QEMU_TIMEOUT:-}" ] && TIMEOUT="$QEMU_TIMEOUT" if interactive; then diff --git a/src/proc.sh b/src/proc.sh index dd5a1c3..555ee76 100644 --- a/src/proc.sh +++ b/src/proc.sh @@ -47,7 +47,7 @@ checkSse42() { if ! hasFlag "sse4_2"; then error "Your CPU does not have the SSE4 instruction set that Virtual DSM requires!" - ! enabled "$DEBUG" && exit 88 + enabled "$DEBUG" || exit 88 fi return 0 diff --git a/src/reset.sh b/src/reset.sh index 3769d0b..4edca77 100644 --- a/src/reset.sh +++ b/src/reset.sh @@ -209,7 +209,7 @@ normalizeRamSize() { fi RAM_SIZE=$(echo "${RAM_SIZE^^}" | sed 's/MB/M/g;s/GB/G/g;s/TB/T/g') - ! numfmt --from=iec "$RAM_SIZE" &>/dev/null && error "Invalid RAM_SIZE: $RAM_SIZE" && exit 16 + numfmt --from=iec "$RAM_SIZE" &>/dev/null || { error "Invalid RAM_SIZE: $RAM_SIZE" && exit 16; } wanted=$(numfmt --from=iec "$RAM_SIZE") [ "$wanted" -lt "$RAM_MINIMUM" ] && error "RAM_SIZE is too low: $RAM_SIZE" && exit 16 @@ -254,7 +254,7 @@ checkKvm() { fi if ! grep -qw "sse4_2" <<< "$flags"; then error "Your CPU does not have the SSE4 instruction set that Virtual DSM requires!" - ! enabled "$DEBUG" && exit 88 + enabled "$DEBUG" || exit 88 fi fi fi @@ -275,7 +275,7 @@ checkKvm() { error "KVM acceleration is not available $KVM_ERR, this will cause the machine to run about 10 times slower." error "See the FAQ for possible causes, or disable acceleration by adding the \"KVM=N\" variable (not recommended)." ;; esac - ! enabled "$DEBUG" && exit 88 + enabled "$DEBUG" || exit 88 fi fi diff --git a/src/utils.sh b/src/utils.sh index eadf61c..3b2723d 100644 --- a/src/utils.sh +++ b/src/utils.sh @@ -155,7 +155,7 @@ waitPidFile() { local timeout="${2:-10}" local deadline=$((SECONDS + timeout)) - ! readPidFile pid "$file" && return 0 + readPidFile pid "$file" || return 0 while [ -s "$file" ] && isAlive "$pid"; do (( SECONDS >= deadline )) && return 1 @@ -218,7 +218,7 @@ sKill() { local pid local file="$1" - ! readPidFile pid "$file" && return 0 + readPidFile pid "$file" || return 0 if isAlive "$pid"; then { kill -15 -- "$pid" || :; } 2>/dev/null @@ -256,7 +256,7 @@ setOwner() { uid=$(stat -c '%u' "$dir") || return 1 gid=$(stat -c '%g' "$dir") || return 1 - ! chown "$uid:$gid" "$file" && return 1 + chown "$uid:$gid" "$file" || return 1 return 0 } @@ -267,7 +267,7 @@ makeDir() { local dir uid gid [ -d "$path" ] && return 0 - ! mkdir -p "$path" && return 1 + mkdir -p "$path" || return 1 dir=$(dirname -- "$path")