Skip to contentSkip to conversation

virtio-fs-ci: build-rootfs tweaks

PATCH Applied Fabiano Rosas 2 participants 4 messages Dec 10, 2019 – Dec 17, 2019

lore
Share & tools
lore
#0 lore raw

cover virtio-fs-ci: build-rootfs tweaks

Some improvements for the rootfs build:

- first patch fixes the rootfs build in Fedora

- second patch makes the bootstrap tool selection according to distro automatically

Fabiano Rosas (2):
build-rootfs: Fix fedora build
build-rootfs: Select bootstrap command based on build machine distro

 build-rootfs.sh | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

--
2.23.0

#1 lore raw

PATCH 1/2 build-rootfs: Fix fedora build

Ensure that the rootfs build in Fedora finishes without errors.

- include wget in the rootfs
- fix dnf install command line
- include a resolv.conf

---
 build-rootfs.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
build-rootfs.sh +3 -2
index c23656c..f616981 100755
@@ -6,7 +6,7 @@
 # Copyright (C) 2019 Red Hat, Inc.
 
 FEDORA_RELEASE=30
-FEDORA_PACKAGES="system-release vim-minimal systemd passwd dnf rootfiles autoconf automake gcc make git perl-Test-Harness tar"
+FEDORA_PACKAGES="system-release vim-minimal systemd passwd dnf rootfiles autoconf automake gcc make git perl-Test-Harness tar wget"
 
 DEBIAN_PACKAGES="vim-tiny autoconf automake gcc libc6-dev make git perl tar ca-certificates wget"
 
@@ -24,7 +24,8 @@ run_in_rootfs() {
 umask 022
 rm -rf rootfs
 mkdir rootfs
-#dnf "--installroot=$PWD/rootfs" "--releasever=$FEDORA_RELEASE" --assumeyes install $PACKAGES
+#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"
 install -D -m 0755 run-test-in-guest.sh "$PWD/rootfs/root/"
 install -D -m 0644 run-test.service "$PWD/rootfs/etc/systemd/system/"
Signature · 1 line
2.23.0
#2 lore raw

PATCH 2/2 build-rootfs: Select bootstrap command based on build machine distro

In reply to Fabiano Rosas

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

---
 build-rootfs.sh | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
build-rootfs.sh +9 -3
index f616981..3b109a8 100755
@@ -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"
Signature · 1 line
2.23.0
#3 lore raw
In reply to Fabiano Rosas
Quoted 12 lines · Fabiano Rosas

Some improvements for the rootfs build:

- first patch fixes the rootfs build in Fedora

- second patch makes the bootstrap tool selection according to distro automatically

Fabiano Rosas (2):
build-rootfs: Fix fedora build
build-rootfs: Select bootstrap command based on build machine distro

Quoted 6 lines
 build-rootfs.sh | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

--
2.23.0

Thanks, applied!

Stefan