summarylogtreecommitdiffstats
path: root/99-remove_links
diff options
context:
space:
mode:
Diffstat (limited to '99-remove_links')
-rw-r--r--99-remove_links8
1 files changed, 1 insertions, 7 deletions
diff --git a/99-remove_links b/99-remove_links
index b78ddfd00ae2..cbabd1cdb23d 100644
--- a/99-remove_links
+++ b/99-remove_links
@@ -1,7 +1 @@
-if [[ $DEVNAME ]]; then
- for lnk in $(find /dev -type l -exec ls -al {} \; | grep /dev/$DEVNAME); do
- if [[ $(echo $lnk | awk '{print $11}') == /dev/$DEVNAME ]]; then
- rm -f $(echo $lnk | awk '{print $9}')
- fi
- done
-fi
+[ "$DEVNAME" ] && find /dev -type l -exec sh -c 'for i in "$@"; do [ "$0" = "$(realpath -- "$i")" ] && rm -f -- "$i"; done' "/dev/$DEVNAME" {} +