Hi, split from install/38571. I would like to add the option to run etcupdate(8) from sysinst when doing an upgrade (after running postinstall). The patch introduces a new function run_program_nocurses which exits curses, starts etcupdate, and afterwards goes back to curses. You have to exit curses for this in order to see the top three lines. Objections? Regards, Julian
Index: defs.h =================================================================== RCS file: /cvsroot/src/distrib/utils/sysinst/defs.h,v retrieving revision 1.163 diff -u -r1.163 defs.h --- defs.h 22 Jun 2012 20:54:39 -0000 1.163 +++ defs.h 21 Sep 2012 21:30:58 -0000 @@ -428,6 +428,7 @@ /* From run.c */ int collect(int, char **, const char *, ...) __printflike(3, 4); +int run_program_nocurses(int, const char *); int run_program(int, const char *, ...) __printflike(2, 3); void do_logging(void); int do_system(const char *); Index: msg.mi.de =================================================================== RCS file: /cvsroot/src/distrib/utils/sysinst/msg.mi.de,v retrieving revision 1.70 diff -u -r1.70 msg.mi.de --- msg.mi.de 6 Jul 2012 21:10:56 -0000 1.70 +++ msg.mi.de 21 Sep 2012 21:31:01 -0000 @@ -1037,6 +1037,14 @@ manuell /etc/mailer.conf korrigieren, um funktionierende Mailauslieferung zu gewährleisten.} +message runetcupdate +{Wir werden jetzt etcupdate(8) ausführen, ein Programm, das bestehende +Konfigurationsdateien mit den neuen vergleicht und sie, wenn gewünscht, +zusammenfügt. Die alten Konfigurationsdateien zu behalten kann zu Fehlern im +neuen System führen. +Wollen Sie etcupdate ausführen? +} + message license {Um den Netzwerkadapter %s zu benutzen müssen Sie der Lizenz in der Datei %s zustimmen. Index: msg.mi.en =================================================================== RCS file: /cvsroot/src/distrib/utils/sysinst/msg.mi.en,v retrieving revision 1.175 diff -u -r1.175 msg.mi.en --- msg.mi.en 6 Jul 2012 21:10:56 -0000 1.175 +++ msg.mi.en 21 Sep 2012 21:31:02 -0000 @@ -972,6 +972,13 @@ postfix? If you choose "No" you will have to update /etc/mailer.conf yourself to ensure proper email delivery.} +message runetcupdate +{We will now run etcupdate(8), a tool which enables you to diff and merge your +configuration files with those of the new release. Keeping the old files might +cause errors on the system. +Do you want to run etcupdate? +} + message license {To use the network interface %s, you must agree to the license in file %s. To view this file now, you can type ^Z, look at the contents of Index: msg.mi.es =================================================================== RCS file: /cvsroot/src/distrib/utils/sysinst/msg.mi.es,v retrieving revision 1.47 diff -u -r1.47 msg.mi.es --- msg.mi.es 15 Sep 2012 17:56:28 -0000 1.47 +++ msg.mi.es 21 Sep 2012 21:31:04 -0000 @@ -1012,6 +1012,14 @@ actualizar /etc/mailer.conf usted mismo para asegurarse de que los mensajes de correo electrónico se envíen correctamente.} +/* XXX */ +message runetcupdate +{We will now run etcupdate(8), a tool which enables you to diff and merge your +configuration files with those of the new release. Keeping the old files might +cause errors on the system. +Do you want to run etcupdate? +} + message license {Para usar la interfaz de red %s, debe de aceptar la licencia en el archivo %s. Para ver este archivo ahora, pulse ^Z, mire el contendido del archivo, y luego Index: msg.mi.fr =================================================================== RCS file: /cvsroot/src/distrib/utils/sysinst/msg.mi.fr,v retrieving revision 1.129 diff -u -r1.129 msg.mi.fr --- msg.mi.fr 6 Jul 2012 21:10:56 -0000 1.129 +++ msg.mi.fr 21 Sep 2012 21:31:06 -0000 @@ -1077,6 +1077,14 @@ afin que vos courriels soient traités correctement. } +/* XXX */ +message runetcupdate +{We will now run etcupdate(8), a tool which enables you to diff and merge your +configuration files with those of the new release. Keeping the old files might +cause errors on the system. +Do you want to run etcupdate? +} + message license {Afin d'utiliser l'interface réseau : %s, vous devez accepter la licence contenue dans le fichier %s. Index: msg.mi.pl =================================================================== RCS file: /cvsroot/src/distrib/utils/sysinst/msg.mi.pl,v retrieving revision 1.86 diff -u -r1.86 msg.mi.pl --- msg.mi.pl 6 Jul 2012 21:10:56 -0000 1.86 +++ msg.mi.pl 21 Sep 2012 21:31:08 -0000 @@ -969,6 +969,14 @@ postfix? Jesli wybierzesz "Nie", trzeba bedzie recznie zmienic /etc/mailer.conf, aby dzialalo dostarczanie poczty.} +/* XXX */ +message runetcupdate +{We will now run etcupdate(8), a tool which enables you to diff and merge your +configuration files with those of the new release. Keeping the old files might +cause errors on the system. +Do you want to run etcupdate? +} + message license {Aby uzywac interfejsu sieciowego %s, musisz zgodzic sie na licencje zawarta w pliku %s. Index: run.c =================================================================== RCS file: /cvsroot/src/distrib/utils/sysinst/run.c,v retrieving revision 1.70 diff -u -r1.70 run.c --- run.c 26 Feb 2012 10:17:44 -0000 1.70 +++ run.c 21 Sep 2012 21:31:10 -0000 @@ -570,6 +570,82 @@ } /* + * launch a program inside a subwindow, and report its return status when done + */ +int +run_program_nocurses(int flags, const char *cmd) +{ + int status; + pid_t child, pid; + char **args; + + args = make_argv(cmd); + + /* Make curses save tty settings */ + def_prog_mode(); + + if (logfp) + fflush(logfp); + if (script) + fflush(script); + + child = fork(); + if (child == -1) { /* error */ + refresh(); + return -1; + } else if (child == 0) { /* child */ + /* silently stop curses */ + endwin(); + + if (logfp) { + fprintf(logfp, "executing: %s\n", cmd); + fclose(logfp); + logfp = NULL; + } + if (script) { + fprintf(script, "%s\n", cmd); + fclose(script); + script = NULL; + } + if (strcmp(args[0], "cd") == 0 && strcmp(args[2], "&&") == 0) { + target_chdir_or_die(args[1]); + args += 3; + } + if (flags & RUN_XFER_DIR) + target_chdir_or_die(xfer_dir); + /* + * If target_prefix == "", the chroot will fail, but + * that's ok, since we don't need it then. + */ + if (flags & RUN_CHROOT && *target_prefix() + && chroot(target_prefix()) != 0) + warn("chroot(%s) for %s", target_prefix(), *args); + else { + execvp(*args, args); + warn("execvp %s", *args); + } + _exit(EXIT_FAILURE); + // break; /* end of child */ + } else { /* parent */ + pid = waitpid(child, &status, 0); + } + + if (logfp) + fflush(logfp); + + reset_prog_mode(); + free_argv(args); + + if (WIFEXITED(status)) + return WEXITSTATUS(status); + else if (WIFSIGNALED(status)) + return WTERMSIG(status); + + /* Never reached. */ + return -1; +} + +/* * generic program runner. * flags: * RUN_DISPLAY display command name and output Index: util.c =================================================================== RCS file: /cvsroot/src/distrib/utils/sysinst/util.c,v retrieving revision 1.179 diff -u -r1.179 util.c --- util.c 19 Jul 2012 06:07:21 -0000 1.179 +++ util.c 21 Sep 2012 21:31:13 -0000 @@ -1078,6 +1078,11 @@ } run_program(RUN_DISPLAY | RUN_CHROOT, "/usr/sbin/postinstall -s /.sysinst -d / fix"); + + msg_display(MSG_runetcupdate); + process_menu(MENU_yesno, NULL); + if (yesno) + run_program_nocurses(RUN_CHROOT, "/usr/sbin/etcupdate -s /.sysinst"); } /* Configure the system */
Attachment:
signature.asc
Description: PGP signature