/[vz-tools]/trunk/vz-create.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/vz-create.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 8 by dpavlin, Sun Jan 7 13:35:10 2007 UTC revision 10 by dpavlin, Sun Jan 7 23:25:19 2007 UTC
# Line 15  my $debian_mirror_uri = 'http://debian.c Line 15  my $debian_mirror_uri = 'http://debian.c
15  my $ve_total = 2;  my $ve_total = 2;
16  # swap size (Mb)  # swap size (Mb)
17  my $swap_size = 512;  my $swap_size = 512;
18    # diskspace
19    my $diskspace = '2G:4G';
20    
21  print "Creating new OpenVZ instance...\n";  print "Creating new OpenVZ instance...\n";
22    
23  my $arg = shift @ARGV;  my $arg = shift @ARGV || '';
24    
25  my ($hostname, $ip);  my ($hostname, $ip) = ('localhost','');
26    
27  if ($arg =~ m/$RE{net}{IPv4}/) {  if ($arg =~ m/$RE{net}{IPv4}/) {
28          $ip = $arg;          $ip = $arg;
29          chomp($hostname);          chomp($hostname);
30          $hostname = host($arg);          $hostname = host($arg);
31          $hostname =~ s/^.*\s(\S+)$/$1/;          $hostname =~ s/^.*\s(\S+)$/$1/;
32  } else {  } elsif ($arg) {
33          $hostname = $arg;          $hostname = $arg;
34          $ip = host($arg);          $ip = host($arg);
35          chomp($ip);          chomp($ip);
# Line 87  if (-e $conf_path) { Line 89  if (-e $conf_path) {
89          vzctl('set', $ve_id, '--applyconfig', 'vps.basic', '--save');          vzctl('set', $ve_id, '--applyconfig', 'vps.basic', '--save');
90          vzctl('set', $ve_id, '--ipadd', $ip, '--save');          vzctl('set', $ve_id, '--ipadd', $ip, '--save');
91          vzctl('set', $ve_id, '--hostname', $hostname, '--save');          vzctl('set', $ve_id, '--hostname', $hostname, '--save');
92            vzctl('set', $ve_id, '--diskspace', $diskspace, '--save');
93  }  }
94    
95  sub create_file {  sub create_file {
# Line 116  apt-get update Line 119  apt-get update
119  apt-get upgrade  apt-get upgrade
120    
121  # install additional packages  # install additional packages
122  apt-get -y install vim less ssh sudo screen  apt-get -y install vim less ssh sudo screen telnet finger
123    
124  # remove unwanted packages  # remove unwanted packages
125  apt-get -y remove nano  apt-get -y remove nano

Legend:
Removed from v.8  
changed lines
  Added in v.10

  ViewVC Help
Powered by ViewVC 1.1.26