3 # Display heartbeat option categories
5 require './heartbeat-lib.pl';
7 # Try to work out the version number
8 $heartbeat_version = undef;
9 if ($config{'version'}) {
10 $heartbeat_version = $config{'version'};
12 elsif (&backquote_command("($config{'heartbeat'} -V) </dev/null 2>&1") =~
14 $heartbeat_version = $1;
16 elsif (&foreign_check("software")) {
17 &foreign_require("software", "software-lib.pl");
18 local @pinfo = &software::package_info("heartbeat");
20 $heartbeat_version = $pinfo[4];
21 $heartbeat_version =~ s/-.*$//;
24 &open_tempfile(VERSION, ">$module_config_directory/version");
25 &print_tempfile(VERSION, $heartbeat_version,"\n");
26 &close_tempfile(VERSION);
28 &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0,
29 &help_search_link("heartbeat", "man", "doc"),
30 undef, undef, $heartbeat_version ? &text('index_version',
31 $heartbeat_version) : undef);
33 # Check if heartbeat is installed
34 if (!-d $config{'ha_dir'}) {
35 print &text('index_edir', "<tt>$config{'ha_dir'}</tt>",
36 "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
37 &ui_print_footer("/", $text{'index'});
41 # Check if the config files exist, or if they can be copied
42 if (!-r $ha_cf && -r $config{'alt_ha_cf'}) {
43 system("cp '$config{'alt_ha_cf'}' $ha_cf");
46 print &text('index_eha_cf', "<tt>$ha_cf</tt>",
47 "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
48 &ui_print_footer("/", $text{'index'});
52 if (!-r $haresources && -r $config{'alt_haresources'}) {
53 system("cp '$config{'alt_haresources'}' '$haresources'");
55 if (!-r $haresources) {
56 print &text('index_eharesources', "<tt>$haresources</tt>",
57 "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
58 &ui_print_footer("/", $text{'index'});
62 if (!-r $authkeys && -r $config{'alt_authkeys'}) {
63 system("cp '$config{'alt_authkeys'}' '$authkeys'");
66 print &text('index_eauthkeys', "<tt>$authkeys</tt>",
67 "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
68 &ui_print_footer("/", $text{'index'});
71 if (!-r $config{'req_resource_cmd'}) {
72 print &text('index_ereq_resource_cmd', "<tt>$config{'req_resource_cmd'}</tt>",
73 "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
74 &ui_print_footer("/", $text{'index'});
78 @opts = ( 'conf', 'res','auth' );
79 @links = map { "edit_${_}.cgi" } @opts;
80 @titles = map { $text{"${_}_title"} } @opts;
81 @icons = map { "images/${_}.gif" } @opts;
82 &icons_table(\@links, \@titles, \@icons);
85 print "<table width=100%><tr>\n";
88 $status = `($config{'heartbeat'} -s) </dev/null 2>&1`;
89 print "<tr> <td><b>$text{'index_status'}</b></td>\n";
90 print "<td><tt>$status</tt></td> </tr>\n";
92 # Show start/stop button
93 if (&check_pid_file($config{'pid_file'})) {
94 print "<form action=apply.cgi>\n";
95 print "<td><input type=submit value='$text{'index_apply'}'></td>\n";
96 print "<td>$text{'index_applymsg'}</td>\n";
100 print "<form action=start.cgi>\n";
101 print "<td><input type=submit value='$text{'index_start'}'></td>\n";
102 print "<td>$text{'index_startmsg'}</td>\n";
106 print "</tr></table>\n";
108 if (!$heartbeat_version) {
109 print "<center><b>",&text('index_noversion', "../config.cgi?$module_name"),"</b></center>\n";
112 &ui_print_footer("/", $text{'index'});