xentaur

view files/xenomips-init @ 24:fcd08a4f3216

reconnect and show
author igor
date Fri Sep 21 16:19:12 2007 +0300 (2007-09-21)
parents
children 61476759b5f1
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 }
46 bind_mounts