MOBY
view release on metacpan or search on metacpan
bin/scripts/moby-s-install.pl view on Meta::CPAN
say($msg);
return (
$username, $password, $url,
$port, $m_object, $m_relationship,
$m_service, $m_namespace, $m_central,
$moby_username, $moby_password
);
}
sub fill_out_moby_conf {
my (
$file, $username, $password, $url,
$port, $m_object, $m_relationship, $m_service,
$m_namespace, $m_central
)
= @_;
# load & fill the template file
config_file_from_template(
$file,
File::ShareDir::dist_file(
'MOBY', 'config/mobycentral.config.template'
),
'MOBY/SQL Configuration file',
# mysql settings
{
'username' => $username,
'password' => $password,
'url' => $url,
'port' => $port,
},
# db section mappings
{
'mobycentral' => $m_central,
'mobyobject' => $m_object,
'mobynamespace' => $m_namespace,
'mobyservice' => $m_service,
'mobyrelationship' => $m_relationship,
},
{},
{}
);
# since the file contains the root DB password
# make it only readable by root
chmod 0644, $file;
die "Couldn't make MOBY config file readable only by root: $!"
if $?;
# finished!
return;
}
sub check_root {
# assume that windows has no security preventing the copying of files
return if MSWIN;
unless (getpwuid($<) eq 'root') {
print STDOUT <<EOT;
Hmmm - you are not installing this as root. If you indicate any
system directories for the installation, such as '/usr/local', then
you do not have permission to install files there. If so, you should
cancel now with ^C, su to root, and restart.
If you will not specify any system directories, you can proceed.
EOT
print STDOUT "Should I proceed? [n] ";
my $tmp = <STDIN>; $tmp =~ s/\s//g;
exit() unless $tmp =~ /y/i;
} else {
print STDOUT <<EOT;
Take care! you are installing this as ** root **. Please take the normal
precautions that you would ordinarily take when installing software as root.
In particular, be careful with ownership, paths, and environment variables.
EOT
}
}
# --- main ---
no warnings 'once';
use Tie::File;
use MOBY::dbConfig;
use MOBY::Client::Central;
use File::Temp qw/ tempfile /;
use DBI;
# give a waring if we are not running with su privelege
check_root();
say "Installing a mobycentral registry ...\n";
my $answer;
my $apache_base = "";
my $apache_conf = "";
my $apache_cgi = "";
my $perl_exec = "/usr/bin/perl";
# make sure perl exists
if (not -x $perl_exec) {
$perl_exec = '';
}
# check for debian
if (-e "/etc/debian_version") {
$apache_base = "/var/lib";
$apache_conf = "/etc/apache2";
$apache_cgi = "/usr/lib/cgi-bin";
}
my (
( run in 0.887 second using v1.01-cache-2.11-cpan-39bf76dae61 )