Added 'scrub-*' commands for securely scrubbing filesystems.
[libguestfs.git] / appliance / init
1 #!/bin/sh
2
3 echo Starting /init script ...
4
5 PATH=/sbin:/usr/sbin:$PATH
6
7 mount -t tmpfs none /dev
8 mkdir /dev/pts /dev/shm /dev/mapper
9 # Must do each MAKEDEV individually, because if one device fails,
10 # MAKEDEV will quit without creating the rest (RHBZ#507374).
11 for dev in mem null port zero core full ram tty console fd \
12   hda hdb hdc hdd sda sdb sdc sdd loop sd; do
13   MAKEDEV $dev ||:
14 done
15 mknod /dev/ptmx c 5 2;    chmod 0666 /dev/ptmx
16 mknod /dev/random c 1 8;  chmod 0666 /dev/random
17 mknod /dev/urandom c 1 9; chmod 0444 /dev/urandom
18
19 mount -t proc /proc /proc
20 mount -t sysfs /sys /sys
21 mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
22
23 ln -sf /proc/self/fd/0 /dev/stdin
24 ln -sf /proc/self/fd/1 /dev/stdout
25 ln -sf /proc/self/fd/2 /dev/stderr
26
27 modprobe virtio_pci
28 modprobe virtio_net
29 modprobe dm_mod ||:
30
31 /sbin/ifconfig lo 127.0.0.1
32 /sbin/ifconfig eth0 10.0.2.10
33 /sbin/route add default gw 10.0.2.2
34
35 lvm vgscan --ignorelockingfailure
36 lvm vgchange -ay --ignorelockingfailure
37
38 if grep -sq guestfs_rescue=1 /proc/cmdline; then
39   bash -i
40 fi
41 exec guestfsd -f