diff --git a/build.sh b/build.sh index c6abdae..672d98c 100755 --- a/build.sh +++ b/build.sh @@ -156,11 +156,11 @@ export QUILT_NO_DIFF_INDEX=1 export QUILT_NO_DIFF_TIMESTAMPS=1 export QUILT_REFRESH_ARGS="-p ab" -source ${SCRIPT_DIR}/common -source ${SCRIPT_DIR}/dependencies_check +source ${SCRIPT_DIR}/common.sh +source ${SCRIPT_DIR}/check_deps.sh -dependencies_check ${BASE_DIR}/depends +check_deps ${BASE_DIR}/depends mkdir -p ${WORK_DIR} log "Begin ${BASE_DIR}" diff --git a/export-noobs/prerun.sh b/export-noobs/prerun.sh index a531be6..6065ae8 100755 --- a/export-noobs/prerun.sh +++ b/export-noobs/prerun.sh @@ -14,13 +14,12 @@ BOOT_DEV=/dev/mapper/${LOOP_DEV}p1 ROOT_DEV=/dev/mapper/${LOOP_DEV}p2 mkdir -p ${STAGE_WORK_DIR}/rootfs -mkdir -p ${STAGE_WORK_DIR}/bootfs mkdir -p ${NOOBS_DIR} mount $ROOT_DEV ${STAGE_WORK_DIR}/rootfs -mount $BOOT_DEV ${STAGE_WORK_DIR}/bootfs +mount $BOOT_DEV ${STAGE_WORK_DIR}/rootfs/boot -tar -I pxz -C ${STAGE_WORK_DIR}/bootfs -cpf ${NOOBS_DIR}/boot.tar.xz . -tar -I pxz -C ${STAGE_WORK_DIR}/rootfs -cpf ${NOOBS_DIR}/root.tar.xz . +tar -I pxz -C ${STAGE_WORK_DIR}/rootfs/boot -cpf ${NOOBS_DIR}/boot.tar.xz . +tar -I pxz -C ${STAGE_WORK_DIR}/rootfs --one-file-system -cpf ${NOOBS_DIR}/root.tar.xz . unmount_image ${IMG_FILE} diff --git a/scripts/check_deps.sh b/scripts/check_deps.sh old mode 100755 new mode 100644 index e69de29..e13ff8e --- a/scripts/check_deps.sh +++ b/scripts/check_deps.sh @@ -0,0 +1,33 @@ +# bash # + +# check_deps +# $@ Dependnecy files to check +# +# Each dependency is in the form of a tool to test for, optionally followed by +# a : and the name of a package if the package on a Debian-ish system is not +# named for the tool (i.e., qemu-user-static). +check_deps() +{ + local depfile deps missing + + for depfile in "$@"; do + if [[ -e "$depfile" ]]; then + deps="$(sed -f "${SCRIPT_DIR}/remove-comments.sed" < ${BASE_DIR}/depends)" + + fi + for dep in $deps; do + if ! hash ${dep%:*} 2>/dev/null; then + missing="${missing:+$missing }${dep#*:}" + fi + done + done + + if [[ "$missing" ]]; then + echo "Reqired dependencies not installed" + echo + echo "This can be resolved on Debian/Raspbian systems by installing:" + echo "$missing" + false + fi +} +export -f check_deps diff --git a/scripts/common b/scripts/common.sh similarity index 94% rename from scripts/common rename to scripts/common.sh index 6db58e2..fa8e44f 100644 --- a/scripts/common +++ b/scripts/common.sh @@ -1,3 +1,5 @@ +# bash # + log (){ date +"[%T] $@" | tee -a ${LOG_FILE} } @@ -52,7 +54,7 @@ unmount_image(){ sleep 1 local LOOP_DEV=$(losetup -j ${1} | cut -f1 -d':') if [ -n "${LOOP_DEV}" ]; then - local MOUNTED_DIR=$(mount | grep $(basename ${LOOP_DEV} | head -n 1 | cut -f 3 -d ' ')) + local MOUNTED_DIR=$(mount | grep $(basename ${LOOP_DEV}) | head -n 1 | cut -f 3 -d ' ') if [ -n "${MOUNTED_DIR}" ]; then unmount $(dirname ${MOUNTED_DIR}) fi diff --git a/scripts/dependencies_check b/scripts/dependencies_check deleted file mode 100644 index 4817561..0000000 --- a/scripts/dependencies_check +++ /dev/null @@ -1,30 +0,0 @@ -# dependencies_check -# $@ Dependnecy files to check -# -# Each dependency is in the form of a tool to test for, optionally followed by -# a : and the name of a package if the package on a Debian-ish system is not -# named for the tool (i.e., qemu-user-static). -dependencies_check() -{ - local depfile deps missing - - for depfile in "$@"; do - if [[ -e "$depfile" ]]; then - deps="$(sed -f "${SCRIPT_DIR}/remove-comments.sed" < ${BASE_DIR}/depends)" - - fi - for dep in $deps; do - if ! hash ${dep%:*} 2>/dev/null; then - missing="${missing:+$missing }${dep#*:}" - fi - done - done - - if [[ "$missing" ]]; then - echo "Reqired dependencies not installed" - echo - echo "This can be resolved on Debian/Raspbian systems by installing:" - echo "$missing" - false - fi -}