diff -uNrp menu-2.1.15.old/install-menu/install-menu.cc menu-2.1.15/install-menu/install-menu.cc --- menu-2.1.15.old/install-menu/install-menu.cc 2004-06-29 18:48:28 +0400 +++ menu-2.1.15/install-menu/install-menu.cc 2004-07-22 21:50:47 +0400 @@ -507,7 +507,7 @@ void read_forcetree(parsestream &i) // methodinfo // methodinfo::methodinfo(parsestream &i) - : roots("/Debian"), mainmt("Debian"), treew("c(m)"), + : roots("/ALT Linux"), mainmt("ALT Linux"), treew("c(m)"), onlyrunasroot(false), onlyrunasuser(false), onlyuniquetitles(false), hint_optimize(false), hint_nentry(6), hint_topnentry(5), hint_mixedpenalty(15), hint_minhintfreq(0.1), diff -uNrp menu-2.1.15.old/Makefile.am menu-2.1.15/Makefile.am --- menu-2.1.15.old/Makefile.am 2004-05-24 03:35:27 +0400 +++ menu-2.1.15/Makefile.am 2004-07-22 21:50:47 +0400 @@ -1,4 +1,4 @@ -SUBDIRS = update-menus install-menu doc po-sections scripts po +SUBDIRS = update-menus install-menu doc EXTRA_DIST = autogen.sh Doxyfile dist-hook: mkdir $(distdir)/examples $(distdir)/default diff -uNrp menu-2.1.15.old/Makefile.in menu-2.1.15/Makefile.in --- menu-2.1.15.old/Makefile.in 2004-07-02 20:32:11 +0400 +++ menu-2.1.15/Makefile.in 2004-07-22 21:50:47 +0400 @@ -69,7 +69,7 @@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ VERSION = @VERSION@ -SUBDIRS = update-menus install-menu doc po-sections scripts po +SUBDIRS = update-menus install-menu doc EXTRA_DIST = autogen.sh Doxyfile ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs diff -uNrp menu-2.1.15.old/update-menus/update-menus.cc menu-2.1.15/update-menus/update-menus.cc --- menu-2.1.15.old/update-menus/update-menus.cc 2004-07-02 19:10:27 +0400 +++ menu-2.1.15/update-menus/update-menus.cc 2004-07-22 21:50:47 +0400 @@ -58,6 +58,8 @@ static const char * home_dir; set installed_packages; set menufiles_processed; +int verbose=0; +bool no_fork=false; translateinfo *transinfo; configinfo config; bool is_root; @@ -231,9 +233,18 @@ void configinfo::parse_config(const std: else if(value=="menu-2") compat = parsestream::eol_semicolon; } else if(key=="verbosity") { if (value=="quiet") verbosity=report_quiet; - else if(value=="normal") verbosity=report_normal; - else if(value=="verbose") verbosity=report_verbose; - else if(value=="debug") verbosity=report_debug; + else if(value=="normal") { + verbosity=report_normal; + verbose = 1; + } + else if(value=="verbose") { + verbosity=report_verbose; + verbose = 1; + } + else if(value=="debug") { + verbosity=report_debug; + verbose = 1; + } } else if(key=="method") { if (value=="stdout") method=method_stdout; else if(value=="stderr") method=method_stderr; @@ -818,7 +829,10 @@ void wait_dpkg(string &stdoutfile) } else { r = create_lock(); if (!r) - exit(1); + exit(0); + + if (!no_fork && !verbose) + stdoutfile = "/dev/null"; config.report(_("Dpkg is not locking dpkg status area, good."), configinfo::report_verbose); @@ -842,10 +856,12 @@ void usage(ostream &c) " --stdout Output menu list in format suitable for piping to\n" " install-menu.\n") << _( /* This is the end of the update-menus --help message*/ + " -N, --nofork Prevent update-menus to generate menus in background \n" " --version Output version information and exit.\n" ); } struct option long_options[] = { + { "nofork", no_argument, NULL, 'N' }, { "debug", no_argument, NULL, 'd' }, { "verbose", no_argument, NULL, 'v' }, { "help", no_argument, NULL, 'h' }, @@ -862,15 +878,20 @@ void parse_params(int argc, char **argv) { while(1) { - int c = getopt_long (argc, argv, "hvd", long_options, NULL); + int c = getopt_long (argc, argv, "hvdN", long_options, NULL); if (c == -1) break; switch(c) { + case 'N': + no_fork=true; + break; case 'v': + verbose = 1; config.set_verbosity(configinfo::report_verbose); break; case 'd': + verbose = 1; config.set_verbosity(configinfo::report_verbose); break; case 'n': @@ -958,6 +979,10 @@ int main (int argc, char **argv) string stdoutfile; struct stat st; + if (getenv("DURING_INSTALL")) { + exit(0); + } + setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); @@ -965,7 +990,15 @@ int main (int argc, char **argv) try { read_rootconfiginfo(); parse_params(argc, argv); + if (!no_fork) { + if (fork()) + exit(0); + } wait_dpkg(stdoutfile); + if (!no_fork) { + // close stdin only after lock file creation + close (0); + } if(!stdoutfile.empty()) { close(1); open(stdoutfile.c_str(), O_WRONLY|O_CREAT|O_SYNC|O_EXCL, 0666); @@ -1018,6 +1051,6 @@ int main (int argc, char **argv) if(!stdoutfile.empty()) if (!stat(stdoutfile.c_str(),&st)) - if (!st.st_size) + if(!st.st_size && strcmp(stdoutfile.c_str(),"/dev/null") != 0) unlink(stdoutfile.c_str()); }