2004-03-28 08:20:21 +08:00
|
|
|
#!/bin/sh
|
2004-05-04 17:42:46 +08:00
|
|
|
# $Id$
|
2004-03-28 08:20:21 +08:00
|
|
|
|
|
|
|
exec 2>/dev/null
|
|
|
|
|
|
|
|
umount /jffs
|
2004-05-04 17:42:46 +08:00
|
|
|
if [ -z "$(mount | grep jffs2)" ]; then
|
|
|
|
mtd erase OpenWrt
|
|
|
|
mount -t jffs2 /dev/mtdblock/4 /jffs
|
|
|
|
mount /dev/mtdblock/2 /rom -o ro
|
|
|
|
cd /jffs
|
|
|
|
else
|
2004-03-28 09:22:15 +08:00
|
|
|
echo "firstboot has already been run"
|
2004-05-04 17:42:46 +08:00
|
|
|
echo "fixing symlinks instead"
|
|
|
|
cd /
|
|
|
|
fi
|
2004-03-28 09:22:15 +08:00
|
|
|
|
2004-03-28 08:20:21 +08:00
|
|
|
{
|
|
|
|
cd /rom
|
|
|
|
find . -type d
|
2004-05-04 17:42:46 +08:00
|
|
|
cd -
|
2004-03-28 08:20:21 +08:00
|
|
|
} | xargs mkdir
|
|
|
|
|
|
|
|
for file in $(cd /rom; find * -type f; find * -type l;)
|
|
|
|
do {
|
|
|
|
ln -sf /rom/$file $file
|
|
|
|
} done
|
|
|
|
|
|
|
|
touch /tmp/resolv.conf
|
|
|
|
ln -s /tmp/resolv.conf /etc/resolv.conf
|
|
|
|
|
|
|
|
umount /rom
|
|
|
|
mount none /jffs/proc -t proc
|
|
|
|
pivot_root /jffs /jffs/rom
|
|
|
|
mount none /dev -t devfs
|
|
|
|
mount none /tmp -t ramfs
|
|
|
|
umount /rom/proc
|
|
|
|
umount /rom/tmp
|
|
|
|
umount /rom/dev
|