فهرست منبع

Improve dpkg handling in build.sh

Joshua M. Boniface 5 سال پیش
والد
کامیت
c10df2fe85
1فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 2 2
      build.sh

+ 2 - 2
build.sh

@@ -34,7 +34,7 @@ list_platforms() {
 }
 }
 
 
 do_build_native() {
 do_build_native() {
-    if [[ $( dpkg --print-architecture | head -1 ) != "${PLATFORM##*.}" ]]; then
+    if [[ -f $( which dpkg ) && $( dpkg --print-architecture | head -1 ) != "${PLATFORM##*.}" ]]; then
         echo "Cross-building is not supported for native builds, use 'docker' builds on amd64 for cross-building."
         echo "Cross-building is not supported for native builds, use 'docker' builds on amd64 for cross-building."
         exit 1
         exit 1
     fi
     fi
@@ -43,7 +43,7 @@ do_build_native() {
 }
 }
 
 
 do_build_docker() {
 do_build_docker() {
-    if ! dpkg --print-architecture | grep -q 'amd64'; then
+    if [[ -f $( which dpkg ) && $( dpkg --print-architecture | head -1 ) != "amd64" ]]; then
         echo "Docker-based builds only support amd64-based cross-building; use a 'native' build instead."
         echo "Docker-based builds only support amd64-based cross-building; use a 'native' build instead."
         exit 1
         exit 1
     fi
     fi