mirror of
https://github.com/webmin/webmin.git
synced 2026-05-04 22:30:33 +01:00
Start of work on FreeBSD pkg support
This commit is contained in:
3
software/config-freebsd-8.4-*
Normal file
3
software/config-freebsd-8.4-*
Normal file
@@ -0,0 +1,3 @@
|
||||
package_system=freebsd
|
||||
update_system=pkg
|
||||
apt_mode=0
|
||||
@@ -1,3 +1,3 @@
|
||||
package_system=Package management system,1,rpm-RPM,pkgadd-Solaris,hpux-HPUX,freebsd-FreeBSD,slackware-Slackware,debian-Debian,aix-AIX,emerge-Gentoo,cygwin-Cygwin,msi-Microsoft Installer
|
||||
update_system=Package update system,1,-Detect automatically,apt-APT,yum-YUM,rhn-Redhat Network,csw-Blastwave CSW,urpmi-URPMI,emerge-Emerge,ports-Ports,*-None
|
||||
update_system=Package update system,1,-Detect automatically,apt-APT,yum-YUM,rhn-Redhat Network,csw-Blastwave CSW,urpmi-URPMI,emerge-Emerge,ports-FreeBSD Ports,pkg-FreeBSD pkgng,*-None
|
||||
apt_mode=Command to use for APT installs,1,0-apt-get,1-aptitude
|
||||
|
||||
@@ -406,4 +406,8 @@ ports_apply=Download Latest Snapshot
|
||||
ports_upgrade=Downloading Ports Snapshot
|
||||
ports_running=Running command $1 ..
|
||||
|
||||
pkg_install=Installing FreeBSD packages $1 ..
|
||||
pkg_failed=.. some packages failed
|
||||
pkg_ok=.. install complete
|
||||
|
||||
__norefs=1
|
||||
|
||||
40
software/pkg-lib.pl
Normal file
40
software/pkg-lib.pl
Normal file
@@ -0,0 +1,40 @@
|
||||
# Functions for FreeBSD pkg repository
|
||||
|
||||
sub list_update_system_commands
|
||||
{
|
||||
return ("pkg");
|
||||
}
|
||||
|
||||
# update_system_install([package], [&in], [no-force])
|
||||
# Install some package with apt
|
||||
sub update_system_install
|
||||
{
|
||||
my $update = $_[0] || $in{'update'};
|
||||
my $in = $_[1];
|
||||
my $force = !$_[2];
|
||||
|
||||
# Build and show command to run
|
||||
$update = join(" ", map { quotemeta($_) } split(/\s+/, $update));
|
||||
my $cmd = "pkg install ".$update;
|
||||
print "<b>",&text('pkg_install', "<tt>$cmd</tt>"),"</b><p>\n";
|
||||
print "<pre>";
|
||||
&additional_log('exec', undef, $cmd);
|
||||
|
||||
# Run it
|
||||
&open_execute_command(CMD, $cmd, 2);
|
||||
while(<CMD>) {
|
||||
if (/Installing\s+(\S+)\-(\d\S*)/i) {
|
||||
push(@rv, $1);
|
||||
}
|
||||
print &html_escape("$_");
|
||||
}
|
||||
close(CMD);
|
||||
|
||||
print "</pre>\n";
|
||||
if ($?) { print "<b>$text{'pkg_failed'}</b><p>\n"; }
|
||||
else { print "<b>$text{'pkg_ok'}</b><p>\n"; }
|
||||
return @rv;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
@@ -21,7 +21,12 @@ elsif ($config{'update_system'}) {
|
||||
else {
|
||||
# Guess which update system we are using
|
||||
if ($gconfig{'os_type'} eq 'freebsd') {
|
||||
$update_system = "ports";
|
||||
if (&use_pkg_ng()) {
|
||||
$update_system = "pkg";
|
||||
}
|
||||
else {
|
||||
$update_system = "ports";
|
||||
}
|
||||
}
|
||||
elsif (&has_command($config{'apt_mode'} ? "aptitude" : "apt-get")) {
|
||||
$update_system = "apt";
|
||||
|
||||
Reference in New Issue
Block a user