#!/usr/local/bin/perl # index.cgi # Display heartbeat option categories require './heartbeat-lib.pl'; # Try to work out the version number $heartbeat_version = undef; if ($config{'version'}) { $heartbeat_version = $config{'version'}; } elsif (&backquote_command("($config{'heartbeat'} -V) &1") =~ /(\S+)/) { $heartbeat_version = $1; } elsif (&foreign_check("software")) { &foreign_require("software", "software-lib.pl"); local @pinfo = &software::package_info("heartbeat"); if (@pinfo) { $heartbeat_version = $pinfo[4]; $heartbeat_version =~ s/-.*$//; } } &open_tempfile(VERSION, ">$module_config_directory/version"); &print_tempfile(VERSION, $heartbeat_version,"\n"); &close_tempfile(VERSION); &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0, &help_search_link("heartbeat", "man", "doc"), undef, undef, $heartbeat_version ? &text('index_version', $heartbeat_version) : undef); # Check if heartbeat is installed if (!-d $config{'ha_dir'}) { print &text('index_edir', "$config{'ha_dir'}", "$gconfig{'webprefix'}/config.cgi?$module_name"),"

\n"; &ui_print_footer("/", $text{'index'}); exit; } # Check if the config files exist, or if they can be copied if (!-r $ha_cf && -r $config{'alt_ha_cf'}) { system("cp '$config{'alt_ha_cf'}' $ha_cf"); } if (!-r $ha_cf) { print &text('index_eha_cf', "$ha_cf", "$gconfig{'webprefix'}/config.cgi?$module_name"),"

\n"; &ui_print_footer("/", $text{'index'}); exit; } if (!-r $haresources && -r $config{'alt_haresources'}) { system("cp '$config{'alt_haresources'}' '$haresources'"); } if (!-r $haresources) { print &text('index_eharesources', "$haresources", "$gconfig{'webprefix'}/config.cgi?$module_name"),"

\n"; &ui_print_footer("/", $text{'index'}); exit; } if (!-r $authkeys && -r $config{'alt_authkeys'}) { system("cp '$config{'alt_authkeys'}' '$authkeys'"); } if (!-r $authkeys) { print &text('index_eauthkeys', "$authkeys", "$gconfig{'webprefix'}/config.cgi?$module_name"),"

\n"; &ui_print_footer("/", $text{'index'}); exit; } if (!-r $config{'req_resource_cmd'}) { print &text('index_ereq_resource_cmd', "$config{'req_resource_cmd'}", "$gconfig{'webprefix'}/config.cgi?$module_name"),"

\n"; &ui_print_footer("/", $text{'index'}); exit; } @opts = ( 'conf', 'res','auth' ); @links = map { "edit_${_}.cgi" } @opts; @titles = map { $text{"${_}_title"} } @opts; @icons = map { "images/${_}.gif" } @opts; &icons_table(\@links, \@titles, \@icons); print &ui_hr(); print "\n"; # Show status $status = `($config{'heartbeat'} -s) &1`; print "\n"; print "\n"; # Show start/stop button if (&check_pid_file($config{'pid_file'})) { print "\n"; print "\n"; print "\n"; print "\n"; } else { print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'index_status'}$status
$text{'index_applymsg'}
$text{'index_startmsg'}
\n"; if (!$heartbeat_version) { print "

",&text('index_noversion', "../config.cgi?$module_name"),"
\n"; } &ui_print_footer("/", $text{'index'});