diff options
-rwxr-xr-x | initramfs/mkdxsinitrd | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/initramfs/mkdxsinitrd b/initramfs/mkdxsinitrd index e722a378..7e836af0 100755 --- a/initramfs/mkdxsinitrd +++ b/initramfs/mkdxsinitrd @@ -213,7 +213,18 @@ copy_distro_stuff() { find ${INSTDIR}/etc/sysconfig/files \ -regex ".*/\..*" -exec rm -rf {} 2>/dev/null \; } - +# copy kernel modules even if links (first parameter is source, second +# destination and third source prefix) +modcp () { +local tmpval +if [ -L $1 ] ; then + tmpval=$(ls -la $1) + tmpval=${tmpval#*-> } + cp $3/$tmpval $2 +else + cp $1 $2 +fi +} # This function makes the directory of this script to the present working # directory # Does also work when called by symbolic links (even for nested links). @@ -550,7 +561,8 @@ for module in af_packet unix ${NWMODULES} ${FSMODULES} ${MISCMODULES} \ if [ -n "$mod" ] ; then mpath=${INSTDIR}/${mod%/*} mkdir -p ${mpath} - cp ${ROOTDIR}/$mod ${mpath} + # specific function which can follow a link + modcp ${ROOTDIR}/$mod ${mpath} ${ROOTDIR} # fixmee!! selection of dependent modules could be handled a little bit # more clever rdirprefix="${ROOTDIR}/lib/modules/${KERNVER}/kernel" @@ -569,7 +581,8 @@ for module in af_packet unix ${NWMODULES} ${FSMODULES} ${MISCMODULES} \ mod=$(cd /${ROOTDIR}; find "lib/modules/${KERNVER}" \ -name ${module}.ko 2>/dev/null) mkdir -p ${INSTDIR}/${mod%/*} - cp ${ROOTDIR}/$mod ${INSTDIR}/${mod%/*} + # specific function which can follow a link + modcp ${ROOTDIR}/$mod ${INSTDIR}/${mod%/*} ${ROOTDIR} done ;; nfs) |