xentaur

diff files/xenomips-init @ 32:bf2d7c5bb340

dump try and catch
author igor
date Sat Sep 22 01:35:51 2007 +0300 (2007-09-22)
parents
children 61476759b5f1
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/files/xenomips-init	Sat Sep 22 01:35:51 2007 +0300
     1.3 @@ -0,0 +1,47 @@
     1.4 +#!/bin/sh
     1.5 +
     1.6 +bind_mounts () {
     1.7 +  # set defaults
     1.8 +  test -z "$tmpfs_dir" && tmpfs_dir=/var/lib/xenomips
     1.9 +  test -z "$rw_dirs" \
    1.10 +  && rw_dirs="/var/cache/man /var/lock /var/run /var/log /var/spool /var/tmp /tmp /var/lib/urandom /var/lib/dhcp3 /tmp"
    1.11 +  test -z "$copy_dirs" && copy_dirs=""
    1.12 +  test -z "$temp_copy_dirs" && temp_copy_dirs="/var/cache/debconf"
    1.13 +  test -z "$bindfiles" && bindfiles=""
    1.14 +  mount -t tmpfs -o mode=0755 tmpfs $tmpfs_dir
    1.15 +  # preserve directory structure
    1.16 +  for d in $rw_dirs ; do
    1.17 +    if [ -d "$d" ]; then
    1.18 +      cd $tmpfs_dir
    1.19 +      tar --no-recursion -cpf - $(find $d -type d 2> /dev/null) 2> /dev/null | tar xpf -
    1.20 +      mount --bind $tmpfs_dir/$d $d
    1.21 +    else
    1.22 +      echo "WARNING: $d does not exist"
    1.23 +    fi
    1.24 +  done  
    1.25 +  # copy contents into tmpfs
    1.26 +  for d in $copy_dirs $temp_copy_dirs; do
    1.27 +    if [ -d "$d" ]; then
    1.28 +      cd $tmpfs_dir
    1.29 +      tar -cpf - $d 2> /dev/null | tar xpf -
    1.30 +      mount --bind $tmpfs_dir/$d $d
    1.31 +    else
    1.32 +      echo "WARNING: $d does not exist"
    1.33 +    fi
    1.34 +  done
    1.35 +  # mount one file on top of another
    1.36 +  for f in $bindfiles ; do
    1.37 +    if [ -e "$f" ]; then
    1.38 +      mkdir -p "$(dirname $tmpfs_dir/$f)"
    1.39 +      cp $f $tmpfs_dir/$f
    1.40 +      mount --bind $tmpfs_dir/$f $f
    1.41 +    else
    1.42 +      echo "WARNING: $f does not exist"
    1.43 +    fi
    1.44 +  done
    1.45 +  touch /var/log/dmesg
    1.46 +}
    1.47 +
    1.48 +
    1.49 +bind_mounts
    1.50 +