common: auto-register api_fs_umount EXIT trap

This corrects some weird/wrong EXIT trap decls in arch-chroot and
pacstrap that should have been touched as part of the cleanup in
517fcff074.
This commit is contained in:
Dave Reisner 2013-05-23 11:56:40 -04:00
parent 99e6b07ab3
commit 1d35997222
3 changed files with 1 additions and 5 deletions

View File

@ -26,8 +26,6 @@ shift
[[ -d $chrootdir ]] || die "Can't create chroot on non-directory %s" "$chrootdir"
trap '{ api_fs_umount "$chrootdir"; umount "$chrootdir/etc/resolv.conf"; } 2>/dev/null' EXIT
api_fs_mount "$chrootdir" || die "failed to setup API filesystems in chroot %s" "$chrootdir"
track_mount /etc/resolv.conf "$chrootdir/etc/resolv.conf" --bind

1
common
View File

@ -17,6 +17,7 @@ track_mount() {
api_fs_mount() {
CHROOT_ACTIVE_MOUNTS=()
trap 'api_fs_umount' EXIT
{ mountpoint -q "$1" || track_mount "$1" "$1" --bind; } &&
track_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev &&
track_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev &&

View File

@ -101,9 +101,6 @@ mkdir -m 0755 -p "$newroot"/var/{cache/pacman/pkg,lib/pacman,log} "$newroot"/{de
mkdir -m 1777 -p "$newroot"/tmp
mkdir -m 0555 -p "$newroot"/{sys,proc}
# always call umount on quit after this point
trap 'api_fs_umount "$newroot" 2>/dev/null' EXIT
# mount API filesystems
api_fs_mount "$newroot" || die "failed to setup API filesystems in new root"