summaryrefslogtreecommitdiffstats
path: root/etc/inc
diff options
context:
space:
mode:
authorColin Smith <colin@pfsense.org>2005-07-21 20:13:30 +0000
committerColin Smith <colin@pfsense.org>2005-07-21 20:13:30 +0000
commita6d0d4611540e9487f72c0121b1d518512834ce2 (patch)
treeb56b46248b7ea37994a6bb811d6398144b844fc9 /etc/inc
parenta980eec16858cc59adb8a3d1fa02c019193dcb4c (diff)
downloadpfsense-a6d0d4611540e9487f72c0121b1d518512834ce2.zip
pfsense-a6d0d4611540e9487f72c0121b1d518512834ce2.tar.gz
* Strip package installation and logging from install_package. This function now need only download the package's 'master' XML configuration.
Diffstat (limited to 'etc/inc')
-rw-r--r--etc/inc/pkg-utils.inc99
1 files changed, 50 insertions, 49 deletions
diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc
index 69749b2..a5e2537 100644
--- a/etc/inc/pkg-utils.inc
+++ b/etc/inc/pkg-utils.inc
@@ -369,13 +369,6 @@ function install_package($package, $pkg_info = "") {
$pkg_info = get_pkg_info(array($package));
$pkg_info = $pkg_info[$package]; // We're only dealing with one package, so we can strip away the extra array.
}
- /* set up package logging streams */
- if($pkg_info['logging']) {
- mwexec("/usr/sbin/clog -i -s 32768 {$g['varlog_path']}/{$pkg_info['logging']['logfilename']}");
- chmod($g['varlog_path'] . '/' . $pkg_info['logging']['logfilename'], 0600);
- @fwrite($fd_log, "Adding text to file /etc/syslog.conf\n");
- system_syslogd_start();
- }
/* fetch the package's configuration file */
if($pkg_info['config_file'] != "") {
$static_output .= "Downloading package configuration file... ";
@@ -398,46 +391,6 @@ function install_package($package, $pkg_info = "") {
$static_output .= "done.\n";
update_output_window($static_output);
}
- /* make 'y' file */
- $fd = fopen("{$g['tmp_path']}/y", "w");
- for($line = 0; $line < 10; $line++) {
- fwrite($fd, "y\n");
- }
- fclose($fd);
-
- /* pkg_add the package and its dependencies */
- if($pkg_info['depends_on_package_base_url'] != "") {
- update_status("Installing " . $pkg_info['name'] . " and its dependencies.");
- $static_output .= "Downloading " . $pkg_info['name'] . " and its dependencies... ";
- $static_orig = $static_output;
- $static_output .= "\n";
- update_output_window($static_output);
- $pkg_name = substr(reverse_strrchr($pkg_info['depends_on_package'], "."), 0, -1);
- if(isset($pkg_info['skip_install_checks'])) {
- $pkg_installed = true;
- } else {
- $pkg_installed = is_freebsd_pkg_installed($pkg_name);
- }
- if($pkg_installed == false) pkg_fetch_recursive($pkg_name, $pkg_info['depends_on_package'], 0, $pkg_info['depends_on_package_base_url']);
- $static_output = $static_orig . "done.\nChecking for successful package installation... ";
- update_output_window($static_output);
- /* make sure our package was successfully installed */
- if($pkg_installed == false) $pkg_installed = is_freebsd_pkg_installed($pkg_name);
- if($pkg_installed == true) {
- $static_output .= "done.\n";
- update_output_window($static_output);
- fwrite($fd_log, "pkg_add successfully completed.\n");
- } else {
- $static_output .= "failed!\n\nInstallation aborted.";
- update_output_window($static_output);
- fwrite($fd_log, "Package WAS NOT installed properly.\n");
- fclose($fd_log);
- echo "\n<script language=\"JavaScript\">document.progressbar.style.visibility='hidden';</script>";
- echo "\n<script language=\"JavaScript\">document.progholder.style.visibility='hidden';</script>";
- sleep(1);
- die;
- }
- }
/* add package information to config.xml */
$pkgid = get_pkg_id($pkg_info['name']);
$static_output .= "Saving updated package information... ";
@@ -472,7 +425,6 @@ function eval_once($toeval) {
}
return;
}
-
function install_package_xml($pkg) {
global $g, $config, $fd_log, $static_output;
@@ -493,6 +445,55 @@ function install_package_xml($pkg) {
}
}
+ /* set up package logging streams */
+ if($pkg_info['logging']) {
+ mwexec("/usr/sbin/clog -i -s 32768 {$g['varlog_path']}/{$pkg_info['logging']['logfilename']}");
+ chmod($g['varlog_path'] . '/' . $pkg_info['logging']['logfilename'], 0600);
+ @fwrite($fd_log, "Adding text to file /etc/syslog.conf\n");
+ system_syslogd_start();
+ }
+
+ /* make 'y' file */
+ $fd = fopen("{$g['tmp_path']}/y", "w");
+ for($line = 0; $line < 10; $line++) {
+ fwrite($fd, "y\n");
+ }
+ fclose($fd);
+
+ /* pkg_add the package and its dependencies */
+ if($pkg_info['depends_on_package_base_url'] != "") {
+ update_status("Installing " . $pkg_info['name'] . " and its dependencies.");
+ $static_output .= "Downloading " . $pkg_info['name'] . " and its dependencies... ";
+ $static_orig = $static_output;
+ $static_output .= "\n";
+ update_output_window($static_output);
+ $pkg_name = substr(reverse_strrchr($pkg_info['depends_on_package'], "."), 0, -1);
+ if(isset($pkg_info['skip_install_checks'])) {
+ $pkg_installed = true;
+ } else {
+ $pkg_installed = is_freebsd_pkg_installed($pkg_name);
+ }
+ if($pkg_installed == false) pkg_fetch_recursive($pkg_name, $pkg_info['depends_on_package'], 0, $pkg_info['depends_on_package_base_url']);
+ $static_output = $static_orig . "done.\nChecking for successful package installation... ";
+ update_output_window($static_output);
+ /* make sure our package was successfully installed */
+ if($pkg_installed == false) $pkg_installed = is_freebsd_pkg_installed($pkg_name);
+ if($pkg_installed == true) {
+ $static_output .= "done.\n";
+ update_output_window($static_output);
+ fwrite($fd_log, "pkg_add successfully completed.\n");
+ } else {
+ $static_output .= "failed!\n\nInstallation aborted.";
+ update_output_window($static_output);
+ fwrite($fd_log, "Package WAS NOT installed properly.\n");
+ fclose($fd_log);
+ echo "\n<script language=\"JavaScript\">document.progressbar.style.visibility='hidden';</script>";
+ echo "\n<script language=\"JavaScript\">document.progholder.style.visibility='hidden';</script>";
+ sleep(1);
+ die;
+ }
+ }
+
$configfile = substr(strrchr($pkg_info['config_file'], '/'), 1);
if(file_exists("/usr/local/pkg/" . $configfile)) {
$static_output .= "Loading package configuration... ";
@@ -823,4 +824,4 @@ function squash_from_bytes($size, $round = "") {
}
return;
}
-?> \ No newline at end of file
+?>
OpenPOWER on IntegriCloud