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