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
84 FLINUX="RedHat" #Redhat family distribution
89 FLINUX="Debian" #Debian family distribution
92 abort "Unknown Linux distribution, exiting"
96 #===================================================================
97 #extracting node ip number
98 IPNUM=`dig +short $VSR | grep -v [a-z]`
99 if [ -z "$IPNUM" ] ; then
100 abort "No IP number found for $VSR hostname"
102 #-------------------------------------------------------------------
103 #lets create the node file system
105 vzgot create $NODENAME $TPL $DISTRIB $CPUARCH
107 if [ $RETVAL -ne 0 ] ; then
108 abort "Unable to create $NODENAME root file system"
110 #-------------------------------------------------------------------
111 #lets do the node first boot
112 vzgot firstboot -D $FLINUX -i $IPNUM -d $DOMAIN -n $NODENAME $NODENAME
114 if [ $RETVAL -ne 0 ] ; then
115 abort "Unable to do $NODENAME first boot"
117 #-------------------------------------------------------------------
121 if [ $RETVAL -ne 0 ] ; then
122 abort "Unable to boot $NODENAME"
125 echo "$NODENAME is now installed and 'up and running'"
126 #===================================================================