[Virtio-fs] [PATCH 2/2] build-rootfs: Select bootstrap command based on build machine distro

Fabiano Rosas farosas at linux.ibm.com
Tue Dec 10 14:51:05 UTC 2019


Read the distro id from /etc/os-release and use the correct bootstrap
command.

Signed-off-by: Fabiano Rosas <farosas at linux.ibm.com>
---
 build-rootfs.sh | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/build-rootfs.sh b/build-rootfs.sh
index f616981..3b109a8 100755
--- a/build-rootfs.sh
+++ b/build-rootfs.sh
@@ -24,9 +24,15 @@ run_in_rootfs() {
 umask 022
 rm -rf rootfs
 mkdir rootfs
-#dnf "--installroot=$PWD/rootfs" "--releasever=$FEDORA_RELEASE" --assumeyes install $FEDORA_PACKAGES
-#install -D -m 0644 /etc/resolv.conf "$PWD/rootfs/etc/"
-debootstrap --include="$DEBIAN_PACKAGES" stable "$PWD/rootfs"
+
+source /etc/os-release
+if [[ "$ID $ID_LIKE" =~ "fedora" ]]; then
+	dnf "--installroot=$PWD/rootfs" "--releasever=$FEDORA_RELEASE" --assumeyes install $FEDORA_PACKAGES
+	install -D -m 0644 /etc/resolv.conf "$PWD/rootfs/etc/"
+elif [[ "$ID $ID_LIKE" =~ "debian" ]]; then
+	debootstrap --include="$DEBIAN_PACKAGES" stable "$PWD/rootfs"
+fi
+
 install -D -m 0755 run-test-in-guest.sh "$PWD/rootfs/root/"
 install -D -m 0644 run-test.service "$PWD/rootfs/etc/systemd/system/"
 run_in_rootfs /bin/bash -c "cd /root && git clone https://github.com/pjd/pjdfstest && cd pjdfstest && autoreconf -ifs && ./configure && make pjdfstest"
-- 
2.23.0





More information about the Virtio-fs mailing list