#!/usr/bin/env perl # $Id: setup.pl,v 1.8 2004/07/12 07:50:15 bernisys Exp $ # include PERL libraries use strict; use warnings; use diagnostics; # include HotSaNIC libraries use lib "../../lib"; use lib "./platform"; use HotSaNICparser; use HotSaNICshellio; use HotSaNIClog; use common; $|=1; (my $VERSION = '$Revision: 1.8 $') =~ s/.*(\d+\.\d+).*/$1/; (my $IDENTIFIER = '$Id: setup.pl,v 1.8 2004/07/12 07:50:15 bernisys Exp $') =~ s/.*,v (.*) \$/$1/; my $MODNAME=HotSaNICparser::get_module_name(); my %MODCONF=HotSaNICmod::common::configure(); my $OUTFILE="settings.new"; if ( ! -e "settings" ) { $OUTFILE="settings"; } open OUTFILE,">$OUTFILE" || die "could not open ".HotSaNICparser::get_module_name()." settings file for writing.\n"; if (! @{$MODCONF{DRIVE}}) { @{$MODCONF{DRIVE}}=get_drives(); } if (@{$MODCONF{DRIVE}}) { $MODCONF{DRIVE}="DRIVE=\"".join("\"\nDRIVE=\"",@{$MODCONF{DRIVE}})."\""; } else { $MODCONF{DRIVE}=""; } print OUTFILE "# SHORT DESCRIPTION # # You may configure partitions you would like to monitor. # multiple lines are of course allowed. # # for a local drive enter: # DRIVE=, # # for a remote (e.g. NFS or SNMP) drive enter: # DRIVE=:, # DRIVE=SNMP:::, # # Note: Make sure you have no '_' in host or community # when using SNMP. # $MODCONF{DRIVE} "; close OUTFILE; if ($OUTFILE eq "settings.new") { HotSaNICparser::backup_file("settings"); rename "settings.new","settings"; } print "Please check the settings file and adapt it to satisfy your needs.\n"; sub get_drives { my @drives=(); open RESULT,"df -a|"; $_=; #strip header line my $lastfs=""; while () { chomp; my($fs,$size,undef,undef,$mp1,$mountpoint)=split; if (!defined $mountpoint) { if (!defined $mp1) { $lastfs=$fs; next; } else { $size=$fs; $fs=$lastfs; $mountpoint=$mp1; } } if ( ($fs ne "none") and ($size > 0) ) { $mountpoint ="root filesystem" if $mountpoint eq "/"; my $result=HotSaNICshellio::askyesno("Use \"$fs\", mounted on \"$mountpoint\"","n"); push @drives,"$fs,$mountpoint" if $result eq "y"; } } close RESULT; return @drives; } WebSVN - hotsanic - Blame - Rev 5 - /branches/HotSaNIC-0.5.0-pre6/modules/part/setup.pl
  jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-pre6/] [modules/] [part/] [setup.pl] - Blame information for rev 5

 

Line No. Rev Author Line

Powered by WebSVN 2.2.1