summaryrefslogtreecommitdiffstats
path: root/etc/inc/pkg-utils.inc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2010-12-25 13:40:13 -0500
committerScott Ullrich <sullrich@pfsense.org>2010-12-25 13:40:13 -0500
commit4c6a49d7f8b2ebf3ac7518514eedfa330efb2eb9 (patch)
tree706c6ca21f2f59736dbacb123a27587760c88e15 /etc/inc/pkg-utils.inc
parent2b216e519932db68a12d70e731138021995944a1 (diff)
downloadpfsense-4c6a49d7f8b2ebf3ac7518514eedfa330efb2eb9.zip
pfsense-4c6a49d7f8b2ebf3ac7518514eedfa330efb2eb9.tar.gz
backup and restore libs in correct location
Diffstat (limited to 'etc/inc/pkg-utils.inc')
-rw-r--r--etc/inc/pkg-utils.inc26
1 files changed, 13 insertions, 13 deletions
diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc
index 6b5f3a3..ede82a0 100644
--- a/etc/inc/pkg-utils.inc
+++ b/etc/inc/pkg-utils.inc
@@ -304,6 +304,13 @@ function get_pkg_depends($pkg_name, $filetype = ".xml", $format = "files", $retu
function uninstall_package($pkg_name) {
global $config, $static_output;
+ // Back up /usr/local/lib libraries first
+ if(!file_exists("/tmp/pkg_libs.tgz")) {
+ $static_output .= "\tBacking up libraries... ";
+ update_output_window($static_output);
+ exec("/usr/bin/tar czPf /tmp/pkg_libs.tgz `/bin/cat /etc/pfSense_md5.txt | /usr/bin/grep 'local/lib' | /usr/bin/awk '{ print $2 }' | /usr/bin/cut -d'(' -f2 | /usr/bin/cut -d')' -f1`");
+ }
+
$id = get_pkg_id($pkg_name);
if ($id >= 0) {
$pkg_depends =& $config['installedpackages']['package'][$id]['depends_on_package'];
@@ -315,6 +322,12 @@ function uninstall_package($pkg_name) {
}
}
delete_package_xml($pkg_name);
+
+ // Restore libraries that we backed up
+ $static_output .= "\tCleaning up... ";
+ update_output_window($static_output);
+ exec("/usr/bin/tar xzPf /tmp/pkg_libs.tgz -C /");
+ @unlink("/tmp/pkg_libs.tgz");
}
function force_remove_package($pkg_name) {
@@ -828,13 +841,6 @@ function delete_package_xml($pkg) {
conf_mount_rw();
- if(!file_exists("/tmp/pkg_libs.tgz")) {
- // Back up /usr/local/lib libraries first
- $static_output .= "\tBacking up libraries... ";
- update_output_window($static_output);
- exec("/usr/bin/tar czPf /tmp/pkg_libs.tgz `/bin/cat /etc/pfSense_md5.txt | /usr/bin/grep 'local/lib' | /usr/bin/awk '{ print $2 }' | /usr/bin/cut -d'(' -f2 | /usr/bin/cut -d')' -f1`");
- }
-
$pkgid = get_pkg_id($pkg);
if ($pkgid == -1) {
$static_output .= "The {$pkg} package is not installed.\n\nDeletion aborted.";
@@ -1008,12 +1014,6 @@ function delete_package_xml($pkg) {
$static_output .= "done.\n";
update_output_window($static_output);
}
-
- // Restore libraries that we backed up
- $static_output .= "\tCleaning up... ";
- update_output_window($static_output);
- exec("/usr/bin/tar xzPf /tmp/pkg_libs.tgz -C /");
- @unlink("/tmp/pkg_libs.tgz");
conf_mount_ro();
/* remove config.xml entries */
OpenPOWER on IntegriCloud