1 | 10 | simandl | #!/usr/bin/env perl |
2 | | | |
3 | | | use warnings; |
4 | | | use diagnostics; |
5 | | | |
6 | | | use lib "../../lib"; |
7 | | | use HotSaNICparser; |
8 | | | use HotSaNICshellio; |
9 | | | |
10 | | | my @CONFmod=HotSaNICparser::read_settings(".",$MODNAME); |
11 | | | |
12 | | | if ( ! -e "settings" ) { $OUTFILE="settings"; } else { $OUTFILE="settings.new"; } |
13 | | | |
14 | | | open OUTFILE,">$OUTFILE" || die "could not open $MODNAME settings file for writing.\n"; |
15 | | | |
16 | | | print OUTFILE "# SHORT DESCRIPTION |
17 | | | # |
18 | | | # define path to the apc access tool including the cmdline option |
19 | | | # to retrieve the status protocol |
20 | | | # |
21 | | | # Example: |
22 | | | # APCACCESS=/usr/local/bin/apcaccess status |
23 | | | # |
24 | | | "; |
25 | | | |
26 | | | if ($OUTFILE eq "settings.new") { |
27 | | | for (@CONFmod) { print OUTFILE $_,"\n" if /^APCACCESS *=/; } |
28 | | | } |
29 | | | else { |
30 | | | my @found=HotSaNICparser::locate_files("apcaccess"); |
31 | | | my $file=HotSaNICshellio::choose("","apcaccess could not be found.",@found); |
32 | | | print OUTFILE "APCACCESS=$file\n" |
33 | | | } |
34 | | | |
35 | | | close OUTFILE; |
36 | | | |
37 | | | if ($OUTFILE eq "settings.new") { |
38 | | | HotSaNICparser::backup_file("settings"); |
39 | | | rename "settings.new","settings"; |
40 | | | } |
41 | | | |
42 | | | print "Please check the settings file and adapt it to satisfy your needs.\n"; |
43 | | | |