Run "extlinux --install" inside chroot, not on host

This commit is contained in:
Jakub Jirutka 2017-10-11 19:22:46 +02:00
parent 61790283f5
commit fa87e36f9c
2 changed files with 5 additions and 5 deletions

View file

@ -15,7 +15,7 @@ This project provides script for making customizable Alpine Linux disk image for
* Alpine Linux (you can use https://github.com/alpinelinux/alpine-chroot-install[alpine-chroot-install] to easily install Alpine on any Linux system) * Alpine Linux (you can use https://github.com/alpinelinux/alpine-chroot-install[alpine-chroot-install] to easily install Alpine on any Linux system)
* POSIX-sh compatible shell (e.g. Busybox ash, dash, Bash, ZSH) * POSIX-sh compatible shell (e.g. Busybox ash, dash, Bash, ZSH)
* qemu-img, qemu-nbd, and syslinux (automatically installed by the script) * qemu-img and qemu-nbd (automatically installed by the script)
* e2fsprogs (for ext4), btrfs-progs (for Btrfs), or xfsprogs (for XFS) (automatically installed by the script) * e2fsprogs (for ext4), btrfs-progs (for Btrfs), or xfsprogs (for XFS) (automatically installed by the script)

View file

@ -6,8 +6,8 @@
# This script creates a bootable Alpine Linux disk image for virtual machines. # This script creates a bootable Alpine Linux disk image for virtual machines.
# If running on Alpine system (detected by file /etc/alpine-release), then it # If running on Alpine system (detected by file /etc/alpine-release), then it
# also installs needed packages on the host system. On other systems you must # also installs needed packages on the host system. On other systems you must
# install them yourself: qemu-img, qemu-nbd, syslinux, and mkfs utility for the # install them yourself: qemu-img, qemu-nbd, and mkfs utility for the chosen
# chosen ROOTFS. # ROOTFS.
# #
# Note that it does not create any partitions (it's really not needed), # Note that it does not create any partitions (it's really not needed),
# filesystem is created directly on the image. # filesystem is created directly on the image.
@ -203,7 +203,7 @@ setup_extlinux() {
-e "s|^[# ]*(default)=.*|\1=$default_kernel|" \ -e "s|^[# ]*(default)=.*|\1=$default_kernel|" \
"$mnt"/etc/update-extlinux.conf "$mnt"/etc/update-extlinux.conf
extlinux --install "$mnt"/boot chroot "$mnt" extlinux --install /boot
chroot "$mnt" update-extlinux --warn-only 2>&1 \ chroot "$mnt" update-extlinux --warn-only 2>&1 \
| grep -Fv 'extlinux: cannot open device /dev' >&2 | grep -Fv 'extlinux: cannot open device /dev' >&2
} }
@ -288,7 +288,7 @@ SCRIPT=
if [ "$INSTALL_HOST_PKGS" = yes ]; then if [ "$INSTALL_HOST_PKGS" = yes ]; then
einfo 'Installing needed packages on host system' einfo 'Installing needed packages on host system'
_apk add -t $VIRTUAL_PKG qemu qemu-img syslinux _apk add -t $VIRTUAL_PKG qemu qemu-img
install_fs_tools "$ROOTFS" install_fs_tools "$ROOTFS"
fi fi