---- Changes since 1.440 ----
Added a Module Config option to not use any update system, even if YUM or APT are installed.
Added the function package_files for other modules to call, when only a list of files in some package is needed.
+The selected package and update systems are now checked when the module is opened, and an error message displayed if any needed commands are missing.
# aix-lib.pl
# Functions for aix package management
+sub list_package_system_commands
+{
+return ("lslpp", "geninstall", "installp");
+}
+
# list_packages([package]*)
# Fills the array %packages with a list of all packages
sub list_packages
$apt_get_command = $config{'apt_mode'} ? "aptitude" : "apt-get";
$apt_search_command = $config{'apt_mode'} ? "aptitude" : "apt-cache";
+sub list_update_system_commands
+{
+return ($apt_get_command, $apt_search_command);
+}
+
# update_system_install([package])
# Install some package with apt
sub update_system_install
$pkg_get = -x "/opt/csw/bin/pkg-get" ? "/opt/csw/bin/pkg-get"
: &has_command("pkg-get");
+sub list_update_system_commands
+{
+return ($pkg_get);
+}
+
# update_system_install([file])
# Install some package with pkg-get
sub update_system_install
use vars '$hasrpm'; $hasrpm = (-f "/usr/bin/rpm.exe");
use vars '$db'; $db = "/etc/setup/installed.db";
+sub validate_package_system
+{
+return -r $db ? undef : &text('cygwin_edb', "<tt>$db</tt>");
+}
+
# list_packages([package]*)
# Fills the array %packages with all or listed packages
sub list_packages
# debian-lib.pl
# Functions for debian DPKG package management
+sub list_package_system_commands
+{
+return ("dpkg");
+}
+
# list_packages([package]*)
# Fills the array %packages with a list of all packages
sub list_packages
$portage_bin = "/usr/lib/portage/bin";
$ENV{'TERM'} = "dumb";
+sub list_package_system_commands
+{
+return ("$portage_bin/pkglist");
+}
+
+sub list_update_system_commands
+{
+return ("emerge");
+}
+
# list_packages([package]*)
# Fills the array %packages with all or listed packages
sub list_packages
chop($system_arch = `uname -m`);
$package_dir = "/var/db/pkg";
+sub list_package_system_commands
+{
+return ("pkg_info", "pkg_add");
+}
+
# list_packages([package]*)
# Fills the array %packages with a list of all packages
sub list_packages
# hpux-lib.pl
# Functions for HP-UX package management
+sub list_package_system_commands
+{
+return ("swlist", "swinstall");
+}
+
# list_packages([package]*)
# Fills the array %packages with all or listed packages
sub list_packages
&help_search_link(defined(&package_help) ? ( &package_help() ) : ( ),
"man", "doc"));
+# Validate the package and update systems
+$err = &check_package_system();
+if ($err) {
+ &ui_print_endpage(&text('index_epackagecheck', $err,
+ "../config.cgi?$module_name"));
+ }
+$err = &check_update_system();
+if ($err) {
+ &ui_print_endpage(&text('index_eupdatecheck', $err,
+ "../config.cgi?$module_name"));
+ }
+
# Show package search and list forms
print &ui_subheading($text{'index_installed'});
print "<table width=100%><tr>\n";
index_return=module index
index_treturn=package tree
index_tree=Package Tree
+index_epackagecmd=The $1 package system requires the $2 command
+index_eupdatecmd=The $1 update system requires the $2 command
+index_epackagecheck=The selected package management system is not valid : $1.<br>You may need to select a different system on the <a href='$2'>module configuration</a> page.
+index_eupdatecheck=The selected update system is not valid : $1.<br>You may need to select a different update method on the <a href='$2'>module configuration</a> page.
search_title=Package Search
search_nomatch=No packages matched $1
slack_root=Root directory
slack_eroot=Missing or invalid root directory
slack_manager=Slackware Package Manager
+slack_edir=Missing Slackware packages directory $1
debian_unknown=Unknown
debian_depends=Ignore dependancy problems?
cygwin_badpostscript=Warning: this script does not appear to have been run
cygwin_pkgexists=Package $1 already exists.
cygwin_warnuse=Warning: This is not an official interface for managing Cygwin software. Use at your own risk.
+cygwin_edb=Missing Cygwin packages database $1
deletes_err=Failed to delete packages
deletes_enone=No packages selected
$has_sw_discovery = -x $sw_discovery_cmd;
$no_package_filesearch = 1;
+sub list_package_system_commands
+{
+return ($sw_discovery_cmd);
+}
+
# list_packages([package]*)
# Fills the array %packages with all or listed packages
sub list_packages
chop($system_arch = `uname -m`);
$package_dir = "/var/db/pkg";
+sub list_package_system_commands
+{
+return ("pkg_info", "pkg_add");
+}
+
# list_packages([package]*)
# Fills the array %packages with a list of all packages
sub list_packages
&foreign_require("proc", "proc-lib.pl");
+sub list_package_system_commands
+{
+return ("pkginfo", "pkgadd", "pkgrm");
+}
+
# list_packages([package]*)
# Fills the array %packages with a list of all packages
sub list_packages
$up2date_config = "/etc/sysconfig/rhn/up2date";
$rhn_sysconfig = "/etc/sysconfig/rhn/rhnsd";
+sub list_update_system_commands
+{
+return ("up2date");
+}
+
# update_system_install([package])
# Install some package with up2date
sub update_system_install
# rpm-lib.pl
# Functions for redhat linux package management
+sub list_package_system_commands
+{
+return ("rpm");
+}
+
# list_packages([package]*)
# Fills the array %packages with all or listed packages
sub list_packages
use POSIX;
chop($system_arch = `uname -m`);
+sub validate_package_system
+{
+return -d &translate_filename($package_dir) ? undef :
+ &text('slack_edir', "<tt>$package_dir</tt>");
+}
+
# list_packages([package]*)
# Fills the array %packages with a list of all packages
sub list_packages
# software-lib.pl
# A generalized system for package management on solaris, linux, etc..
-# XXX cluster-software module
do '../web-lib.pl';
&init_config();
return 0;
}
+# check_package_system()
+# Returns an error message if some command needed by the selected package
+# management system is missing.
+sub check_package_system
+{
+local $err;
+if (defined(&validate_package_system)) {
+ $err = &validate_package_system();
+ }
+if (defined(&list_package_system_commands)) {
+ foreach my $c (&list_package_system_commands()) {
+ if (!&has_command($c)) {
+ $err ||= &text('index_epackagecmd', &package_system(),
+ "<tt>$c</tt>");
+ }
+ }
+ }
+return $err;
+}
+
+# check_update_system()
+# Returns an error message if some command needed by the selected update
+# system is missing.
+sub check_update_system
+{
+return undef if (!$update_system);
+local $err;
+if (defined(&validate_update_system)) {
+ $err = &validate_update_system();
+ }
+if (defined(&list_update_system_commands)) {
+ foreach my $c (&list_update_system_commands()) {
+ if (!&has_command($c)) {
+ $err ||= &text('index_eupdatecmd',
+ $text{$update_system.'_name'} || uc($update_system),
+ "<tt>$c</tt>");
+ }
+ }
+ }
+return $err;
+}
+
1;
# urpmi-lib.pl
# Functions for installing packages with Mandrake urpmi
+sub list_update_system_commands
+{
+return ("urpmi");
+}
+
# update_system_install([package])
# Install some package with urpmi
sub update_system_install
$yum_config = $config{'yum_config'} || "/etc/yum.conf";
+sub list_update_system_commands
+{
+return ("yum");
+}
+
# update_system_install([package], [&in])
# Install some package with yum
sub update_system_install