summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/drakhelp
blob: c2b46979a92e35d6964c019aa92020301a2ea649 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/perl

use strict;
use diagnostics;

use lib qw(/usr/lib/libDrakX);
use standalone;     #- warning, standalone must be loaded very first, for 'explanations'

use interactive;
use common;
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();



my ($instpath, $ancpath, $package) = eval { ctxhelp::path2help($opt, $idlabel) };
if (! -e $instpath) {
    system('/usr/sbin/drakhelp_inst', $package);
}

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));
}