Unverified Commit a31b832d authored by Kroese's avatar Kroese Committed by GitHub
Browse files

revert: Simplify conditional checks (#836)

This reverts commit 285e889f.
parent 285e889f
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -67,13 +67,13 @@ case "${BOOT_MODE,,}" in
    OVMF="/usr/share/OVMF"
    DEST="$STORAGE/${BOOT_MODE,,}"

    if [ ! -s "$DEST.rom" || ! -f "$DEST.rom" ]; then
      [ ! -s "$OVMF/$ROM" || ! -f "$OVMF/$ROM" ] && error "UEFI boot file ($OVMF/$ROM) not found!" && exit 44
    if [ ! -s "$DEST.rom" ] || [ ! -f "$DEST.rom" ]; then
      [ ! -s "$OVMF/$ROM" ] || [ ! -f "$OVMF/$ROM" ] && error "UEFI boot file ($OVMF/$ROM) not found!" && exit 44
      cp "$OVMF/$ROM" "$DEST.rom"
    fi

    if [ ! -s "$DEST.vars" || ! -f "$DEST.vars" ]; then
      [ ! -s "$OVMF/$VARS" || ! -f "$OVMF/$VARS" ]&& error "UEFI vars file ($OVMF/$VARS) not found!" && exit 45
    if [ ! -s "$DEST.vars" ] || [ ! -f "$DEST.vars" ]; then
      [ ! -s "$OVMF/$VARS" ] || [ ! -f "$OVMF/$VARS" ]&& error "UEFI vars file ($OVMF/$VARS) not found!" && exit 45
      cp "$OVMF/$VARS" "$DEST.vars"
    fi

@@ -117,7 +117,7 @@ fi
SM_BIOS=""
PS="/sys/class/dmi/id/product_serial"

if [ -s "$PS" && -r "$PS" ]; then
if [ -s "$PS" ] && [ -r "$PS" ]; then

  BIOS_SERIAL=$(<"$PS")
  BIOS_SERIAL="${BIOS_SERIAL//[![:alnum:]]/}"
+2 −2
Original line number Diff line number Diff line
@@ -206,12 +206,12 @@ getURL() {
    "url" )

      if [[ "${PLATFORM,,}" != "arm64" ]]; then
        if [ -n "$name" && -z "$url" ]; then
        if [ -n "$name" ] && [ -z "$url" ]; then
          error "No image for $name available!"
          return 1
        fi
      else
        if [ -n "$name" && -z "$arm" ]; then
        if [ -n "$name" ] && [ -z "$arm" ]; then
          error "No image for $name is available for ARM64 yet! "
          return 1
        fi
+19 −19
Original line number Diff line number Diff line
@@ -602,7 +602,7 @@ case "${MEDIA_TYPE,,}" in
  * ) error "Invalid MEDIA_TYPE specified, value \"$MEDIA_TYPE\" is not recognized!" && exit 80 ;;
esac

if [ -f "$BOOT" && -s "$BOOT" ]; then
if [ -f "$BOOT" ] && [ -s "$BOOT" ]; then
  case "${BOOT,,}" in
    *".iso" )
        if [[ "${HYBRID:-}" == [Yy]* ]]; then
@@ -620,16 +620,16 @@ if [ -f "$BOOT" && -s "$BOOT" ]; then
fi

DRIVERS="/drivers.iso"
[ ! -f "$DRIVERS" || ! -s "$DRIVERS" ] && DRIVERS="$STORAGE/drivers.iso"
[ ! -f "$DRIVERS" ] || [ ! -s "$DRIVERS" ] && DRIVERS="$STORAGE/drivers.iso"

if [ -f "$DRIVERS" && -s "$DRIVERS" ]; then
if [ -f "$DRIVERS" ] && [ -s "$DRIVERS" ]; then
  DISK_OPTS+=$(addMedia "$DRIVERS" "$FALLBACK" "" "0x6")
fi

RESCUE="/start.iso"
[ ! -f "$RESCUE" || ! -s "$RESCUE" ] && RESCUE="$STORAGE/start.iso"
[ ! -f "$RESCUE" ] || [ ! -s "$RESCUE" ] && RESCUE="$STORAGE/start.iso"

if [ -f "$RESCUE" && -s "$RESCUE" ]; then
if [ -f "$RESCUE" ] && [ -s "$RESCUE" ]; then
  DISK_OPTS+=$(addMedia "$RESCUE" "$FALLBACK" "1" "0x6")
fi

@@ -673,20 +673,20 @@ fi
: "${DEVICE5:=""}"
: "${DEVICE6:=""}"

[ -z "$DEVICE" && -b "/disk" ] && DEVICE="/disk"
[ -z "$DEVICE" && -b "/disk1" ] && DEVICE="/disk1"
[ -z "$DEVICE2" && -b "/disk2" ] && DEVICE2="/disk2"
[ -z "$DEVICE3" && -b "/disk3" ] && DEVICE3="/disk3"
[ -z "$DEVICE4" && -b "/disk4" ] && DEVICE4="/disk4"
[ -z "$DEVICE5" && -b "/disk5" ] && DEVICE5="/disk5"
[ -z "$DEVICE6" && -b "/disk6" ] && DEVICE6="/disk6"

[ -z "$DEVICE" && -b "/dev/disk1" ] && DEVICE="/dev/disk1"
[ -z "$DEVICE2" && -b "/dev/disk2" ] && DEVICE2="/dev/disk2"
[ -z "$DEVICE3" && -b "/dev/disk3" ] && DEVICE3="/dev/disk3"
[ -z "$DEVICE4" && -b "/dev/disk4" ] && DEVICE4="/dev/disk4"
[ -z "$DEVICE5" && -b "/dev/disk5" ] && DEVICE4="/dev/disk5"
[ -z "$DEVICE6" && -b "/dev/disk6" ] && DEVICE4="/dev/disk6"
[ -z "$DEVICE" ] && [ -b "/disk" ] && DEVICE="/disk"
[ -z "$DEVICE" ] && [ -b "/disk1" ] && DEVICE="/disk1"
[ -z "$DEVICE2" ] && [ -b "/disk2" ] && DEVICE2="/disk2"
[ -z "$DEVICE3" ] && [ -b "/disk3" ] && DEVICE3="/disk3"
[ -z "$DEVICE4" ] && [ -b "/disk4" ] && DEVICE4="/disk4"
[ -z "$DEVICE5" ] && [ -b "/disk5" ] && DEVICE5="/disk5"
[ -z "$DEVICE6" ] && [ -b "/disk6" ] && DEVICE6="/disk6"

[ -z "$DEVICE" ] && [ -b "/dev/disk1" ] && DEVICE="/dev/disk1"
[ -z "$DEVICE2" ] && [ -b "/dev/disk2" ] && DEVICE2="/dev/disk2"
[ -z "$DEVICE3" ] && [ -b "/dev/disk3" ] && DEVICE3="/dev/disk3"
[ -z "$DEVICE4" ] && [ -b "/dev/disk4" ] && DEVICE4="/dev/disk4"
[ -z "$DEVICE5" ] && [ -b "/dev/disk5" ] && DEVICE4="/dev/disk5"
[ -z "$DEVICE6" ] && [ -b "/dev/disk6" ] && DEVICE4="/dev/disk6"


if [ -n "$DEVICE" ]; then
+1 −1
Original line number Diff line number Diff line
@@ -454,7 +454,7 @@ getInfo() {

  IP6=""
  # shellcheck disable=SC2143
  if [ -f /proc/net/if_inet6 && -n "$(ifconfig -a | grep inet6)" ]; then
  if [ -f /proc/net/if_inet6 ] && [ -n "$(ifconfig -a | grep inet6)" ]; then
    IP6=$(ip -6 addr show dev "$VM_NET_DEV" scope global up)
    [ -n "$IP6" ] && IP6=$(echo "$IP6" | sed -e's/^.*inet6 \([^ ]*\)\/.*$/\1/;t;d' | head -n 1)
  fi
+1 −1
Original line number Diff line number Diff line
@@ -171,7 +171,7 @@ if [[ "${WEB:-}" != [Nn]* ]]; then
  echo "$user:{PLAIN}${PASS:-}" > /etc/nginx/.htpasswd
  
  # shellcheck disable=SC2143
  if [ -f /proc/net/if_inet6 && -n "$(ifconfig -a | grep inet6)" ]; then
  if [ -f /proc/net/if_inet6 ] && [ -n "$(ifconfig -a | grep inet6)" ]; then
  
    sed -i "s/listen 8006 default_server;/listen [::]:8006 default_server ipv6only=off;/g" /etc/nginx/sites-enabled/web.conf