Re: Debconf and PackageKit
I don't know if there is a better list to ask this
question but as people here know dpkg
well i'd like to know if there is some
way of telling it to use another fd as
stdin, I have done the following code
to handle answering to conffile prompts
but it works some times and other times it
doesn't... (a bit unpredictable):
This is the forked code, the parent
does a write(writeToChild[1], "n\n", 2);
if (m_child_pid == 0) {
cout << "FORKED: installPackages(): DoInstall" << endl;
// close Forked stdout and the read end of the pipe
close(readFromChildFD[0]);
close(writeToChildFD[1]);
// redirect writeToChildFD to stdin
if (dup2(writeToChildFD[0], 0) != 0) {
cerr << "dup2 failed to stdin" << endl;
close(readFromChildFD[1]);
close(writeToChildFD[0]);
_exit(1);
}
close(1);
// Change the locale AND lang to not get it localized
setenv("LANG", "C", 1);
setlocale(LC_ALL, "C");
// Pass the write end of the pipe to the install function
res = PM->DoInstallPostFork(readFromChildFD[1]);
// dump errors into cerr (pass it to the parent process)
_error->DumpErrors();
// HACK: try to correct the situation
if(res == pkgPackageManager::Failed) {
cerr << "Aptcc: A package failed to install. Trying to recover:" << endl;
system("dpkg --configure -a");
}
close(readFromChildFD[1]);
close(writeToChildFD[0]);
_exit(res);
}
Thanks,
Daniel.
____________________________________________________________________________________
Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com
Reply to: