# software-lib.pl # A generalized system for package management on solaris, linux, etc.. do '../web-lib.pl'; &init_config(); do '../ui-lib.pl'; $heiropen_file = "$module_config_directory/heiropen"; # Use the appropriate function set for whatever package management system # we are using. do "$config{package_system}-lib.pl"; if ($config{'update_system'}) { # User-specified system $update_system = $config{'update_system'}; } else { # Guess which update system we are using if (&has_command($config{'apt_mode'} ? "aptitude" : "apt-get")) { $update_system = "apt"; } elsif (&has_command("yum") && -r "/etc/yum.conf") { $update_system = "yum"; } elsif (&has_command("up2date") && &has_command("rhn_check")) { $update_system = "rhn"; } elsif (-x "/opt/csw/bin/pkg-get" || &has_command("pkg-get")) { $update_system = "csw"; } elsif (&has_command("urpmi")) { $update_system = "urpmi"; } elsif (&has_command("emerge")) { $update_system = "emerge"; } elsif (&has_command("cupdate")) { # not done yet! } } if ($update_system) { do $update_system."-lib.pl"; $has_update_system = 1; } # uncompress_if_needed(file, disposable) # If some file needs to be uncompressed or ungzipped, do it and return the # new temp file path. Otherwise, return the original path. sub uncompress_if_needed { return $_[0] if (&is_readonly_mode()); # don't even bother open(PFILE, $_[0]); read(PFILE, $two, 2); close(PFILE); if ($two eq "\037\235") { if (!&has_command("uncompress")) { &unlink_file($_[0]) if ($_[1]); &error($text{'soft_euncompress'}); } local $temp = $_[0] =~ /\/([^\/]+)\.Z/i ? &tempname("$1") : &tempname(); local $out = `uncompress -c $_[0] 2>&1 >$temp`; unlink($_[0]) if ($_[1]); if ($?) { unlink($temp); &error(&text('soft_euncmsg', $out)); } return $temp; } elsif ($two eq "\037\213") { if (!&has_command("gunzip")) { unlink($_[0]) if ($_[1]); &error($text{'soft_egzip'}); } local $temp = $_[0] =~ /\/([^\/]+)\.gz/i ? &tempname("$1") : &tempname(); local $out = `gunzip -c $_[0] 2>&1 >$temp`; unlink($_[0]) if ($_[1]); if ($?) { unlink($temp); &error(&text('soft_egzmsg', $out)); } return $temp; } return $_[0]; } # show_package_info(package, version) sub show_package_info { @pinfo = &package_info($_[0], $_[1]); return () if (!@pinfo); print &ui_subheading(&text('do_success', $_[0])); print "
| $text{'do_details'} | ||||||||||||||||
| ||||||||||||||||
\n";
return @pinfo;
}
@type_map = ( $text{'soft_reg'}, $text{'soft_dir'}, $text{'soft_spec'},
$text{'soft_sym'}, $text{'soft_hard'}, $text{'soft_edit'} );
# get_heiropen()
# Returns an array of open categories
sub get_heiropen
{
open(HEIROPEN, $heiropen_file);
local @heiropen =