diff --git a/molecules/arm-base.common b/molecules/arm-base.common index 9312f42..d91e96e 100644 --- a/molecules/arm-base.common +++ b/molecules/arm-base.common @@ -49,10 +49,6 @@ post_image_script: /sabayon/scripts/post_mmc_image_script.sh # Destination directory for the image path (MANDATORY) destination_image_directory: /sabayon/images -# External script that will generate the image file. -# The same can be copied onto a MMC by using dd -image_generator_script: /sabayon/scripts/mkloopcard.txt - # Path to source chroot (mandatory) source_chroot: /sabayon/sources/armv7l_core-2012 @@ -123,6 +119,7 @@ paths_to_remove: /root/local, /var/tmp/*, /root/.ssh, + /root/.distcc, /etc/distcc/.ssh # Directories to empty (comma separated) diff --git a/molecules/sabayon-arm-beaglebone-base-16G.spec b/molecules/sabayon-arm-beaglebone-base-16G.spec index 3fce8c9..4f4fedb 100644 --- a/molecules/sabayon-arm-beaglebone-base-16G.spec +++ b/molecules/sabayon-arm-beaglebone-base-16G.spec @@ -1,7 +1,7 @@ %import /sabayon/molecules/arm-base.common # Release desc (the actual release description) -release_desc: armv7a Base +release_desc: armv7a BeagleBone Base # Release Version (used to generate release_file) release_version: 8 @@ -18,3 +18,6 @@ image_mb: 16000 # Path to boot partition data (MLO, u-boot.img etc) source_boot_directory: /sabayon/beaglebone/boot +# External script that will generate the image file. +# The same can be copied onto a MMC by using dd +image_generator_script: /sabayon/scripts/beaglebone_image_generator_script.sh diff --git a/molecules/sabayon-arm-beaglebone-base-4G.spec b/molecules/sabayon-arm-beaglebone-base-4G.spec index 22e3b75..02c79cc 100644 --- a/molecules/sabayon-arm-beaglebone-base-4G.spec +++ b/molecules/sabayon-arm-beaglebone-base-4G.spec @@ -1,7 +1,7 @@ %import /sabayon/molecules/arm-base.common # Release desc (the actual release description) -release_desc: armv7a Base +release_desc: armv7a BeagleBone Base # Release Version (used to generate release_file) release_version: 8 @@ -18,3 +18,6 @@ image_mb: 3800 # Path to boot partition data (MLO, u-boot.img etc) source_boot_directory: /sabayon/beaglebone/boot +# External script that will generate the image file. +# The same can be copied onto a MMC by using dd +image_generator_script: /sabayon/scripts/beaglebone_image_generator_script.sh diff --git a/molecules/sabayon-arm-beaglebone-base-8G.spec b/molecules/sabayon-arm-beaglebone-base-8G.spec index e395cdd..79250ce 100644 --- a/molecules/sabayon-arm-beaglebone-base-8G.spec +++ b/molecules/sabayon-arm-beaglebone-base-8G.spec @@ -1,7 +1,7 @@ %import /sabayon/molecules/arm-base.common # Release desc (the actual release description) -release_desc: armv7a Base +release_desc: armv7a BeagleBone Base # Release Version (used to generate release_file) release_version: 8 @@ -18,3 +18,6 @@ image_mb: 7800 # Path to boot partition data (MLO, u-boot.img etc) source_boot_directory: /sabayon/beaglebone/boot +# External script that will generate the image file. +# The same can be copied onto a MMC by using dd +image_generator_script: /sabayon/scripts/beaglebone_image_generator_script.sh diff --git a/scripts/beaglebone_image_generator_script.sh b/scripts/beaglebone_image_generator_script.sh new file mode 100755 index 0000000..af682c8 --- /dev/null +++ b/scripts/beaglebone_image_generator_script.sh @@ -0,0 +1,2 @@ +#!/bin/sh +exec /sabayon/scripts/mkloopcard.sh /sabayon/scripts/mkloopcard_beaglebone_chroot_hook.sh "$@" diff --git a/scripts/mkloopcard.txt b/scripts/mkloopcard.sh similarity index 90% rename from scripts/mkloopcard.txt rename to scripts/mkloopcard.sh index c04d0c5..cf7593d 100755 --- a/scripts/mkloopcard.txt +++ b/scripts/mkloopcard.sh @@ -14,15 +14,20 @@ export LC_ALL=C # IMAGE_NAME # DESTINATION_IMAGE_DIR -if [ ${#} -ne 4 ]; then +if [ ${#} -ne 5 ]; then echo "usage: ${0} " exit 1 fi -FILE="${1}" -SIZE="${2}" -BOOT_DIR="${3}" -CHROOT_DIR="${4}" +CHROOT_SCRIPT="${1}" +if [ ! -x "${CHROOT_SCRIPT}" ]; then + echo "${CHROOT_SCRIPT} is not executable" + exit 1 +fi +FILE="${2}" +SIZE="${3}" +BOOT_DIR="${4}" +CHROOT_DIR="${5}" # Should we make a tarball of the rootfs and bootfs? MAKE_TARBALL="${MAKE_TARBALL:-1}" @@ -130,12 +135,14 @@ mount "${ext_part}" "${tmp_dir}" rsync -a -H -A -X --delete-during "${CHROOT_DIR}"/ "${tmp_dir}"/ --exclude "/proc/*" --exclude "/sys/*" \ --exclude "/dev/pts/*" --exclude "/dev/shm/*" || exit 1 -# setup root password to... root! -echo "echo root:root | chpasswd" | chroot "${tmp_dir}" -# enable sshd by default -echo "rc-update add sshd default" | chroot "${tmp_dir}" -# cleaning up deps -echo "rc-update --update" | chroot "${tmp_dir}" +# execute CHROOT_SCRIPT hook inside chroot +chroot_script_name=$(basename "${CHROOT_SCRIPT}") +target_chroot_script="${tmp_dir}"/"${chroot_script_name}" +cp -p "${CHROOT_SCRIPT}" "${target_chroot_script}" || exit 1 +chmod 700 "${target_chroot_script}" || exit 1 +chown root "${target_chroot_script}" || exit 1 +chroot "${tmp_dir}" "/${chroot_script_name}" || exit 1 +rm -f "${target_chroot_script}" # work out paths to empty and paths to remove if [ -n "${PATHS_TO_REMOVE}" ]; then diff --git a/scripts/mkloopcard_beaglebone_chroot_hook.sh b/scripts/mkloopcard_beaglebone_chroot_hook.sh new file mode 100755 index 0000000..e612c78 --- /dev/null +++ b/scripts/mkloopcard_beaglebone_chroot_hook.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# This script is executed inside the image chroot before packing up. +# Architecture/platform specific code goes here, like kernel install +# and configuration + +env-update +. /etc/profile + +# enable sshd by default +rc-update add sshd default + +# TODO: error out here when linux-beaglebone is there +# "equo update" is done by inner_source_chroot_update script +# which directive is appended by iso_build.sh script +equo install sys-kernel/linux-beaglebone + +# setup root password to... root! +echo root:root | chpasswd +# cleaning up deps +rc-update --update + +exit 0 +