Inserting VZGOT development tree within GIT
[safe/jmp/vzgot] / shell / vzgot.fboot
1 #! /bin/sh
2 #----------------------------------------------------
3 #shell used to prepare container struture, this script
4 #is called by the vzgot before any root pivot action.
5 #It is used on the firstboot to prepare all needed file.
6 #or restructure container.
7 #
8 #----------------------------------------------------
9 #Syntaxe
10 #vzgot.fistboot VE_name VE_pid Distrib domain node name ip_list [Base]
11 #       VE_name is the container dir name
12 #       Linux family (RedHat...)
13 #       Domain is the container domainname 
14 #       Node is the container hostname
15 #       IP_LIST is an ip list (ip,ip1,ip2,..) used
16 #               to prepare container network
17 #       base_dir is this application root directory
18 #               (used for devel only).
19 #----------------------------------------------------
20 CONTNAME=$1
21 FLINUX=$2
22 DOMAIN=$3
23 NODE=$4
24 LSTIP=$5
25 BASE=$6
26 #----------------------------------------------------
27 if ! [ -f $BASE/etc/vzgot/vzgot_config ] ; then
28   echo "Missing vzgot config file"
29   exit 1        #trouble trouble
30   fi
31 . $BASE/etc/vzgot/vzgot_config
32
33 #specific container configuration override (if needed)
34 if [ -f $BASE/$VZLIB/vzdir/$CONTNAME/vzgot_config ] ; then
35   $BASE/$VZLIB/vzdir/$CONTNAME/vzgot_config
36   fi
37
38 #====================================================
39 #Main script
40
41 #setting linux family in configuration file
42 echo "$FLINUX" > $BASE/$VZLIB/vzdir/$CONTNAME/linux
43
44 case "$FLINUX" in
45   "RedHat"      )
46      $BASE/$VZLIB/shell/vzgot.fboot.redhat      \
47                 $CONTNAME $NODE $DOMAIN $LSTIP $BASE
48     ;;
49   "Debian"      )
50      $BASE/$VZLIB/shell/vzgot.fboot.debian      \
51                 $CONTNAME $NODE $DOMAIN $LSTIP $BASE
52     ;;
53   "*"           )
54     /bin/echo "<"$FLINUX"> not yet an implemented linux family"
55     exit 1;
56     ;;
57   esac
58 #----------------------------------------------------
59 #setting the container status to "ON"
60 #used by /etc/init.d/vzgot when hot is booting
61 echo "BOOT=ON"  > $BASE/$VZLIB/vzdir/$CONTNAME/status
62 #----------------------------------------------------
63 exit 0