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