aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Stefan Haischt <dsh@pfsense.org>2006-08-17 08:06:51 +0000
committerDaniel Stefan Haischt <dsh@pfsense.org>2006-08-17 08:06:51 +0000
commit0f65d77050ec71dc586457f9af17c255774fd81a (patch)
tree4c6e5a0ca5f711d338e7c79f6df21915538e275f
parent94b92236e10a939ad8b08afd001bca3fd8ce1f27 (diff)
downloadpfsense-packages-0f65d77050ec71dc586457f9af17c255774fd81a.tar.gz
pfsense-packages-0f65d77050ec71dc586457f9af17c255774fd81a.tar.bz2
pfsense-packages-0f65d77050ec71dc586457f9af17c255774fd81a.zip
fiexed remove_package_contents function
-rw-r--r--packages/freenas/pkg/freenas.inc57
1 files changed, 41 insertions, 16 deletions
diff --git a/packages/freenas/pkg/freenas.inc b/packages/freenas/pkg/freenas.inc
index c67be812..b06d5db8 100644
--- a/packages/freenas/pkg/freenas.inc
+++ b/packages/freenas/pkg/freenas.inc
@@ -35,47 +35,64 @@ function sync_package_freenas() {
function oninstall_copy_kernel_binaries($action = "install") {
$binaries = array();
$binaries[] = array("source" => "/usr/local/pkg/iscsi_initiator.ko",
- "target" => "/boot/kernel/iscsi_initiator.ko");
+ "target" => "/boot/kernel/iscsi_initiator.ko",
+ "backup" => false);
$binaries[] = array("source" => "/usr/local/pkg/ext2fs.ko",
- "target" => "/boot/kernel/ext2fs.ko");
+ "target" => "/boot/kernel/ext2fs.ko",
+ "backup" => false);
$binaries[] = array("source" => "/usr/local/pkg/geom_concat.ko",
- "target" => "/boot/kernel/geom_concat.ko");
+ "target" => "/boot/kernel/geom_concat.ko",
+ "backup" => false);
$binaries[] = array("source" => "/usr/local/pkg/geom_gpt.ko",
- "target" => "/boot/kernel/geom_gpt.ko");
+ "target" => "/boot/kernel/geom_gpt.ko",
+ "backup" => false);
$binaries[] = array("source" => "/usr/local/pkg/geom_mirror.ko",
- "target" => "/boot/kernel/geom_mirror.ko");
+ "target" => "/boot/kernel/geom_mirror.ko",
+ "backup" => false);
$binaries[] = array("source" => "/usr/local/pkg/geom_stripe.ko",
- "target" => "/boot/kernel/geom_stripe.ko");
+ "target" => "/boot/kernel/geom_stripe.ko",
+ "backup" => false);
$binaries[] = array("source" => "/usr/local/pkg/geom_vinum.ko",
- "target" => "/boot/kernel/geom_vinum.ko");
+ "target" => "/boot/kernel/geom_vinum.ko",
+ "backup" => false);
$binaries[] = array("source" => "/usr/local/pkg/ntfs.ko",
- "target" => "/boot/kernel/ntfs.ko");
+ "target" => "/boot/kernel/ntfs.ko",
+ "backup" => false);
$binaries[] = array("source" => "/usr/local/pkg/kernel.gz",
- "target" => "/boot/kernel/kernel.gz");
+ "target" => "/boot/kernel/kernel.gz",
+ "backup" => true);
if ($action == "install") {
while (list(, $val) = each($binaries)) {
$static_output .= "FreeNAS: Moving binary file... ";
update_output_window($static_output);
+ if ($val['backup'] && file_exists($val['target']))
+ rename($val['target'], "{$val['target']}.org");
rename($val['source'], $val['target']);
$static_output .= "done.\n";
update_output_window($static_output);
}
} else if ($action == "deinstall") {
while (list($source, $target) = each($binaries)) {
+ $static_output .= "FreeNAS: Removing binary file... ";
+ update_output_window($static_output);
unlink($target);
+ $static_output .= "done.\n";
+ update_output_window($static_output);
}
}
}
function remove_package_contents($pkg = "") {
- if ($file == "") { return; }
-
- $pd = popen("pkg_info -rf {$pkg}");
+ if ($pkg == "") { return; }
- while (!feof($pd)) {
- $buffer = fgets($handle, 4096);
-
+ $pd = popen("pkg_info -rf {$pkg}", "r");
+
+ if (! pd) { return; }
+
+ while (! feof($pd)) {
+ $buffer = fgets($pd, 4096);
+
if (strpos($buffer, "File:") !== false) {
$file = trim(str_replace("File:", "", $buffer));
@@ -151,12 +168,20 @@ function oninstall_copy_misc_binaries($action = "install") {
if ($action == "install") {
while (list(, $val) = each($binaries)) {
+ $static_output .= "FreeNAS: Installing binary file... ";
+ update_output_window($static_output);
mwexec("install -s {$source} ${target}");
+ $static_output .= "done.\n";
+ update_output_window($static_output);
}
} else if ($action == "deinstall") {
while (list($val['source'], $val['target']) = each($binaries)) {
+ $static_output .= "FreeNAS: Removing binary file... ";
+ update_output_window($static_output);
unlink($target);
- }
+ $static_output .= "done.\n";
+ update_output_window($static_output);
+ }
}
}