Skip to content

Commit

Permalink
builder: fix repo cloning to image
Browse files Browse the repository at this point in the history
  • Loading branch information
goldarte committed Mar 28, 2019
1 parent 47c2cd1 commit 948ae7f
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions builder/image-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,26 @@ img-resize ${IMAGE_PATH} max '5G'
# Copy cloned repository to the image
# Include dotfiles in globs (asterisks)
shopt -s dotglob

echo_stamp "Mount loop-image: ${IMAGE_PATH}"
DEV_IMAGE=$(losetup -Pf ${IMAGE_PATH} --show)
sleep 0.5

MOUNT_POINT=$(mktemp -d --suffix=.builder_image)
echo_stamp "Mount dirs ${MOUNT_POINT} & ${MOUNT_POINT}/boot"
mount "${DEV_IMAGE}p2" ${MOUNT_POINT}
mount "${DEV_IMAGE}p1" ${MOUNT_POINT}/boot

mkdir -p ${MOUNT_POINT}'/home/pi/CleverSwarm/'
for dir in ${REPO_DIR}/*; do
# Don't try to copy image into itself
if [[ $dir != *"images" && $dir != *"imgcache" ]]; then
img-chroot ${IMAGE_PATH} copy $dir '/home/pi/CleverSwarm/'
cp -r $dir ${MOUNT_POINT}'/home/pi/CleverSwarm/'$(basename $dir)
fi;
done

umount -fR ${MOUNT_POINT}
losetup -d ${DEV_IMAGE}

# Install software
img-chroot ${IMAGE_PATH} exec ${SCRIPTS_DIR}'/image-software.sh'

Expand Down

0 comments on commit 948ae7f

Please sign in to comment.