manjaro-chroot: mount efivars

This commit is contained in:
udeved 2016-12-05 21:24:16 +01:00
parent 525195bccb
commit ea4ab8b5e0
2 changed files with 20 additions and 3 deletions

View file

@ -87,7 +87,7 @@ else
${pretend} && display_settings && exit 1 ${pretend} && display_settings && exit 1
chroot_api_mount "${chrootdir}" || die "failed to setup API filesystems in chroot %s" "${chrootdir}" chroot_api_efi_mount "${chrootdir}" || die "failed to setup API filesystems in chroot %s" "${chrootdir}"
chroot_mount /etc/resolv.conf "${chrootdir}/etc/resolv.conf" --bind chroot_mount /etc/resolv.conf "${chrootdir}/etc/resolv.conf" --bind
fi fi

View file

@ -108,8 +108,8 @@ chroot_mount_partitions(){
chroot_mount_conditional "! mountpoint -q '$1'" "$1" "$1" --bind && chroot_mount_conditional "! mountpoint -q '$1'" "$1" "$1" --bind &&
chroot_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev && chroot_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev &&
chroot_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro && chroot_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro &&
# ignore_error chroot_mount_conditional "[[ -d '$1/sys/firmware/efi/efivars' ]]" \ ignore_error chroot_mount_conditional "[[ -d '$1/sys/firmware/efi/efivars' ]]" \
# efivarfs "$1/sys/firmware/efi/efivars" -t efivarfs -o nosuid,noexec,nodev && efivarfs "$1/sys/firmware/efi/efivars" -t efivarfs -o nosuid,noexec,nodev &&
chroot_mount udev "$1/dev" -t devtmpfs -o mode=0755,nosuid && chroot_mount udev "$1/dev" -t devtmpfs -o mode=0755,nosuid &&
chroot_mount devpts "$1/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec && chroot_mount devpts "$1/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec &&
chroot_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev && chroot_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev &&
@ -130,6 +130,23 @@ chroot_mount_conditional() {
fi fi
} }
chroot_api_efi_mount() {
CHROOT_ACTIVE_MOUNTS=()
[[ $(trap -p EXIT) ]] && die 'Error! Attempting to overwrite existing EXIT trap'
trap 'chroot_api_efi_mount' EXIT
chroot_mount_conditional "! mountpoint -q '$1'" "$1" "$1" --bind &&
chroot_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev &&
chroot_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro &&
ignore_error chroot_mount_conditional "[[ -d '$1/sys/firmware/efi/efivars' ]]" \
efivarfs "$1/sys/firmware/efi/efivars" -t efivarfs -o nosuid,noexec,nodev &&
chroot_mount udev "$1/dev" -t devtmpfs -o mode=0755,nosuid &&
chroot_mount devpts "$1/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec &&
chroot_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev &&
chroot_mount run "$1/run" -t tmpfs -o nosuid,nodev,mode=0755 &&
chroot_mount tmp "$1/tmp" -t tmpfs -o mode=1777,strictatime,nodev,nosuid
}
chroot_api_mount() { chroot_api_mount() {
CHROOT_ACTIVE_MOUNTS=() CHROOT_ACTIVE_MOUNTS=()
[[ $(trap -p EXIT) ]] && die 'Error! Attempting to overwrite existing EXIT trap' [[ $(trap -p EXIT) ]] && die 'Error! Attempting to overwrite existing EXIT trap'