summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/drakhelp
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/standalone/drakhelp')
-rwxr-xr-x[-rw-r--r--]perl-install/standalone/drakhelp58
1 files changed, 37 insertions, 21 deletions
diff --git a/perl-install/standalone/drakhelp b/perl-install/standalone/drakhelp
index dde416209..c2b46979a 100644..100755
--- a/perl-install/standalone/drakhelp
+++ b/perl-install/standalone/drakhelp
@@ -2,37 +2,53 @@
use strict;
use diagnostics;
-use lib qw(/usr/lib/libDrakX);
+use lib qw(/usr/lib/libDrakX);
use standalone; #- warning, standalone must be loaded very first, for 'explanations'
use interactive;
use common;
-use lang;
use any;
+eval { require ctxhelp };
+use log;
+
+
+sub usage() {
+ print STDERR N(" drakhelp 0.1
+Copyright (C) %s Mandriva.
+Copyright (C) %s Mageia.
+This is free software and may be redistributed under the terms of the GNU GPL.
+
+Usage:
+", '2003-2008', '2011') . N(" --help - display this help
+") . N(" --id <id_label> - load the html help page which refers to id_label
+") . N(" --doc <link> - link to another web page ( for WM welcome frontend)
+");
+ exit(0);
+}
+my ($opt, $idlabel) = @ARGV;
+@ARGV == 2 && member($opt, qw(--id --doc --help)) or usage();
-die "Usage: drakhelp <help_path>" if @ARGV != 1;
-
-my $in = interactive->vnew;
-
-my $lang = lang::lang2LANG(lang::read('',$>)) || 'en';
-if (!member($lang, qw(de en es fr it ru))) { $lang = 'en' };
-my $path_to_help = "/usr/share/doc/mandrake/" . $lang . "/";
--d $path_to_help or $in->do_pkgs->install('mandrake_doc-' . $lang);
-if ((my $wm = any::running_window_manager()) eq 'kwin') {
- system("mdklaunchhelp " . $path_to_help . $ARGV[0] . "&");
-} elsif ($wm eq 'gnome-session') {
- system("yelp ghelp://" . $path_to_help . $ARGV[0] . "&")
-} else {
- on_request_help($path_to_help . $ARGV[0])
+my ($instpath, $ancpath, $package) = eval { ctxhelp::path2help($opt, $idlabel) };
+if (! -e $instpath) {
+ system('/usr/sbin/drakhelp_inst', $package);
}
-sub on_request_help {
- my ($link) = @_;
- my $browser = $ENV{BROWSER} || find { -x "/usr/bin/$_" } qw(mozilla konqueror galeon) or $in->ask_warn('drakhelp', N("No browser is installed on your system, Please install one if you want to browse the help system"));
- standalone::explanations("Connection to help system at $link");
- system("$browser $link &");
+if (! -e $instpath) {
+ #- trying again, asking for the english entry
+ ($instpath, $ancpath, my $package2) = eval { ctxhelp::path2help($opt, $idlabel, 'en') };
+ if (! -e $instpath && $package ne $package2) {
+ system("/usr/sbin/drakhelp_inst $package2");
+ }
}
+if (-f $instpath) {
+ local $ENV{HOME} = '/root' if !$<;
+ run_program::raw({ detach => 1 }, 'display_help', "file://$ancpath");
+} else {
+ $ugtk3::wm_icon = "help";
+ my $in = interactive->vnew;
+ $in->ask_warn(N("%s Help Center", N("Mageia")), N("No Help entry for %s\n", $idlabel));
+}