Fix installing of FS progs with newer apk

See 37fbafcd92
This commit is contained in:
Jakub Jirutka 2019-08-14 23:06:36 +02:00
parent 1c5a181593
commit ed7a69d738

View file

@ -199,25 +199,15 @@ get_available_nbd() {
return 1 return 1
} }
# Installs tools in the host system needed for creating the specified filesystem. # Prints name of the package needed for creating the specified filesystem.
install_fs_tools() { fs_progs_pkg() {
local fs="$1" # filesystem name local fs="$1" # filesystem name
# We need load btrfs module early to avoid the error message:
# 'failed to open /dev/btrfs-control'
if ! grep -q -w "$fs" /proc/filesystems; then
modprobe $fs
fi
local pkg
case "$fs" in case "$fs" in
ext4) pkg='e2fsprogs';; ext4) echo 'e2fsprogs';;
btrfs) pkg='btrfs-progs';; btrfs) echo 'btrfs-progs';;
xfs) pkg='xfsprogs';; xfs) echo 'xfsprogs';;
*) die "Unsupported filesystem: $fs";;
esac esac
_apk add -t $VIRTUAL_PKG $pkg
} }
# Binds the directory $1 at the mountpoint $2 and sets propagation to private. # Binds the directory $1 at the mountpoint $2 and sets propagation to private.
@ -366,8 +356,12 @@ 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 # We need load btrfs module to avoid the error message:
install_fs_tools "$ROOTFS" # 'failed to open /dev/btrfs-control'
if ! grep -q -w "$ROOTFS" /proc/filesystems; then
modprobe $ROOTFS
fi
_apk add -t $VIRTUAL_PKG qemu qemu-img $(fs_progs_pkg "$ROOTFS")
fi fi
#----------------------------------------------------------------------- #-----------------------------------------------------------------------