1
0
mirror of https://github.com/rancher/os.git synced 2025-07-06 11:36:15 +00:00

fix ./scripts/run: create a unique loopback device for each run

This commit is contained in:
Ivan Mikushin 2016-05-11 15:36:56 -07:00
parent de7930d820
commit d664c96001
2 changed files with 13 additions and 10 deletions

View File

@ -1,7 +1,7 @@
FROM rancher/os-dapper-base
RUN apt-get update && \
apt-get -y install locales sudo vim less curl wget git rsync build-essential isolinux xorriso gccgo \
apt-get -y install locales sudo vim less curl wget git rsync build-essential isolinux xorriso gccgo uuid \
libblkid-dev libmount-dev libselinux1-dev cpio genisoimage qemu-kvm qemu python-pip ca-certificates pkg-config tox module-init-tools
ARG HOST_ARCH

View File

@ -162,17 +162,9 @@ if [ "$QEMU" == "1" ]; then
qemu-img create -f qcow2 -o size=10G ${HD}
fi
CCIMG=${BUILD}/cc.img
CCDEV=$(losetup -f)
CCROOT=${BUILD}/cloud-config
dd if=/dev/zero of=${CCIMG} bs=1024 count=512
losetup ${CCDEV} ${CCIMG}
mkfs.vfat -n "config-2" ${CCDEV}
rm -rf ${CCROOT}
mkdir -p ${CCROOT}
mount ${CCDEV} ${CCROOT}
USER_DATA=${CCROOT}/openstack/latest/user_data
mkdir -p $(dirname ${USER_DATA})
@ -185,8 +177,19 @@ if [ "$QEMU" == "1" ]; then
echo "- $(<${BASE}/assets/rancher.key.pub)" >> ${USER_DATA}
fi
umount ${CCROOT}
CCIMG=${BUILD}/cc.img
CCDEV=/dev/loop$(uuid)
mknod $CCDEV b 7 0
dd if=/dev/zero of=${CCIMG} bs=1024 count=512
losetup ${CCDEV} ${CCIMG}
mkfs.vfat -n "config-2" ${CCDEV}
CCROOT_TMP=$(mktemp -d)
mount ${CCDEV} ${CCROOT_TMP}
cp -a ${CCROOT}/* ${CCROOT_TMP}/
umount ${CCROOT_TMP} && rmdir ${CCROOT_TMP}
losetup -d ${CCDEV}
rm ${CCDEV}
CPU=${cpu["$ARCH"]}