Add NOOBS export support
This commit is contained in:
parent
de878cc217
commit
cc5a65723c
2 changed files with 15 additions and 9 deletions
7
build.sh
7
build.sh
|
@ -163,13 +163,16 @@ for STAGE_DIR in ${BASE_DIR}/stage*; do
|
||||||
run_stage
|
run_stage
|
||||||
done
|
done
|
||||||
|
|
||||||
STAGE_DIR=${BASE_DIR}/export-image
|
|
||||||
|
|
||||||
CLEAN=1
|
CLEAN=1
|
||||||
for EXPORT_DIR in ${EXPORT_DIRS}; do
|
for EXPORT_DIR in ${EXPORT_DIRS}; do
|
||||||
|
STAGE_DIR=${BASE_DIR}/export-image
|
||||||
IMG_SUFFIX=$(cat ${EXPORT_DIR}/EXPORT_IMAGE)
|
IMG_SUFFIX=$(cat ${EXPORT_DIR}/EXPORT_IMAGE)
|
||||||
EXPORT_ROOTFS_DIR=${WORK_DIR}/$(basename ${EXPORT_DIR})/rootfs
|
EXPORT_ROOTFS_DIR=${WORK_DIR}/$(basename ${EXPORT_DIR})/rootfs
|
||||||
run_stage
|
run_stage
|
||||||
|
if [ -e ${EXPORT_DIR}/EXPORT_NOOBS ]; then
|
||||||
|
STAGE_DIR=${BASE_DIR}/export-noobs
|
||||||
|
run_stage
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
log "End ${BASE_DIR}"
|
log "End ${BASE_DIR}"
|
||||||
|
|
|
@ -4,14 +4,14 @@ log (){
|
||||||
export -f log
|
export -f log
|
||||||
|
|
||||||
bootstrap(){
|
bootstrap(){
|
||||||
ARCH=$(dpkg --print-architecture)
|
local ARCH=$(dpkg --print-architecture)
|
||||||
|
|
||||||
export http_proxy=${APT_PROXY}
|
export http_proxy=${APT_PROXY}
|
||||||
|
|
||||||
if [ "$ARCH" != "armhf" ]; then
|
if [ "$ARCH" != "armhf" ]; then
|
||||||
BOOTSTRAP_CMD=qemu-debootstrap
|
local BOOTSTRAP_CMD=qemu-debootstrap
|
||||||
else
|
else
|
||||||
BOOTSTRAP_CMD=debootstrap
|
local BOOTSTRAP_CMD=debootstrap
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${BOOTSTRAP_CMD} --components=main,contrib,non-free \
|
${BOOTSTRAP_CMD} --components=main,contrib,non-free \
|
||||||
|
@ -39,7 +39,7 @@ unmount(){
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while mount | grep -q $DIR; do
|
while mount | grep -q $DIR; do
|
||||||
LOCS=`mount | grep $DIR | cut -f 3 -d ' ' | sort -r`
|
local LOCS=`mount | grep $DIR | cut -f 3 -d ' ' | sort -r`
|
||||||
for loc in $LOCS; do
|
for loc in $LOCS; do
|
||||||
umount $loc
|
umount $loc
|
||||||
done
|
done
|
||||||
|
@ -50,9 +50,12 @@ export -f unmount
|
||||||
unmount_image(){
|
unmount_image(){
|
||||||
sync
|
sync
|
||||||
sleep 1
|
sleep 1
|
||||||
unmount $(dirname ${1})
|
local LOOP_DEV=$(losetup -j ${1} | cut -f1 -d':')
|
||||||
LOOP_DEV=$(losetup -j ${1} | cut -f1 -d':')
|
|
||||||
if [ -n "${LOOP_DEV}" ]; then
|
if [ -n "${LOOP_DEV}" ]; then
|
||||||
|
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
|
||||||
sleep 1
|
sleep 1
|
||||||
kpartx -ds ${LOOP_DEV}
|
kpartx -ds ${LOOP_DEV}
|
||||||
losetup -d ${LOOP_DEV}
|
losetup -d ${LOOP_DEV}
|
||||||
|
@ -82,7 +85,7 @@ on_chroot() {
|
||||||
export -f on_chroot
|
export -f on_chroot
|
||||||
|
|
||||||
update_issue() {
|
update_issue() {
|
||||||
GIT_HASH=$(git rev-parse HEAD)
|
local GIT_HASH=$(git rev-parse HEAD)
|
||||||
echo -e "Raspberry Pi reference ${IMG_DATE}\nGenerated using pi-gen, https://github.com/RPi-Distro/pi-gen, ${GIT_HASH}, ${1}" > ${ROOTFS_DIR}/etc/rpi-issue
|
echo -e "Raspberry Pi reference ${IMG_DATE}\nGenerated using pi-gen, https://github.com/RPi-Distro/pi-gen, ${GIT_HASH}, ${1}" > ${ROOTFS_DIR}/etc/rpi-issue
|
||||||
}
|
}
|
||||||
export -f update_issue
|
export -f update_issue
|
||||||
|
|
Loading…
Reference in a new issue