mirror of
				https://github.com/vdsm/virtual-dsm.git
				synced 2025-11-04 17:04:52 +08:00 
			
		
		
		
	feat: Detect Windows and MacOS (#726)
This commit is contained in:
		
							parent
							
								
									c86408cbd6
								
							
						
					
					
						commit
						abd30b9d91
					
				@ -240,6 +240,23 @@ closeNetwork() {
 | 
				
			|||||||
  return 0
 | 
					  return 0
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					checkOS() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  local name
 | 
				
			||||||
 | 
					  local os=""
 | 
				
			||||||
 | 
					  name=$(uname -a)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  [[ "${name,,}" == *"darwin"* ]] && os="MacOS"
 | 
				
			||||||
 | 
					  [[ "${name,,}" == *"microsoft"* ]] && os="Windows"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if [ -n "$os" ]; then
 | 
				
			||||||
 | 
					    error "You are using Docker Desktop for $os which does not support macvlan, please revert to bridge networking!"
 | 
				
			||||||
 | 
					    return 1
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return 0
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
getInfo() {
 | 
					getInfo() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if [ -z "$VM_NET_DEV" ]; then
 | 
					  if [ -z "$VM_NET_DEV" ]; then
 | 
				
			||||||
@ -306,6 +323,8 @@ fi
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
if [[ "$DHCP" == [Yy1]* ]]; then
 | 
					if [[ "$DHCP" == [Yy1]* ]]; then
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ! checkOS && exit 19
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if [[ "$GATEWAY" == "172."* ]]; then
 | 
					  if [[ "$GATEWAY" == "172."* ]]; then
 | 
				
			||||||
    warn "your gateway IP starts with 172.* which is often a sign that you are not on a macvlan network (required for DHCP)!"
 | 
					    warn "your gateway IP starts with 172.* which is often a sign that you are not on a macvlan network (required for DHCP)!"
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
@ -318,6 +337,10 @@ if [[ "$DHCP" == [Yy1]* ]]; then
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if [[ "$GATEWAY" != "172."* ]]; then
 | 
				
			||||||
 | 
					    ! checkOS && exit 19
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Shutdown nginx
 | 
					  # Shutdown nginx
 | 
				
			||||||
  nginx -s stop 2> /dev/null
 | 
					  nginx -s stop 2> /dev/null
 | 
				
			||||||
  fWait "nginx"
 | 
					  fWait "nginx"
 | 
				
			||||||
 | 
				
			|||||||
@ -30,10 +30,18 @@ if [[ "$KVM" != [Nn]* ]]; then
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  if [ -n "$KVM_ERR" ]; then
 | 
					  if [ -n "$KVM_ERR" ]; then
 | 
				
			||||||
    KVM="N"
 | 
					    KVM="N"
 | 
				
			||||||
 | 
					    if [[ "$OSTYPE" =~ ^darwin ]]; then
 | 
				
			||||||
 | 
					      warn "you are using MacOS which has no KVM support, this will cause a major loss of performance."
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      if grep -qi Microsoft /proc/version; then
 | 
				
			||||||
 | 
					        warn "you are using Windows 10 which has no KVM support, this will cause a major loss of performance."
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
        error "KVM acceleration not available $KVM_ERR, this will cause a major loss of performance."
 | 
					        error "KVM acceleration not available $KVM_ERR, this will cause a major loss of performance."
 | 
				
			||||||
        error "See the FAQ on how to enable it, or continue without KVM by setting KVM=N (not recommended)."
 | 
					        error "See the FAQ on how to enable it, or continue without KVM by setting KVM=N (not recommended)."
 | 
				
			||||||
        [[ "$DEBUG" != [Yy1]* ]] && exit 88
 | 
					        [[ "$DEBUG" != [Yy1]* ]] && exit 88
 | 
				
			||||||
      fi
 | 
					      fi
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user