diff --git a/software/csw-lib.pl b/software/csw-lib.pl index 29646fc28..70efb40f1 100644 --- a/software/csw-lib.pl +++ b/software/csw-lib.pl @@ -10,51 +10,56 @@ sub update_system_install { local $update = $_[0] || $in{'update'}; local (@rv, @newpacks, %seen, $failed); -print "",&text('csw_install', "$pkg_get -i $update"),"
\n"; + +# Setup for non-interactive mode +©_source_dest("/var/pkg-get/admin", "/var/pkg-get/admin-old"); +©_source_dest("/var/pkg-get/admin-fullauto", "/var/pkg-get/admin"); + +# Run pkg-get $| = 1; -print "
";
-local ($ph, $ppid) = &foreign_call("proc", "pty_process_exec_logged",
- "$pkg_get -i ".quotemeta($update));
-while(1) {
- local $wf = &wait_for($ph, '(.*) \[\S+\]',
- 'Installation of <(.*)> failed',
- 'Installation of <(.*)> was successful',
- 'No changes were made to the system',
- '.*\n', '.*\r');
- if ($wait_for_input !~ /^\s*\d+\%\s+\[/) {
- # Print everything except download line
- print &html_escape($wait_for_input);
+local ($failed, $retry, %already);
+do {
+ if ($already{$update}++) {
+ # Don't try the same update twice
+ last;
}
- if ($wf == 0) {
- # some question which should not have appeared before
- if ($seen{$matches[1]}++ > 3) {
- $failed++;
- last;
+ print "",&text('csw_install',
+ "$pkg_get -i -f $update"),"\n";
+ $failed = 0;
+ $retry = 0;
+ print "
";
+ &open_execute_command(PKGGET, "$pkg_get -i -f ".quotemeta($update), 1);
+ while() {
+ if (!/^\s*\d+\%\s+\[/) {
+ # Output everything except download lines
+ print &html_escape($_);
+ }
+ if (/Installation of <(.*)> was successful/i) {
+ push(@rv, $1);
+ }
+ elsif (/Installation of <(.*)> failed/i) {
+ $failed = 1;
+ }
+ elsif (/dependancy\s+(\S+)\s+.*not up to date/i) {
+ # Needs a dependecy .. so we will need to re-run!
+ local $dep = $1;
+ $update = join(" ", &unique(
+ $dep, split(/\s+/, $update)));
+ $retry = 1;
}
- &sysprint($ph, "y\n");
}
- elsif ($wf == 1) {
- # This package contains scripts
- $failed++;
- last;
+ close(PKGGET);
+ print "
";
+
+ if ($retry) {
+ print "$text{'csw_retry'}\n";
}
- elsif ($wf == 1 || $wf == 3) {
- # failed for some reason.. give up
- $failed++;
- last;
- }
- elsif ($wf == 2) {
- # done ok!
- push(@rv, $matches[1]);
- }
- elsif ($wf == -1) {
- # No more output
- last;
- }
- }
-print "
";
-close($ph);
-if ($failed) {
+ } while ($retry);
+
+# Cleanup fullout file
+©_source_dest("/var/pkg-get/admin-old", "/var/pkg-get/admin");
+
+if ($? || $failed) {
print "$text{'csw_failed'}\n"; return ( ); } diff --git a/software/lang/en b/software/lang/en index b18e9dcb1..1728e26a9 100644 --- a/software/lang/en +++ b/software/lang/en @@ -334,6 +334,7 @@ csw_input=Package from CSW csw_install=Installing package(s) with command $1 .. csw_ok=.. install complete. csw_failed=.. install failed! +csw_retry=.. trying again with new dependencies. csw_find=Browse CSW .. csw_package=Package csw_version=Version