Harald Hoyer
15 years ago
3 changed files with 65 additions and 0 deletions
@ -0,0 +1,47 @@
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash |
||||
|
||||
dd if=/dev/zero of=test/server.ext2 bs=1M count=20 |
||||
mke2fs -F test/server.ext2 |
||||
mkdir test/mnt |
||||
mount -o loop test/server.ext2 test/mnt |
||||
|
||||
initdir=test/mnt |
||||
kernel=$(uname -r) |
||||
( |
||||
. ./dracut-functions |
||||
dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \ |
||||
/lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient |
||||
inst "modules.d/40network/dhclient-script" "/sbin/dhclient-script" |
||||
inst "modules.d/40network/ifup" "/sbin/ifup" |
||||
dracut_install grep dnsmasq agetty strace tcpdump |
||||
inst test/server-init /sbin/init |
||||
(cd "$initdir"; |
||||
mkdir -p dev sys proc etc var/run tmp var/lib/dnsmasq |
||||
|
||||
cat > etc/hosts <<EOF |
||||
127.0.0.1 localhost |
||||
192.168.1.1 server |
||||
192.168.1.100 workstation1 |
||||
192.168.1.101 workstation2 |
||||
192.168.1.102 workstation3 |
||||
192.168.1.103 workstation4 |
||||
EOF |
||||
cat > etc/dnsmasq.conf <<EOF |
||||
expand-hosts |
||||
domain=test.net |
||||
dhcp-range=192.168.1.100,192.168.1.150,168h |
||||
dhcp-option=17,"192.168.1.1:/mnt/root" |
||||
EOF |
||||
) |
||||
inst /etc/nsswitch.conf /etc/nsswitch.conf |
||||
inst /etc/passwd /etc/passwd |
||||
inst /etc/group /etc/group |
||||
for i in /lib*/libnss_files*;do |
||||
inst_library $i |
||||
done |
||||
) |
||||
targetfs="$initdir" |
||||
unset initdir |
||||
|
||||
umount test/mnt |
||||
rm -fr test/mnt |
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh |
||||
export TERM=linux |
||||
export PS1='initramfs-test:\w\$ ' |
||||
[ -f /etc/fstab ] || ln -s /proc/mounts /etc/fstab |
||||
stty sane |
||||
echo "made it to the rootfs!" |
||||
echo 3 >/proc/sys/vm/drop_caches |
||||
free |
||||
if [ -x /usr/sbin/dnsmasq ]; then |
||||
ifconfig eth0 192.168.1.1 |
||||
route add -net 192.168.1.0/24 dev eth0 |
||||
/usr/sbin/dnsmasq |
||||
fi |
||||
/bin/sh -i |
||||
mount -n -o remount,ro / |
||||
poweroff -f |
||||
|
Loading…
Reference in new issue