Skip to content

Commit

Permalink
Merge pull request #274 from k0da/loop_devices_in_docker
Browse files Browse the repository at this point in the history
Setup loop devices in docker required for KIWI
  • Loading branch information
adrianschroeter committed Aug 8, 2016
2 parents a750173 + 2cf6d49 commit 5543fda
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions build-recipe-kiwi
Expand Up @@ -426,13 +426,25 @@ is_legacy_kiwi() {
return 0
}

setup_docker_loop() {
max_loop=`cat /sys/module/loop/parameters/max_loop`
if [ "$max_loop" = "0" ]; then
max_loop=16
fi
for $num in `seq 0 $max_loop`; do
test -b /dev/loop$num || mknod -m660 /dev/loop$num b 7 $num
done
}
build_kiwi_appliance() {
if test -z "$RUNNING_IN_VM" ; then
# NOTE: this must be done with the outer system, because it loads
# the dm-mod kernel modules, which needs to fit to the kernel.
echo "starting device mapper for kiwi..."
test -x /etc/init.d/boot.device-mapper && \
/etc/init.d/boot.device-mapper start
if test -f /.dockerenv ; then
setup_docker_loop
fi
fi
KIWI_PROFILE=$(queryconfig \
--dist "$BUILD_DIST" --configdir "$CONFIG_DIR" \
Expand Down
2 changes: 1 addition & 1 deletion build-vm-docker
Expand Up @@ -31,7 +31,7 @@ vm_startup_docker() {
local name="obsbuild.${BUILD_ROOT##*/}"
docker rm "$name" >/dev/null 2>&1 || true
docker run \
--rm --name "$name" --cap-add=sys_admin --net=none \
--rm --name "$name" --cap-add=sys_admin --cap-add=MKNOD --net=none \
-v "$BUILD_ROOT:/mnt" busybox /bin/chroot /mnt "$vm_init_script"
BUILDSTATUS="$?"
test "$BUILDSTATUS" != 255 || BUILDSTATUS=3
Expand Down

0 comments on commit 5543fda

Please sign in to comment.