Browse Source

判断是否安装 binfmt-support,qemu-user-static

侠义书生 3 years ago
parent
commit
1fcc5db43a
1 changed files with 13 additions and 3 deletions
  1. 13 3
      debootstrap/kylinos/rootfs.sh

+ 13 - 3
debootstrap/kylinos/rootfs.sh

@@ -62,8 +62,18 @@ function do_rootfs() {
         sudo rm -rf ${ROOTFS_DIR}
     fi
 
+    # 制作其他架构,判断是否安装 binfmt-support,qemu-user-static
+    if [ "$(dpkg --print-architecture)" = "${ARCH}" ]; then
+        if ! dpkg -l | grep binfmt-support; then
+            sudo apt install -y binfmt-support
+        fi
+        if ! dpkg -l | grep qemu-user-static; then
+            sudo apt install -y qemu-user-static
+        fi
+    fi
+
     # 制作 rootfs
-    sudo debootstrap --no-check-gpg --variant=minbase --arch=${ARCH} --include="kylin-keyring" --components=main ${SUITE} ${ROOTFS_DIR} ${MIRROR}
+    sudo debootstrap --no-check-gpg --variant=minbase --arch=${ARCH} --include="kylin-keyring" --components=main ${SUITE} ${ROOTFS_DIR} ${MIRROR} gutsy
 }
 
 function do_config() {
@@ -118,7 +128,7 @@ function do_ext4() {
     size=$(echo "(${dusize} / 1024) + 600" | bc)
 
     # size=8192   # 指定 8G 大小
-    size=4096   # 指定 4G 大小
+    size=4096 # 指定 4G 大小
 
     dd if=/dev/zero of=${ROOTFS_DIR}.ext4 bs=1M count=${size} status=progress
     sudo mkdir -p ./ext4_mount
@@ -326,4 +336,4 @@ for task in $(echo ${TASKS} | tr ',' ' '); do
     echo "---> do_${task}"
     do_${task}
     # done | tee ${LOG_FILE} 2>&1
-done >${LOG_FILE} 2>&1
+done #>${LOG_FILE} 2>&1