pull/20/merge
Joseph Carter 2016-09-17 18:36:42 +00:00 committed by GitHub
commit 06b983647f
5 changed files with 42 additions and 38 deletions

View File

@ -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}"

View File

@ -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}

33
scripts/check_deps.sh Executable file → Normal file
View File

@ -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

View File

@ -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

View File

@ -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
}