diff --git a/software/config-freebsd-8.4-* b/software/config-freebsd-8.4-* new file mode 100644 index 000000000..8ddb19053 --- /dev/null +++ b/software/config-freebsd-8.4-* @@ -0,0 +1,3 @@ +package_system=freebsd +update_system=pkg +apt_mode=0 diff --git a/software/config.info b/software/config.info index dc89974e8..bd5e8880f 100644 --- a/software/config.info +++ b/software/config.info @@ -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 diff --git a/software/lang/en b/software/lang/en index d4ad7ffcf..121add2f9 100644 --- a/software/lang/en +++ b/software/lang/en @@ -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 diff --git a/software/pkg-lib.pl b/software/pkg-lib.pl new file mode 100644 index 000000000..a8f570ced --- /dev/null +++ b/software/pkg-lib.pl @@ -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 "",&text('pkg_install', "$cmd"),"
\n"; +print "
";
+&additional_log('exec', undef, $cmd);
+
+# Run it
+&open_execute_command(CMD, $cmd, 2);
+while() {
+ if (/Installing\s+(\S+)\-(\d\S*)/i) {
+ push(@rv, $1);
+ }
+ print &html_escape("$_");
+ }
+close(CMD);
+
+print " \n";
+if ($?) { print "$text{'pkg_failed'}\n"; } +else { print "$text{'pkg_ok'}
\n"; } +return @rv; +} + + +1; diff --git a/software/software-lib.pl b/software/software-lib.pl index 33474a841..67d1a2303 100755 --- a/software/software-lib.pl +++ b/software/software-lib.pl @@ -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";