Skip to content

Commit 66960a4

Browse files
committed
only copy disk to /mnt in docker
1 parent e83d7d1 commit 66960a4

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

scripts/create-image/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ ENV ADD_PACKAGE="make,sysbench,git,vim,tmux,usbutils,tcpdump,net-tools"
2323
ENV FEATURE=minimal
2424
ENV SEEK=2047
2525
ENV PERF=false
26+
ENV IN_DOCKER=true
2627

2728
# Use COPY after agt-get to allow caching apt
2829
WORKDIR /src
@@ -31,5 +32,5 @@ RUN ./debootstrap.sh
3132

3233
# will copy the img file to /mnt. Need --privilege flag for docker run.
3334
COPY --chmod=0755 configure.sh /src/
34-
CMD ["./configure.sh"]
35+
CMD ["bash", "-x", "./configure.sh"]
3536

scripts/create-image/configure.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
# Copyright 2025 syzkaller project authors. All rights reserved.
33
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
44

5-
sudo mkdir -p /fs/$DIR /mnt
6-
pushd /mnt
7-
85
# Set some defaults and enable promtless ssh to the machine for root.
96
sudo sed -i '/^root/ { s/:x:/::/ }' $DIR/etc/passwd
107
echo 'T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100' | sudo tee -a $DIR/etc/inittab
@@ -57,8 +54,11 @@ sudo chown -R 1000:1000 $DIR/home/user
5754
# Build a disk image
5855
dd if=/dev/zero of=$RELEASE.img bs=1M seek=$SEEK count=1
5956
sudo mkfs.ext4 -F $RELEASE.img
57+
sudo mkdir -p /fs/$DIR /mnt
6058
sudo mount -o loop $RELEASE.img /fs/$DIR
6159
sudo cp -a $DIR/. /fs/$DIR/.
6260
sudo umount /fs/$DIR
6361

64-
popd
62+
if [ "$IN_DOCKER" = true ]; then
63+
cp $RELEASE.* /mnt
64+
fi

scripts/create-image/create-image.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ RELEASE=trixie
2020
FEATURE=minimal
2121
SEEK=2047
2222
PERF=false
23+
IN_DOCKER=false
2324

2425
# Display help function
2526
display_help() {
@@ -77,7 +78,7 @@ if [ $PERF = "true" ] && [ -z ${KERNEL+x} ]; then
7778
fi
7879

7980
# If full feature is chosen, install more packages
80-
if [ $FEATURE = "full" ]; then
81+
if [ "$FEATURE" = "full" ]; then
8182
PREINSTALL_PKGS=$PREINSTALL_PKGS","$ADD_PACKAGE
8283
fi
8384

0 commit comments

Comments
 (0)