xentaur
view files/xenomips-init @ 51:b9536e00100a
exec timeout 0
author | igor |
---|---|
date | Thu Oct 25 21:27:01 2007 +0300 (2007-10-25) |
parents | ab37f0ad70e5 |
children |
line source
1 #!/bin/sh
3 bind_mounts () {
4 # set defaults
5 test -z "$tmpfs_dir" && tmpfs_dir=/var/lib/xenomips
6 test -z "$rw_dirs" \
7 && rw_dirs="/var/cache/man /var/lock /var/run /var/log /var/spool /var/tmp /tmp /var/lib/urandom /var/lib/dhcp3 /tmp"
8 test -z "$copy_dirs" && copy_dirs=""
9 test -z "$temp_copy_dirs" && temp_copy_dirs="/var/cache/debconf"
10 test -z "$bindfiles" && bindfiles=""
11 mount -t tmpfs -o mode=0755 tmpfs $tmpfs_dir
12 # preserve directory structure
13 for d in $rw_dirs ; do
14 if [ -d "$d" ]; then
15 cd $tmpfs_dir
16 tar --no-recursion -cpf - $(find $d -type d 2> /dev/null) 2> /dev/null | tar xpf -
17 mount --bind $tmpfs_dir/$d $d
18 else
19 echo "WARNING: $d does not exist"
20 fi
21 done
22 # copy contents into tmpfs
23 for d in $copy_dirs $temp_copy_dirs; do
24 if [ -d "$d" ]; then
25 cd $tmpfs_dir
26 tar -cpf - $d 2> /dev/null | tar xpf -
27 mount --bind $tmpfs_dir/$d $d
28 else
29 echo "WARNING: $d does not exist"
30 fi
31 done
32 # mount one file on top of another
33 for f in $bindfiles ; do
34 if [ -e "$f" ]; then
35 mkdir -p "$(dirname $tmpfs_dir/$f)"
36 cp $f $tmpfs_dir/$f
37 mount --bind $tmpfs_dir/$f $f
38 else
39 echo "WARNING: $f does not exist"
40 fi
41 done
42 touch /var/log/dmesg
43 }
45 unbind_mounts() {
46 # FIXME
47 true
48 }
50 case $1 in
51 start)
52 bind_mounts
53 ;;
54 stop)
55 unbind_mounts
56 ;;
57 esac