1 | 1 | simandl | #!/usr/bin/env perl |
2 | | | |
3 | | | # $Id: setup.pl,v 1.4 2004/07/12 07:50:14 bernisys Exp $ |
4 | | | |
5 | | | # include PERL libraries |
6 | | | use strict; |
7 | | | use warnings; |
8 | | | use diagnostics; |
9 | | | |
10 | | | # include HotSaNIC libraries |
11 | | | use lib "../../lib"; |
12 | | | use lib "./platform"; |
13 | | | use HotSaNICparser; |
14 | | | use HotSaNICshellio; |
15 | | | use HotSaNIClog; |
16 | | | use common; |
17 | | | |
18 | | | $|=1; |
19 | | | |
20 | | | (my $VERSION = '$Revision: 1.4 $') =~ s/.*(\d+\.\d+).*/$1/; |
21 | | | (my $IDENTIFIER = '$Id: setup.pl,v 1.4 2004/07/12 07:50:14 bernisys Exp $') =~ s/.*,v (.*) \$/$1/; |
22 | | | |
23 | | | my $MODNAME=HotSaNICparser::get_module_name(); |
24 | | | my %MODCONF=HotSaNICmod::common::configure(); |
25 | | | my $OUTFILE="settings.new"; |
26 | | | if ( ! -e "settings" ) { $OUTFILE="settings"; } |
27 | | | open OUTFILE,">$OUTFILE" || die "could not open ".HotSaNICparser::get_module_name()." settings file for writing.\n"; |
28 | | | |
29 | | | if (@{$MODCONF{HOST}}) { $MODCONF{HOST}="HOST=\"".join("\"\nHOST=\"",@{$MODCONF{HOST}})."\""; } |
30 | | | |
31 | | | print OUTFILE "# SHORT DESCRIPTION |
32 | | | # |
33 | | | # ntpd-client command |
34 | | | # |
35 | | | NTPCOMMAND=\"$MODCONF{NTPCOMMAND}\" |
36 | | | |
37 | | | # |
38 | | | # configure targets |
39 | | | # |
40 | | | # HOST=<host or IP>,<description> |
41 | | | # |
42 | | | # if you want to query the local host, just add: HOST=\",\" |
43 | | | # |
44 | | | $MODCONF{HOST} |
45 | | | "; |
46 | | | |
47 | | | close OUTFILE; |
48 | | | |
49 | | | if ($OUTFILE eq "settings.new") { |
50 | | | HotSaNICparser::backup_file("settings"); |
51 | | | rename "settings.new","settings"; |
52 | | | } |
53 | | | |
54 | | | print "Please check the settings file and adapt it to satisfy your needs.\n"; |
55 | | | |