99_10_with_fo_cleanup 501 B

12345678910111213141516171819202122232425
  1. #!/bin/sh
  2. # Copyright (C) 2006-2010 OpenWrt.org
  3. # Copyright (C) 2010 Vertical Communications
  4. with_fo_cleanup() {
  5. # try to get rid of /tmp/root
  6. # this will almost always fail
  7. umount -l /tmp/root 2>&-
  8. grep -q overlay /proc/filesystems && {
  9. cd /
  10. (
  11. cd /overlay
  12. find -type l
  13. ) | while read FILE; do
  14. [ -z "$FILE" ] && break
  15. if ls -la "$FILE" 2>&- | grep -q '(overlay-whiteout)'; then
  16. rm -f "$FILE"
  17. fi
  18. done
  19. }
  20. exit 0
  21. }
  22. boot_hook_add switch2jffs with_fo_cleanup