1 |
ac24dc24
|
Renato Botelho
|
/*
|
2 |
|
|
* installpkg
|
3 |
|
|
*
|
4 |
|
|
* part of pfSense (https://www.pfsense.org)
|
5 |
81299b5c
|
Renato Botelho
|
* Copyright (c) 2016 Rubicon Communications, LLC (Netgate)
|
6 |
ac24dc24
|
Renato Botelho
|
* All rights reserved.
|
7 |
|
|
*
|
8 |
b12ea3fb
|
Renato Botelho
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
9 |
|
|
* you may not use this file except in compliance with the License.
|
10 |
|
|
* You may obtain a copy of the License at
|
11 |
ac24dc24
|
Renato Botelho
|
*
|
12 |
b12ea3fb
|
Renato Botelho
|
* http://www.apache.org/licenses/LICENSE-2.0
|
13 |
ac24dc24
|
Renato Botelho
|
*
|
14 |
b12ea3fb
|
Renato Botelho
|
* Unless required by applicable law or agreed to in writing, software
|
15 |
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
16 |
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17 |
|
|
* See the License for the specific language governing permissions and
|
18 |
|
|
* limitations under the License.
|
19 |
ac24dc24
|
Renato Botelho
|
*/
|
20 |
|
|
|
21 |
5823264a
|
jim-p
|
require_once("config.inc");
|
22 |
|
|
require_once("util.inc");
|
23 |
|
|
require_once("pkg-utils.inc");
|
24 |
|
|
|
25 |
|
|
global $g, $config, $argv, $command_split;
|
26 |
|
|
|
27 |
1bfcf6f1
|
Phil Davis
|
if (is_array($command_split)) {
|
28 |
5e51b5b9
|
Renato Botelho
|
$args = array_slice($command_split, 1);
|
29 |
1bfcf6f1
|
Phil Davis
|
} else {
|
30 |
5e51b5b9
|
Renato Botelho
|
$args = array_slice($argv, 2);
|
31 |
1bfcf6f1
|
Phil Davis
|
}
|
32 |
5823264a
|
jim-p
|
|
33 |
c56de81e
|
Renato Botelho
|
$pkg_name = $args[1];
|
34 |
5823264a
|
jim-p
|
|
35 |
c56de81e
|
Renato Botelho
|
pkg_remove_prefix($pkg_name);
|
36 |
5823264a
|
jim-p
|
|
37 |
c56de81e
|
Renato Botelho
|
echo "Installing package \"{$pkg_name}\"... ";
|
38 |
5823264a
|
jim-p
|
|
39 |
c56de81e
|
Renato Botelho
|
if (mwexec("/usr/local/sbin/{$g['product_name']}-upgrade -y -i {$g['pkg_prefix']}{$pkg_name}") == 0) {
|
40 |
|
|
echo "Done.\n";
|
41 |
|
|
return true;
|
42 |
|
|
} else {
|
43 |
|
|
echo "Failed.\n";
|
44 |
|
|
return false;
|
45 |
1bfcf6f1
|
Phil Davis
|
}
|