Fixed bug in chroot mount preparation (--rslave not occurring)

This commit is contained in:
oddlama 2020-01-04 18:33:41 +01:00
parent 065546debf
commit 7deede64eb
No known key found for this signature in database
GPG Key ID: 88EA325D51D53908
3 changed files with 19 additions and 13 deletions

View File

@ -20,6 +20,8 @@ What you can get optionally:
* LUKS
* EFI secure boot
* Initramfs (compiled into the kernel for EFIstub)
* Preconfigured sshd
* Ansible (packages, user, ssh)
What you will **NOT** get: (i.e. you will have to do it yourself)

View File

@ -240,7 +240,7 @@ download_stage3() {
|| die "Checksum mismatch!"
# Create verification file in case the script is restarted
touch_or_die "$CURRENT_STAGE3_VERIFIED"
touch_or_die 0644 "$CURRENT_STAGE3_VERIFIED"
fi
}
@ -287,16 +287,18 @@ env_update() {
|| die "Error in env-update"
source /etc/profile \
|| die "Could not source /etc/profile"
umask 0077
}
mkdir_or_die() {
mkdir -p "$1" \
|| die "Could not create directory '$1'"
mkdir -m "$1" -p "$2" \
|| die "Could not create directory '$2'"
}
touch_or_die() {
touch "$1" \
|| die "Could not touch '$1'"
touch "$2" \
|| die "Could not touch '$2'"
chmod "$1" "$2"
}
gentoo_chroot() {
@ -321,10 +323,12 @@ gentoo_chroot() {
(
mountpoint -q -- "$ROOT_MOUNTPOINT/proc" || mount -t proc /proc "$ROOT_MOUNTPOINT/proc" || exit 1
mountpoint -q -- "$ROOT_MOUNTPOINT/tmp" || mount --rbind /tmp "$ROOT_MOUNTPOINT/tmp" || exit 1
mountpoint -q -- "$ROOT_MOUNTPOINT/sys" || mount --rbind /sys "$ROOT_MOUNTPOINT/sys" || exit 1
mountpoint -q -- "$ROOT_MOUNTPOINT/sys" || mount --make-rslave "$ROOT_MOUNTPOINT/sys" || exit 1
mountpoint -q -- "$ROOT_MOUNTPOINT/dev" || mount --rbind /dev "$ROOT_MOUNTPOINT/dev" || exit 1
mountpoint -q -- "$ROOT_MOUNTPOINT/dev" || mount --make-rslave "$ROOT_MOUNTPOINT/dev" || exit 1
mountpoint -q -- "$ROOT_MOUNTPOINT/sys" || {
mount --rbind /sys "$ROOT_MOUNTPOINT/sys" &&
mount --make-rslave "$ROOT_MOUNTPOINT/sys"; } || exit 1
mountpoint -q -- "$ROOT_MOUNTPOINT/dev" || {
mount --rbind /dev "$ROOT_MOUNTPOINT/dev" &&
mount --make-rslave "$ROOT_MOUNTPOINT/dev"; } || exit 1
) || die "Could not mount virtual filesystems"
# Execute command

View File

@ -89,10 +89,10 @@ main_install_gentoo_in_chroot() {
env_update
# Prepare /etc/portage for autounmask
mkdir_or_die "/etc/portage/package.use"
touch_or_die "/etc/portage/package.use/zz-autounmask"
mkdir_or_die "/etc/portage/package.keywords"
touch_or_die "/etc/portage/package.keywords/zz-autounmask"
mkdir_or_die 0755 "/etc/portage/package.use"
touch_or_die 0644 "/etc/portage/package.use/zz-autounmask"
mkdir_or_die 0755 "/etc/portage/package.keywords"
touch_or_die 0644 "/etc/portage/package.keywords/zz-autounmask"
# Install git (for git portage overlays)
einfo "Installing git"