mirror of
https://github.com/Fishwaldo/build.git
synced 2025-06-27 00:28:25 +00:00
Improve reliability of image creation in build-all
This commit is contained in:
parent
ee87237e85
commit
7772883381
2 changed files with 13 additions and 1 deletions
|
@ -374,14 +374,22 @@ prepare_partitions()
|
|||
fi
|
||||
|
||||
# stage: mount image
|
||||
# TODO: Needs mknod here in Docker?
|
||||
# lock access to loop devices
|
||||
exec {FD}>/var/lock/armbian-debootstrap-losetup
|
||||
flock --verbose -x $FD | tee -a $DEST/debug/output.log
|
||||
|
||||
LOOP=$(losetup -f)
|
||||
[[ -z $LOOP ]] && exit_with_error "Unable to find free loop device"
|
||||
|
||||
# NOTE: losetup -P option is not available in Trusty
|
||||
[[ $CONTAINER_COMPAT == yes && ! -e $LOOP ]] && mknod -m0660 $LOOP b 7 ${LOOP//\/dev\/loop} > /dev/null
|
||||
|
||||
# TODO: Needs mknod here in Docker?
|
||||
losetup $LOOP $CACHEDIR/${SDCARD}.raw
|
||||
|
||||
# loop device was grabbed here, unlock
|
||||
flock -u $FD
|
||||
|
||||
partprobe $LOOP
|
||||
|
||||
# stage: create fs, mount partitions, create fstab
|
||||
|
|
|
@ -91,6 +91,10 @@ exit_with_error()
|
|||
display_alert "Process terminated" "" "info"
|
||||
# TODO: execute run_after_build here?
|
||||
overlayfs_wrapper "cleanup"
|
||||
# unlock loop device access in case of starvation
|
||||
exec {FD}>/var/lock/armbian-debootstrap-losetup
|
||||
losetup -u $FD
|
||||
|
||||
exit -1
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue