125 lines
3.6 KiB
Plaintext
125 lines
3.6 KiB
Plaintext
$OpenBSD: patch-install_pl,v 1.5 2013/05/03 09:49:01 sthen Exp $
|
|
--- install.pl.orig Mon Jan 23 16:36:02 2012
|
|
+++ install.pl Fri May 3 10:43:46 2013
|
|
@@ -165,14 +165,14 @@ sub VerifyUser {
|
|
if ( !defined $gid_name ) {
|
|
die "Group '$user_gid' not found on this system\n";
|
|
}
|
|
- # Check the members list
|
|
- foreach my $member ( split /\s+/, $group_members ) {
|
|
- if ( $member eq $user ) {
|
|
+# # Check the members list
|
|
+# foreach my $member ( split /\s+/, $group_members ) {
|
|
+# if ( $member eq $user ) {
|
|
# user found
|
|
return $uid;
|
|
- }
|
|
- }
|
|
- die "User '$user' not a member of group '$NfConf::WWWGROUP'\n";
|
|
+# }
|
|
+# }
|
|
+# die "User '$user' not a member of group '$NfConf::WWWGROUP'\n";
|
|
|
|
} # End of VerifyUser
|
|
|
|
@@ -592,11 +592,11 @@ sub CopyAllFiles {
|
|
CopyRecursive::dircopy("plugins/backend", "$NfConf::INSTPREFIX$NfConf::BACKEND_PLUGINDIR");
|
|
CopyRecursive::dircopy("plugins/frontend", "$NfConf::INSTPREFIX$NfConf::FRONTEND_PLUGINDIR");
|
|
|
|
- if ( $ConfigFile eq "$NfConf::CONFDIR/nfsen.conf" ) {
|
|
+ if ( $ConfigFile eq "$NfConf::INSTPREFIX$NfConf::CONFDIR/nfsen.conf" ) {
|
|
print "Keep config file '$ConfigFile'\n";
|
|
} else {
|
|
print "Copy config file '$ConfigFile'\n";
|
|
- CopyRecursive::fcopy("$ConfigFile", "$NfConf::CONFDIR/nfsen.conf");
|
|
+ CopyRecursive::fcopy("$ConfigFile", "$NfConf::INSTPREFIX$NfConf::CONFDIR/nfsen.conf");
|
|
}
|
|
print "\n";
|
|
|
|
@@ -615,7 +615,7 @@ sub Cleanup {
|
|
);
|
|
|
|
foreach my $file ( @OldFiles ) {
|
|
- unlink $file if -f $file;
|
|
+# unlink $file if -f $file;
|
|
}
|
|
|
|
} # End of Cleanup
|
|
@@ -629,8 +629,13 @@ sub Cleanup {
|
|
$| = 1;
|
|
|
|
my $ConfigFile = shift @ARGV;
|
|
+my $mode = shift @ARGV;
|
|
+
|
|
+my $configure;
|
|
+my $copy;
|
|
+$configure=1 if $mode eq '';
|
|
+$copy=1 if $mode eq 'copy';
|
|
|
|
-
|
|
# Load the required NfSen modules
|
|
unshift @INC, "libexec";
|
|
print "Check for required Perl modules: ";
|
|
@@ -639,7 +644,6 @@ eval {
|
|
require RRDs; import RRDs;
|
|
require Mail::Header; import Mail::Header;
|
|
require Mail::Internet; import Mail::Internet;
|
|
- require Socket6; import Socket6;
|
|
};
|
|
if ( $@ ) {
|
|
print "Failed\nRequired nfsen modules not found\n";
|
|
@@ -701,7 +705,8 @@ print "Version: $nfsen_version: $VERSION\n\n";
|
|
|
|
# Get Perl
|
|
# Put this into a NfConf variable, so we can use the standard Patch Procedure
|
|
-$NfConf::PERL = GetPerl();
|
|
+#$NfConf::PERL = GetPerl();
|
|
+$NfConf::PERL = FindCommand("perl");
|
|
$NfConf::INSTPREFIX = $ENV{'INSTPREFIX'};
|
|
if ( defined $NfConf::INSTPREFIX ) {
|
|
if ( ! $NfConf::INSTPREFIX =~ /\/$/ ) {
|
|
@@ -715,7 +720,10 @@ if ( defined $NfConf::INSTPREFIX ) {
|
|
|
|
my ($nfsen_uid, $www_gid ) = VerifyConfig();
|
|
my $nfsen_run = 0;
|
|
+my $need_rrdlayout_upgrade = undef;
|
|
+my $rrdtool = undef;
|
|
|
|
+if ($configure) {
|
|
# test for two files of old layout
|
|
my $need_rrdlayout_upgrade = -f "$NfConf::PROFILESTATDIR/live/flows.rrd" && -f "$NfConf::PROFILESTATDIR/live/packets_other.rrd";
|
|
|
|
@@ -765,10 +773,14 @@ if ( -f "$NfConf::PIDDIR/$pid_name" ) {
|
|
}
|
|
}
|
|
}
|
|
+}
|
|
|
|
+if ($copy) {
|
|
SetupHTML($nfsen_uid, $www_gid);
|
|
CopyAllFiles($ConfigFile, $nfsen_uid, $www_gid);
|
|
PatchAllScripts();
|
|
+}
|
|
+if ($configure) {
|
|
Cleanup();
|
|
SetupEnv($nfsen_uid, $www_gid);
|
|
|
|
@@ -809,14 +821,17 @@ $$$hints{'version'} = $nfsen_version;
|
|
$$$hints{'installed'} = time();
|
|
NfSen::StoreHints();
|
|
chown $nfsen_uid, $www_gid, "$NfConf::INSTPREFIX$NfConf::PROFILESTATDIR/hints" || die "Can't chown hints db: $!\n";
|
|
+}
|
|
print "Setup done.\n\n";
|
|
|
|
+if ( $configure ) {
|
|
if ( $nfsen_run == 2 ) {
|
|
print "Restart NfSen\n";
|
|
system("$NfConf::BINDIR/nfsen start");
|
|
} elsif ( $nfsen_run == 1 ) {
|
|
print "Restart nfsend\n";
|
|
system("$NfConf::BINDIR/nfsend");
|
|
+}
|
|
}
|
|
|
|
print "* You may want to subscribe to the nfsen-discuss mailing list:\n";
|