Rev 18 | Blame | Last modification | View Log | RSS feed
#!/usr/bin/env perl
use warnings;
$main::VERSION = '1.0';
my %installedVersions;
my $thisDir = `pwd`;
chomp $thisDir;
my $targetDir = '/opt/camp/sysinfo-client';
my $modulesDir = $targetDir . '/modules';
my $scriptsDir = $targetDir . '/scripts';
my $confDir = '/etc/camp/sysinfo-client';
sub getVersion {
my $file = shift;
my $version .= `md5sum $file`;
chomp $version;
$version =~ m/^([a-f0-9]+)/;
$version = "$1\t";
$version .= `$file -v`;
chomp $version;
$installedVersions{$file} = $version;
}
# an extremely basic installer for sysinfo-client
for $dir ( $targetDir, $modulesDir, $scriptsDir, $confDir, $confDir . '/modules', $confDir . '/scripts' ) {
next if -d $dir;
`mkdir -p $dir`;
`chmod 0700 $dir`;
`chown root:root $dir`;
}
for $dir ( 'modules', 'scripts' ) {
`cp -av $dir $targetDir`;
`rm -fR $targetDir/$dir/.svn`;
`chmod 0700 $targetDir/$dir`;
if ( $dir eq 'scripts' ) {
`chmod -fR 0700 $targetDir/$dir/*`;
} else {
`chmod -fR 0600 $targetDir/$dir/*`;
}
`chown -fR root:root $targetDir/$dir`;
}
for $file ( 'sysinfo-client','notes', 'sysinfo-client.conf.template','configure.pl', 'uninstall.pl' ) {
`cp $file $targetDir`;
`chmod 0600 $targetDir/$file`;
`chown root:root $targetDir/$file`;
}
# Set permissions
for my $file ( "$targetDir/sysinfo-client", "$targetDir/configure.pl", "$targetDir/uninstall.pl" ) {
`chmod 0700 $file`;
&getVersion( $file );
}
open LOG, ">$targetDir/versions" or die "could not open $targetDir/versions for write: $!\n";
foreach my $file ( keys %installedVersions ) {
print LOG "$file\t$installedVersions{$file}\n";
}
close LOG;
exec( "$thisDir/configure.pl" );
# rm -fRv /opt/camp/sysinfo-client/ /etc/camp/modules/ /etc/camp/scripts/ /usr/local/bin/sysinfo-client
Generated by GNU Enscript 1.6.5.90.