Finalize build script at fail
This commit is contained in:
parent
ff3eb8092c
commit
0017b11bfb
1 changed files with 9 additions and 8 deletions
17
build.sh
17
build.sh
|
@ -98,6 +98,15 @@ mount --bind /dev/pts "$ROOTFS_DIR/dev/pts"
|
|||
mount -t proc /proc "$ROOTFS_DIR/proc"
|
||||
mount --bind /sys "$ROOTFS_DIR/sys"
|
||||
|
||||
function finalize {
|
||||
umount "$ROOTFS_DIR/sys"
|
||||
umount "$ROOTFS_DIR/proc"
|
||||
umount "$ROOTFS_DIR/dev/pts"
|
||||
umount "$ROOTFS_DIR/dev"
|
||||
}
|
||||
|
||||
trap finalize EXIT
|
||||
|
||||
##
|
||||
# Add /etc/environment
|
||||
#
|
||||
|
@ -240,14 +249,6 @@ systemctl disable hwclock.sh
|
|||
fake-hwclock save
|
||||
EOF
|
||||
|
||||
##
|
||||
# Unmount virtual file systems.
|
||||
#
|
||||
umount "$ROOTFS_DIR/sys"
|
||||
umount "$ROOTFS_DIR/proc"
|
||||
umount "$ROOTFS_DIR/dev/pts"
|
||||
umount "$ROOTFS_DIR/dev"
|
||||
|
||||
##
|
||||
# Cleanup after Quilt patching.
|
||||
#
|
||||
|
|
Reference in a new issue