xentaur

annotate files/xenomips-init @ 62:e838c1223b89

Делаются какие-то попытки интегрировать в Xentaur
управление разнообразными доменами.
author igor
date Thu Feb 21 21:41:20 2008 +0200 (2008-02-21)
parents ab37f0ad70e5
children
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@43 45 unbind_mounts() {
igor@43 46 # FIXME
igor@43 47 true
igor@43 48 }
igor@0 49
igor@43 50 case $1 in
igor@43 51 start)
igor@43 52 bind_mounts
igor@43 53 ;;
igor@43 54 stop)
igor@43 55 unbind_mounts
igor@43 56 ;;
igor@43 57 esac
igor@0 58