2 # Copyright (C) 2006-2010 OpenWrt.org
3 # Copyright (C) 2010 Vertical Communications
6 /bin
/busybox mount
"$@"
10 local hook
="${1}_hook"
14 eval "$hook=\"\${$hook:+\${$hook}\${value:+\$sep}}\$value\""
19 for boot_func
in $
(eval "echo \"\$${1}_hook\""); do
25 local PART
="$(grep "\"$1\"" /proc/mtd | awk -F: '{print $1}')"
26 local PREFIX
=/dev
/mtdblock
29 [ -d /dev
/mtdblock
] && PREFIX
=/dev
/mtdblock
/
30 echo "${PART:+$PREFIX$PART}"
34 mtdpart
="$(find_mtd_part rootfs_data)"
35 [ -z "$mtdpart" ] && return 1
36 magic
=$
(hexdump $mtdpart -n 4 -e '4/1 "%02x"')
37 [ "$magic" != "deadc0de" ]
40 dupe
() { # <new_root> <old_root>
42 echo -n "creating directories... "
46 echo "./dev ./overlay ./mnt ./proc ./tmp"
47 # xdev skips mounted directories
52 echo -n "setting up symlinks... "
53 for file in $
(cd $2; find .
-xdev -type f
;); do
55 .
/rom
/note
) ;; #nothing
57 .
/usr
/lib
/opkg
/info
/*) cp -af $2/$file $file;;
58 *) ln -sf /rom
/${file#./*} $file;;
61 for file in $
(cd $2; find .
-xdev -type l
;); do
62 cp -af $2/${file#./*} $file
67 pivot
() { # <new_root> <old_root>
68 mount
-o move
/proc
$1/proc
&& \
69 pivot_root
$1 $1$2 && {
70 mount
-o move
$2/dev
/dev
71 mount
-o move
$2/tmp
/tmp
72 mount
-o move
$2/sys
/sys
2>&-
73 mount
-o move
$2/overlay
/overlay
2>&-
78 fopivot
() { # <rw_root> <ro_root> <dupe?>
81 if grep -q mini_fo
/proc
/filesystems
; then
82 mount
-t mini_fo
-o base
=/,sto
=$1 "mini_fo:$1" /mnt
2>&- && root
=/mnt
85 mount
--bind -o union
"$1" /mnt
&& root
=/mnt
89 mount |
grep "on $1 type" 2>&- 1>&- || mount
-o bind $1 $1
98 mount
-t tmpfs root
/tmp
/root
99 fopivot
/tmp
/root
/rom
1
This page took 0.049864 seconds and 5 git commands to generate.