meta-google: google-usb-network: Fix cleanup routine
The sysfs directories are not a real filesystem and do not behave
correctly if you use `rm -r`. You need to directly remove the relevant
files and directories individually.
Currently the script cannot successfully cleanup the interface.
Change-Id: Ic7eb104fa6491347d24681ac45b4c0433ea07b23
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/meta-google/recipes-google/networking/google-usb-network/usb_network.sh b/meta-google/recipes-google/networking/google-usb-network/usb_network.sh
index a135465..4ab4634 100755
--- a/meta-google/recipes-google/networking/google-usb-network/usb_network.sh
+++ b/meta-google/recipes-google/networking/google-usb-network/usb_network.sh
@@ -96,11 +96,11 @@
gadget_stop() {
local gadget_dir="${CONFIGFS_HOME}/usb_gadget/${GADGET_DIR_NAME}"
rm -f ${gadget_dir}/configs/c.1/${DEV_TYPE}.${IFACE_NAME}
- rm -rf ${gadget_dir}/configs/c.1/strings/0x409
- rm -rf ${gadget_dir}/configs/c.1
- rm -rf ${gadget_dir}/strings/0x409
- rm -rf ${gadget_dir}/functions/${DEV_TYPE}.${IFACE_NAME}
- rm -rf ${gadget_dir}
+ rmdir ${gadget_dir}/functions/${DEV_TYPE}.${IFACE_NAME} \
+ ${gadget_dir}/configs/c.1/strings/0x409 \
+ ${gadget_dir}/configs/c.1 \
+ ${gadget_dir}/strings/0x409 \
+ ${gadget_dir} || true
rm -f /run/systemd/network/+-bmc-"${IFACE_NAME}".network
networkctl reload