From d9ce041237cb88b5d278d925b4ef27510c344ecc Mon Sep 17 00:00:00 2001 From: Nisha Agarwal Date: Sun, 6 Sep 2015 22:52:16 -0700 Subject: [PATCH] Prevent overwriting of user modified blacklist.conf The ramdisk-functions overwrites user modified /etc/modprobe.d/blacklist.conf with a single entry "blacklist evbug". Due to this, ramdisk fails to recognise the hardware/disks etc for which user has modified /etc/modprobe.d/blacklist.conf. The commit enables copying all the *.conf files under /etc/modprobe.d to the ramdisk. It creates a config file /etc/modprobe.d/blacklist-dib-ramdisk.conf instead of overwriting /etc/modprobe.d/blacklist.conf. Closes bug: #1492804 Change-Id: Ib88272e4b8f4641c58e7e68bb0c2e4b82efc4fc1 --- lib/ramdisk-functions | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/ramdisk-functions b/lib/ramdisk-functions index 95881f3f1..7d8c24572 100644 --- a/lib/ramdisk-functions +++ b/lib/ramdisk-functions @@ -66,7 +66,12 @@ function create_ramdisk_base () { fi mkdir -p "$TMP_MOUNT_PATH/etc/modprobe.d" - echo "blacklist evbug" > "$TMP_MOUNT_PATH/etc/modprobe.d/blacklist.conf" + # The directory may or may not exist in the image. If the directory exists in + # the image, all the files under it should get copied to the ramdisk. + if [ -d "/etc/modprobe.d/" ] ; then + find /etc/modprobe.d -name '*.conf' -type f -exec cp -a {} "$TMP_MOUNT_PATH/etc/modprobe.d" \; + fi + echo "blacklist evbug" > "$TMP_MOUNT_PATH/etc/modprobe.d/blacklist-dib-ramdisk.conf" # cjk adding for hwdiscovery support touch "$TMP_MOUNT_PATH/etc/fstab"