--- trunk/vz-create.pl 2007/04/16 20:37:13 17 +++ trunk/vz-create.pl 2007/12/13 23:50:47 35 @@ -10,7 +10,7 @@ # default debian distribution my $dist = 'etch'; # debian mirror to use -my $debian_mirror_uri = 'http://debian.carnet.hr/debian'; +my $debian_mirror_uri = 'http://www.debian.org/debian'; # split physicial machine in how meny virtual ones? my $ve_total = 4; # swap size (Mb) @@ -18,6 +18,16 @@ # diskspace my $diskspace = '2G:4G'; +my $config_file = $0; +$config_file =~ s!-create.pl!-tools.conf!; +warn "## $config_file\n"; +if (-e $config_file) { + open(my $fh, '<', $config_file) || die "can't open $config_file: $!"; + eval join("\n", <$fh>); + close($fh); + die "Error in $config_file: $@" if ($@); +} + print "Creating new OpenVZ instance...\n"; my $arg = shift @ARGV || ''; @@ -33,7 +43,7 @@ $hostname = $arg; $ip = host($arg); chomp($ip); - $ip =~ s/^.*\s(\S+)$/$1/; + $ip =~ s/^.*?$RE{net}{IPv4}{-keep}.*$/$1/s; } $ip ||= prompt('Enter IP: ', -require => { @@ -56,7 +66,7 @@ mkdir('-p', "$vz_root/root/$ve_id", "$vz_root/private/$ve_id"); -warn ">> installing debian\n"; +warn ">> installing debian $dist from $debian_mirror_uri\n"; if (! -e "$vz_root/private/$ve_id/etc/debian_version") { @@ -119,7 +129,7 @@ apt-get -y upgrade # install additional packages -apt-get -y install vim less ssh sudo screen telnet finger +apt-get -y --force-yes install vim less ssh sudo screen telnet finger # remove unwanted packages apt-get -y remove nano