3 #-------------------------------------------------------------------
4 #procedure to install a specific VZserver
5 #$1 is the vserver node name (will become nodename.your_domain.name)
6 #-------------------------------------------------------------------
10 #===================================================================
11 #setting default distribution and Architecture.
14 #===================================================================
15 #defining default template name
16 #you can modify it according your own template setup name rule
17 TPL=linux-$DISTRIB-$CPUARCH-vzserver.tar.gz
18 #===================================================================
23 LOCKFILE=/var/lock/`basename $0`.$1.lck
25 trap "rm -f $LOCKFILE ; exit 1" 1 2 3 15
26 if (set -C; : > $LOCKFILE) 2> /dev/null ; then
29 echo "Another '`basename $0` $1' is running, existing at once!"
30 echo "remove $LOCKFILE, if it is not the case"
35 #-------------------------------------------------------------------
45 #===================================================================
48 #locking building process
50 #===================================================================
51 #getting all the needed information from the vzgot_list file
52 sed 's/#.*//g' /etc/vzgot/vzgot_list | \
53 grep -v '^[[:space:]]*$' | \
55 while read -r NODE TEMPLATE DISTRIB CPUARCH
85 FLINUX="RedHat" #Redhat family distribution
90 FLINUX="Debian" #Debian family distribution
93 abort "Unknown Linux distribution, exiting"
97 #===================================================================
98 #extracting node ip number
99 IPNUM=`dig +short $VSR | grep -v [a-z]`
100 if [ -z "$IPNUM" ] ; then
101 abort "No IP number found for $VSR hostname"
103 #-------------------------------------------------------------------
104 #lets create the node file system
106 vzgot create $NODENAME $TPL $DISTRIB $CPUARCH
108 if [ $RETVAL -ne 0 ] ; then
109 abort "Unable to create $NODENAME root file system"
111 #-------------------------------------------------------------------
112 #lets do the node first boot
113 vzgot firstboot -D $FLINUX -i $IPNUM -d $DOMAIN -n $NODENAME $NODENAME
115 if [ $RETVAL -ne 0 ] ; then
116 abort "Unable to do $NODENAME first boot"
118 #-------------------------------------------------------------------
122 if [ $RETVAL -ne 0 ] ; then
123 abort "Unable to boot $NODENAME"
126 echo "$NODENAME is now installed and 'up and running'"
127 #===================================================================