<commit_before>#!/bin/sh

MKIMAGE=${HOST_DIR}/usr/bin/mkimage
BOARD_DIR="$(dirname $0)"
BOARD_NAME="$(basename ${BOARD_DIR})"

#
# Create user filesystem
#
echo "Create user filesystem"
mkdir -p ${BUILD_DIR}/userfs
touch "${BUILD_DIR}/userfs/.doFactoryReset"
rm -f ${BINARIES_DIR}/userfs.ext4
mkfs.ext4 -d ${BUILD_DIR}/userfs -F -L userfs ${BINARIES_DIR}/userfs.ext4 3000

#
# VERSION File
#
cp ${TARGET_DIR}/boot/VERSION ${BINARIES_DIR}

# prepare grub config and bootloader
mkdir -p ${BINARIES_DIR}/boot/grub
cp -a ${BOARD_DIR}/grub.cfg ${BINARIES_DIR}/boot/grub/

# create *.img file using genimage
support/scripts/genimage.sh -c "${BR2_EXTERNAL_EQ3_PATH}/board/${BOARD_NAME}/genimage.cfg"

# lets create vmdk/vhdx/vdi files
${HOST_DIR}/bin/qemu-img convert -O vmdk -o subformat=streamOptimized ${BINARIES_DIR}/sdcard.img ${BINARIES_DIR}/sdcard.vmdk
${HOST_DIR}/bin/qemu-img convert -O vhdx ${BINARIES_DIR}/sdcard.img ${BINARIES_DIR}/sdcard.vhdx
${HOST_DIR}/bin/qemu-img convert -O vdi ${BINARIES_DIR}/sdcard.img ${BINARIES_DIR}/sdcard.vdi

# lets create an *.ova archive from the vmdk, template ovf file and
# also create a *.mf manifest file
OVADIR=$(mktemp -d)
cp -a ${BINARIES_DIR}/sdcard.vmdk ${OVADIR}/RaspberryMatic.vmdk
cp -a ${BOARD_DIR}/template.ovf ${OVADIR}/RaspberryMatic.ovf
(cd ${OVADIR}; sha1sum --tag RaspberryMatic.* >RaspberryMatic.mf)
tar -C ${OVADIR} --owner=root --group=root -cf ${BINARIES_DIR}/RaspberryMatic.ova RaspberryMatic.vmdk RaspberryMatic.ovf RaspberryMatic.mf
#rm -rf ${OVADIR}

exit $?<commit_msg>put the *.ovf at the very beginning of the *.ova file or some VirtualBox versions might complain during import.<commit_after>#!/bin/sh

MKIMAGE=${HOST_DIR}/usr/bin/mkimage
BOARD_DIR="$(dirname $0)"
BOARD_NAME="$(basename ${BOARD_DIR})"

#
# Create user filesystem
#
echo "Create user filesystem"
mkdir -p ${BUILD_DIR}/userfs
touch "${BUILD_DIR}/userfs/.doFactoryReset"
rm -f ${BINARIES_DIR}/userfs.ext4
mkfs.ext4 -d ${BUILD_DIR}/userfs -F -L userfs ${BINARIES_DIR}/userfs.ext4 3000

#
# VERSION File
#
cp ${TARGET_DIR}/boot/VERSION ${BINARIES_DIR}

# prepare grub config and bootloader
mkdir -p ${BINARIES_DIR}/boot/grub
cp -a ${BOARD_DIR}/grub.cfg ${BINARIES_DIR}/boot/grub/

# create *.img file using genimage
support/scripts/genimage.sh -c "${BR2_EXTERNAL_EQ3_PATH}/board/${BOARD_NAME}/genimage.cfg"

# lets create vmdk/vhdx/vdi files
${HOST_DIR}/bin/qemu-img convert -O vmdk -o subformat=streamOptimized ${BINARIES_DIR}/sdcard.img ${BINARIES_DIR}/sdcard.vmdk
${HOST_DIR}/bin/qemu-img convert -O vhdx ${BINARIES_DIR}/sdcard.img ${BINARIES_DIR}/sdcard.vhdx
${HOST_DIR}/bin/qemu-img convert -O vdi ${BINARIES_DIR}/sdcard.img ${BINARIES_DIR}/sdcard.vdi

# lets create an *.ova archive from the vmdk, template ovf file and
# also create a *.mf manifest file
OVADIR=$(mktemp -d)
cp -a ${BINARIES_DIR}/sdcard.vmdk ${OVADIR}/RaspberryMatic.vmdk
cp -a ${BOARD_DIR}/template.ovf ${OVADIR}/RaspberryMatic.ovf
(cd ${OVADIR}; sha1sum --tag RaspberryMatic.* >RaspberryMatic.mf)
tar -C ${OVADIR} --owner=root --group=root -cf ${BINARIES_DIR}/RaspberryMatic.ova RaspberryMatic.ovf RaspberryMatic.vmdk RaspberryMatic.mf
#rm -rf ${OVADIR}

exit $?
{'fraction_non_alphanumeric': 0.15561868686868688, 'fraction_numerical': 0.006944444444444444, 'mean_word_length': 5.287698412698413, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2638552', 'n_tokens_mistral': 1297, 'n_tokens_neox': 1234, 'n_words': 270}