# software-lib.pl # A generalized system for package management on solaris, linux, etc.. BEGIN { push(@INC, ".."); }; use WebminCore; &init_config(); $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'} eq '*') { # User specifically doesn't want any $update_system = undef; } elsif ($config{'update_system'}) { # User-specified system $update_system = $config{'update_system'}; } else { # Guess which update system we are using if ($gconfig{'os_type'} eq 'freebsd') { if (&use_pkg_ng()) { $update_system = "pkg"; } else { $update_system = "ports"; } } elsif (&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("dnf") && -r "/etc/dnf/dnf.conf") { # DNF is basically compatible with YUM $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") || -x "/opt/csw/bin/pkgutil" || &has_command("pkgutil")) { $update_system = "csw"; } elsif (&has_command("urpmi")) { $update_system = "urpmi"; } elsif (&has_command("emerge")) { $update_system = "emerge"; } elsif (&has_command("pkgin") || -x "/usr/pkg/bin/pkgin") { $update_system = "pkgsrc"; } } if ($update_system) { # Load the update system specific library, unless it has already been # loaded above if ($update_system ne $config{'package_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, [no-installed-message]) sub show_package_info { my ($name, $ver, $nomsg) = @_; my @pinfo = &package_info($name, $ver); return () if (!@pinfo); print &ui_subheading(&text('do_success', $name)) if (!$nomsg); print &ui_table_start($text{'edit_details'}, "width=100%", 4, [ "width=20%", undef, "width=20%", undef ]); # Package description if ($pinfo[2]) { $desc = &html_escape(&entities_to_ascii($pinfo[2])); $desc =~ s/\r?\n/ <br>/g; print &ui_table_row($text{'edit_desc'}, "<tt>$desc</tt>", 3); } # Name print &ui_table_row($text{'edit_pack'}, &html_escape($pinfo[0])); # Class, if any print &ui_table_row($text{'edit_class'}, $pinfo[1] ? &html_escape($pinfo[1]) : $text{'edit_none'}); # Version number print &ui_table_row($text{'edit_ver'}, &html_escape($pinfo[4])); if ($pinfo[5]) { # Vendor print &ui_table_row($text{'edit_vend'}, &html_escape(&entities_to_ascii($pinfo[5]))); } # Architecture print &ui_table_row($text{'edit_arch'}, &html_escape($pinfo[3])); if ($pinfo[6]) { # Install date print &ui_table_row($text{'edit_inst'}, $pinfo[6]); } print &ui_table_end(); 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 = <HEIROPEN>; chop(@heiropen); close(HEIROPEN); return @heiropen; } # save_heiropen(&heir) sub save_heiropen { &open_tempfile(HEIR, ">$heiropen_file"); foreach $h (@{$_[0]}) { &print_tempfile(HEIR, $h,"\n"); } &close_tempfile(HEIR); } # missing_install_link(package, description, return, return-desc) # Returns HTML for installing some package that is missing, from the # appropriate update system for this OS. Returns undef if automatic installation # is not possible for some reason. # Supported package names are : # apache # sendmail # postfix # squid # procmail # samba # mysql # postgresql # clamav # spamassassin sub missing_install_link { local ($name, $desc, $return, $returndesc) = @_; return undef if (!defined(&update_system_resolve)); return undef if (!&foreign_check($module_name)); local $pkg = &update_system_resolve($name); return undef if (!$pkg); local ($cpkg) = caller(); local $caller = eval '$'.$cpkg.'::module_name'; return &ui_form_start("@{[&get_webprefix()]}/$module_name/install_pack.cgi", "get"). &text('missing_msg', $desc, $text{$update_system."_name"})."\n". &ui_hidden("source", 3). &ui_hidden("update", $pkg). &ui_hidden("return", $return). &ui_hidden("returndesc", $returndesc). &ui_hidden("caller", $caller). &ui_form_end([ [ undef, $text{'missing_now'} ] ]); } # update_system_button(field-name, label) # Returns HTML for a button that opens the update system search window sub update_system_button { local ($name, $label) = @_; if (defined(&update_system_available) || defined(&update_system_search)) { return "<input type=button onClick='window.ifield = form.$name; chooser = window.open(\"../$module_name/find.cgi\", \"chooser\", \"toolbar=no,menubar=no,scrollbars=yes,width=600,height=500\")' value=\"$label\">"; } return undef; } # compare_versions(ver1, ver2) # Returns -1 if ver1 is older than ver2, 1 if newer, 0 if same sub compare_versions { local ($ver1, $rel1) = split(/-/, $_[0], 2); local ($ver2, $rel2) = split(/-/, $_[1], 2); if ($rel1 ne "" && $rel2 ne "" && $config{'package_system'} eq 'rpm') { # If two RPM packages have releases, then the version part comparison # must be done first and separately so that release number parts don't # override version parts. return &compare_versions($ver1, $ver2) || &compare_versions($rel1, $rel2); } return &compare_version_numbers($_[0], $_[1]); } # 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()) { $c =~ s/\s+.*$//; # Strip off args 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;
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
help | Folder | 0755 |
|
|
images | Folder | 0755 |
|
|
lang | Folder | 0755 |
|
|
CHANGELOG | File | 2.82 KB | 0644 |
|
aix-lib.pl | File | 19.2 KB | 0755 |
|
apt-lib.pl | File | 14.09 KB | 0755 |
|
apt_upgrade.cgi | File | 1.97 KB | 0755 |
|
cgi_args.pl | File | 524 B | 0755 |
|
close.cgi | File | 263 B | 0755 |
|
config-aix | File | 30 B | 0644 |
|
config-cobalt-linux | File | 30 B | 0644 |
|
config-coherent-linux | File | 30 B | 0644 |
|
config-corel-linux | File | 33 B | 0644 |
|
config-cygwin | File | 33 B | 0644 |
|
config-debian-linux | File | 51 B | 0644 |
|
config-freebsd | File | 54 B | 0644 |
|
config-freebsd-8.4-ALL | File | 52 B | 0644 |
|
config-gentoo-linux | File | 33 B | 0644 |
|
config-hpux | File | 31 B | 0644 |
|
config-mandrake-linux | File | 30 B | 0644 |
|
config-msc-linux | File | 30 B | 0644 |
|
config-netbsd | File | 34 B | 0644 |
|
config-open-linux | File | 30 B | 0644 |
|
config-openSUSE-Linux-15.0-ALL | File | 30 B | 0644 |
|
config-openbsd | File | 34 B | 0644 |
|
config-openmamba-linux | File | 48 B | 0644 |
|
config-openserver | File | 33 B | 0644 |
|
config-redhat-linux | File | 48 B | 0644 |
|
config-slackware-linux | File | 36 B | 0644 |
|
config-solaris | File | 33 B | 0644 |
|
config-suse-linux | File | 30 B | 0644 |
|
config-syno-linux | File | 50 B | 0644 |
|
config-trustix-linux | File | 30 B | 0644 |
|
config-turbo-linux | File | 30 B | 0644 |
|
config-united-linux | File | 30 B | 0644 |
|
config-unixware | File | 33 B | 0644 |
|
config-windows | File | 30 B | 0644 |
|
config.info | File | 511 B | 0644 |
|
config.info.ca | File | 554 B | 0644 |
|
config.info.cs | File | 372 B | 0644 |
|
config.info.de | File | 523 B | 0644 |
|
config.info.es | File | 320 B | 0644 |
|
config.info.fr | File | 135 B | 0644 |
|
config.info.ja | File | 428 B | 0644 |
|
config.info.ko | File | 409 B | 0644 |
|
config.info.ms | File | 411 B | 0644 |
|
config.info.nl | File | 415 B | 0644 |
|
config.info.no | File | 424 B | 0644 |
|
config.info.pl | File | 392 B | 0644 |
|
config.info.ru | File | 175 B | 0644 |
|
config.info.sv | File | 224 B | 0644 |
|
config.info.tr | File | 123 B | 0644 |
|
config.info.uk | File | 174 B | 0644 |
|
config.info.zh | File | 122 B | 0644 |
|
config.info.zh_TW | File | 125 B | 0644 |
|
csw-lib.pl | File | 2.69 KB | 0755 |
|
cygwin-lib.pl | File | 22.34 KB | 0755 |
|
debian-lib.pl | File | 6.67 KB | 0755 |
|
delete_file.cgi | File | 239 B | 0755 |
|
delete_pack.cgi | File | 1.46 KB | 0755 |
|
delete_packs.cgi | File | 1.85 KB | 0755 |
|
do_install.cgi | File | 2.67 KB | 0755 |
|
edit_pack.cgi | File | 1.13 KB | 0755 |
|
emerge-lib.pl | File | 7.65 KB | 0755 |
|
file_info.cgi | File | 2.09 KB | 0755 |
|
find.cgi | File | 1.63 KB | 0755 |
|
freebsd-lib.pl | File | 7.95 KB | 0755 |
|
hpux-lib.pl | File | 8.01 KB | 0755 |
|
index.cgi | File | 3 KB | 0755 |
|
install_pack.cgi | File | 4.71 KB | 0755 |
|
ipkg-close.cgi | File | 269 B | 0755 |
|
ipkg-edit_pack.cgi | File | 1.45 KB | 0755 |
|
ipkg-lib.pl | File | 7.78 KB | 0755 |
|
ipkg-open.cgi | File | 243 B | 0755 |
|
ipkg-tree.cgi | File | 4 KB | 0755 |
|
ipkg_upgrade.cgi | File | 926 B | 0755 |
|
list_pack.cgi | File | 1.85 KB | 0755 |
|
log_parser.pl | File | 1.34 KB | 0755 |
|
module.info | File | 484 B | 0644 |
|
module.info.af | File | 0 B | 0644 |
|
module.info.af.auto | File | 127 B | 0644 |
|
module.info.ar | File | 0 B | 0644 |
|
module.info.ar.auto | File | 170 B | 0644 |
|
module.info.be | File | 0 B | 0644 |
|
module.info.be.auto | File | 216 B | 0644 |
|
module.info.bg | File | 0 B | 0644 |
|
module.info.bg.auto | File | 214 B | 0644 |
|
module.info.ca | File | 116 B | 0644 |
|
module.info.ca.auto | File | 21 B | 0644 |
|
module.info.cs | File | 30 B | 0644 |
|
module.info.cs.auto | File | 114 B | 0644 |
|
module.info.da | File | 0 B | 0644 |
|
module.info.da.auto | File | 124 B | 0644 |
|
module.info.de | File | 106 B | 0644 |
|
module.info.de.auto | File | 21 B | 0644 |
|
module.info.el | File | 0 B | 0644 |
|
module.info.el.auto | File | 220 B | 0644 |
|
module.info.es | File | 29 B | 0644 |
|
module.info.es.auto | File | 106 B | 0644 |
|
module.info.eu | File | 0 B | 0644 |
|
module.info.eu.auto | File | 129 B | 0644 |
|
module.info.fa | File | 0 B | 0644 |
|
module.info.fa.auto | File | 215 B | 0644 |
|
module.info.fi | File | 0 B | 0644 |
|
module.info.fi.auto | File | 130 B | 0644 |
|
module.info.fr | File | 29 B | 0644 |
|
module.info.fr.auto | File | 117 B | 0644 |
|
module.info.he | File | 0 B | 0644 |
|
module.info.he.auto | File | 152 B | 0644 |
|
module.info.hr | File | 0 B | 0644 |
|
module.info.hr.auto | File | 138 B | 0644 |
|
module.info.hu | File | 38 B | 0644 |
|
module.info.hu.auto | File | 108 B | 0644 |
|
module.info.it | File | 0 B | 0644 |
|
module.info.it.auto | File | 134 B | 0644 |
|
module.info.ja | File | 43 B | 0644 |
|
module.info.ja.auto | File | 157 B | 0644 |
|
module.info.ko | File | 34 B | 0644 |
|
module.info.ko.auto | File | 128 B | 0644 |
|
module.info.lt | File | 0 B | 0644 |
|
module.info.lt.auto | File | 162 B | 0644 |
|
module.info.lv | File | 0 B | 0644 |
|
module.info.lv.auto | File | 151 B | 0644 |
|
module.info.ms | File | 104 B | 0644 |
|
module.info.ms.auto | File | 18 B | 0644 |
|
module.info.mt | File | 0 B | 0644 |
|
module.info.mt.auto | File | 150 B | 0644 |
|
module.info.nl | File | 27 B | 0644 |
|
module.info.nl.auto | File | 104 B | 0644 |
|
module.info.no | File | 26 B | 0644 |
|
module.info.no.auto | File | 107 B | 0644 |
|
module.info.pl | File | 121 B | 0644 |
|
module.info.pl.auto | File | 21 B | 0644 |
|
module.info.pt | File | 28 B | 0644 |
|
module.info.pt.auto | File | 102 B | 0644 |
|
module.info.pt_BR | File | 0 B | 0644 |
|
module.info.pt_BR.auto | File | 139 B | 0644 |
|
module.info.ro | File | 0 B | 0644 |
|
module.info.ro.auto | File | 134 B | 0644 |
|
module.info.ru | File | 30 B | 0644 |
|
module.info.ru.auto | File | 205 B | 0644 |
|
module.info.sk | File | 0 B | 0644 |
|
module.info.sk.auto | File | 145 B | 0644 |
|
module.info.sl | File | 0 B | 0644 |
|
module.info.sl.auto | File | 132 B | 0644 |
|
module.info.sv | File | 21 B | 0644 |
|
module.info.sv.auto | File | 100 B | 0644 |
|
module.info.th | File | 0 B | 0644 |
|
module.info.th.auto | File | 253 B | 0644 |
|
module.info.tr | File | 28 B | 0644 |
|
module.info.tr.auto | File | 107 B | 0644 |
|
module.info.uk | File | 0 B | 0644 |
|
module.info.uk.auto | File | 202 B | 0644 |
|
module.info.ur | File | 0 B | 0644 |
|
module.info.ur.auto | File | 208 B | 0644 |
|
module.info.vi | File | 0 B | 0644 |
|
module.info.vi.auto | File | 144 B | 0644 |
|
module.info.zh | File | 18 B | 0644 |
|
module.info.zh.auto | File | 91 B | 0644 |
|
module.info.zh_TW | File | 24 B | 0644 |
|
module.info.zh_TW.auto | File | 97 B | 0644 |
|
msi-lib.pl | File | 8.45 KB | 0755 |
|
open.cgi | File | 238 B | 0755 |
|
openbsd-lib.pl | File | 4.72 KB | 0755 |
|
pkg-lib.pl | File | 2.5 KB | 0644 |
|
pkgadd-lib.pl | File | 9.97 KB | 0755 |
|
pkgadd-no-ask | File | 164 B | 0644 |
|
pkgsrc-lib.pl | File | 7.24 KB | 0644 |
|
ports-lib.pl | File | 3.49 KB | 0644 |
|
ports_upgrade.cgi | File | 501 B | 0755 |
|
rhn-lib.pl | File | 3.02 KB | 0755 |
|
rhn.cgi | File | 1.3 KB | 0755 |
|
rhn_check.cgi | File | 1.84 KB | 0755 |
|
rpm-lib.pl | File | 11.24 KB | 0755 |
|
rpmfind.cgi | File | 2.11 KB | 0755 |
|
search.cgi | File | 2.27 KB | 0755 |
|
slackware-lib.pl | File | 6.95 KB | 0755 |
|
software-lib.pl | File | 7.57 KB | 0755 |
|
tree.cgi | File | 3.79 KB | 0755 |
|
urpmi-lib.pl | File | 2.14 KB | 0755 |
|
urpmi_upgrade.cgi | File | 839 B | 0755 |
|
view.cgi | File | 931 B | 0755 |
|
yum-lib.pl | File | 13.06 KB | 0755 |
|
yum_upgrade.cgi | File | 908 B | 0755 |
|