3
# aufs sample -- diskless system
5
# Copyright (C) 2006, 2007 Junjiro Okajima
7
# This program, aufs is free software; you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 2 of the License, or
10
# (at your option) any later version.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with this program; if not, write to the Free Software
19
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
# $Id: linuxrc,v 1.5 2007/04/23 00:59:51 sfjro Exp $
25
trap "test \$? -ne 0 && sleep 3600" 0
29
mount -nt proc proc /proc
30
f=/proc/sys/kernel/printk
33
eval `bootpc | egrep '^(HOSTNAME|SERVER|BOOTFILE|DOMAIN|DNSSRVS)='`
34
test `cat /proc/sys/kernel/hostname` = $HOSTNAME
35
export HOSTNAME SERVER BOOTFILE
37
mount -t tmpfs tmp tmp
38
remote=`dirname $BOOTFILE`
39
for i in aufs.ko comount.sh exportfs.ko nfsd.ko
41
tftp -g $SERVER -r $remote/$i -l tmp/$i > /dev/null 2>&1
44
insmod tmp/exportfs.ko
46
insmod tmp/aufs.ko brs=1
48
eval `tr ' ' '\n' < /proc/cmdline | grep '^dl_label='`
49
sh tmp/comount.sh $dl_label
56
test -h $f || { echo domain $DOMAIN; echo nameserver $DNSSRVS; } > $f
58
#cat /proc/mounts; /bin/sh -i
59
echo 0x0100 > /proc/sys/kernel/real-root-dev
62
if [ "$initrd" = "initramfs.gz" ]
67
#mount -t tmpfs none aufs/branch
69
for i in branch/* branch/loop/*
71
test -d $i || continue
73
#/bin/mount -n --move $i aufs/$i || :
74
/bin/mount -n --move $i aufs/$i 2> /dev/null || :
78
/bin/mount -n --bind /tmp branch
79
mount -nt proc proc /proc
80
egrep -v ' (root|cram)fs ' /proc/mounts > etc/mtab
82
/bin/mount -n -o remount,ro aufsroot .
83
/bin/mount -n --move . /
84
test "$dl_label" = "knoppix" && mount -nt proc proc /proc
87
exec chroot . sbin/init < dev/console > dev/console 2>&1 dev/console
92
/initrd/bin/busybox mount -nt proc proc /proc
93
/initrd/bin/busybox egrep -v ' (root|cram)fs ' /proc/mounts > etc/mtab
94
/initrd/bin/busybox umount /proc
95
/initrd/bin/busybox mount -o remount,ro .