Skip to content

Commit

Permalink
move docker specific code into build-vm-docker
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschroeter committed Aug 8, 2016
1 parent 1812b05 commit b516d81
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
12 changes: 0 additions & 12 deletions build-recipe-kiwi
Original file line number Diff line number Diff line change
Expand Up @@ -426,25 +426,13 @@ 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
10 changes: 8 additions & 2 deletions build-vm-docker
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ vm_verify_options_docker() {

vm_startup_docker() {
local name="obsbuild.${BUILD_ROOT##*/}"
touch $BUILD_ROOT/.dockerenv
docker rm "$name" >/dev/null 2>&1 || true
docker run \
--rm --name "$name" --cap-add=sys_admin --cap-add=MKNOD --net=none \
Expand All @@ -45,7 +44,14 @@ vm_kill_docker() {
}

vm_fixup_docker() {
:
# loop devices are needed for kiwi builds at least
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
}

vm_attach_root_docker() {
Expand Down

0 comments on commit b516d81

Please sign in to comment.