summaryrefslogtreecommitdiffstats
path: root/etc/phpshellsessions/uninstallpkg
diff options
context:
space:
mode:
Diffstat (limited to 'etc/phpshellsessions/uninstallpkg')
-rw-r--r--etc/phpshellsessions/uninstallpkg35
1 files changed, 35 insertions, 0 deletions
diff --git a/etc/phpshellsessions/uninstallpkg b/etc/phpshellsessions/uninstallpkg
new file mode 100644
index 0000000..484ccc8
--- /dev/null
+++ b/etc/phpshellsessions/uninstallpkg
@@ -0,0 +1,35 @@
+require_once("config.inc");
+require_once("util.inc");
+require_once("pkg-utils.inc");
+
+global $g, $config, $argv, $command_split;
+
+if(is_array($command_split))
+ $args = array_slice($command_split, 2);
+else
+ $args = array_slice($argv, 3);
+
+$pkg_name = $args[0];
+$remove_type = empty($args[1]) ? "normal" : $args[1];
+$pkg_info = array();
+
+echo "Removing package \"{$pkg_name}\"...\n";
+
+foreach($config['installedpackages']['package'] as $package) {
+ if ($pkg_name == $package['name'])
+ $pkg_info = $package;
+}
+
+$static_output = "";
+$pkg_interface = "console";
+
+if (empty($pkg_info))
+ echo "\nPackage not installed.\n";
+elseif ($remove_type == "normal")
+ uninstall_package($pkg_name);
+elseif ($remove_type == "xmlonly")
+ delete_package_xml($pkg_name);
+else
+ echo "Invalid removal type. Valid values are: normal, xmlonly.\n";
+
+echo "\nDone.\n"; \ No newline at end of file
OpenPOWER on IntegriCloud