This file is indexed.

/usr/bin/wg-installClass is in webgui 7.10.28-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#!/usr/bin/perl


#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com                     info@plainblack.com
#-------------------------------------------------------------------

use strict;
use File::Basename ();
use File::Spec;

my $webguiRoot;
BEGIN {
    $webguiRoot = '/usr/share/webgui';
    unshift @INC, File::Spec->catdir($webguiRoot, 'lib');
}

use Getopt::Long;
use Pod::Usage;
use WebGUI::Pluggable;
use WebGUI::Session;

$|++;

# Get options
my ( $configFile, $remove, $check, $upgrade, $help, $man );
GetOptions(
    'configFile=s' => \$configFile,
    'remove'       => \$remove,
    'check'        => \$check,
    'upgrade'      => \$upgrade,
    'help'         => \$help,
    'man'          => \$man,
);

# Get arguments
my $class = $ARGV[0];

pod2usage( -verbose => 1 )
    if $help;

pod2usage( -verbose => 2 )
    if $man;

pod2usage("$0: Must specify a configFile")
    if !$configFile;

if( ! -e $configFile ) {
    my $possible_configFile = File::Spec->catfile($webguiRoot, 'etc', $configFile);
    $configFile = $possible_configFile if -e $possible_configFile;
}

die "Config file '$configFile' does not exist!\n" if ! -e $configFile;

foreach my $libDir ( readLines( "/etc/webgui/preload.custom" ) ) {
    if ( !-d $libDir ) {
        warn "WARNING: Not adding lib directory '$libDir' from /etc/webgui/preload.custom: Directory does not exist.\n";
        next;
    }
    unshift @INC, $libDir;
}


# Open the session
my $session = WebGUI::Session->open( $webguiRoot, $configFile );
$session->user( { userId => 3 } );

# Install or uninstall the asset
WebGUI::Pluggable::load($class);
if ($check) {
    if ( $class->isInstalled($session) ) {
        print "$class is installed!\n";
    }
    else {
        print "$class is NOT installed!\n";
    }
}
elsif ($remove) {
    print "Removing $class... ";
    if ( !$class->isInstalled($session) ) {
        die "Can't remove $class because: Not installed\n";
    }
    $class->uninstall($session);
    print "DONE!\n";
    print "Please restart Apache.\n";
}
elsif ( $upgrade || $class->isInstalled($session) ) {
    print "Upgrading $class... ";
    $class->upgrade($session);
    print "DONE!\n";
    print "Please restart Apache.\n";
}
else {
    print "Installing $class... ";
    $class->install($session);
    print "DONE!\n";
    print "Please restart Apache.\n";
}

# End the session
$session->var->end;
$session->close;

#-------------------------------------------------
sub readLines {
    my $file = shift;
    my @lines;
    if (open(my $fh, '<', $file)) {
        while (my $line = <$fh>) {
            $line =~ s/#.*//;
            $line =~ s/^\s+//;
            $line =~ s/\s+$//;
            next if !$line;
            push @lines, $line;
        }
        close $fh;
    }
    return @lines;
}


__END__

=head1 NAME

installClass.pl -- Run class install methods

=head1 SYNOPSIS

 installClass.pl [--remove|--check|--upgrade] <class> --configFile=<configFile>

=head1 DESCRIPTION

This helper script installs a class that is using the correct interface. 

If your class has not told you to use this script, then it probably won't work!

=head1 ARGUMENTS

=over 4

=item class

The class name of the asset to install. Something like WebGUI::Asset::Yourasset

=back

=head1 OPTIONS

=over 4

=item check

If specified, will check if the class is installed or not.

=item upgrade

If specified, will upgrade the class.

=item remove

If specified, will uninstall the class. 

=item configFile 

The configuration file for the site to install the class into

=back

=head1 SEE ALSO

WebGUI::AssetAspect::Installable