wmirescue/stretch-amd64/bin/ramdisk_modules

28 lines
640 B
Plaintext
Raw Permalink Normal View History

2017-07-05 23:51:31 +02:00
#!/bin/sh
TARGET=$1
ROOTFS=$2
VERSION=$3
if [ ! -d "$TARGET" -o ! -d "$ROOTFS" ]; then
echo "Usage: $0 <ramdisk_dir> <rootfs_dir> <version>"
exit 255
fi
add_module() {
for kmod in $(modprobe --dirname=${ROOTFS} --set-version="$VERSION" --ignore-install --quiet --show-depends "$1" | awk '/^insmod/ { print $2 }'); do
path=$(realpath --relative-to ${ROOTFS} ${kmod})
if [ -e $TARGET/$path ]; then
continue
fi
mkdir -p $TARGET/$(dirname $path)
cp $kmod $TARGET/$(dirname $path)
done
}
echo "Loading modules..."
for i in loop squashfs overlay; do
add_module $i
done