NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: install/38571: sysinst runs "postinstall fix"
The following reply was made to PR install/38571; it has been noted by GNATS.
From: Julian Djamil Fagir <gnrp%komkon2.de@localhost>
To: gnats-bugs%gnats.netbsd.org@localhost
Cc:
Subject: Re: install/38571: sysinst runs "postinstall fix"
Date: Wed, 29 Feb 2012 02:30:29 +0100
--MP_/joB4JmgFVA+c7H_120kwHN4
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Hi,
the attached patch fixes that issue for me. On the one hand, it introduces a
new function that exits curses, executes a command and afterwards returns.
This function is used to execute etcupdate(8) in case the user wants it.
Please carefully look at that patch, I only have one (virtual) machine to
test sysinst, and I'm not that sure about the curses part (though it works
for me).
Regards, Julian
PS: In advance: I'm sorry if my mailer breaks encoding again by making it
quoted-printable.
--MP_/joB4JmgFVA+c7H_120kwHN4
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=defs.h.diff
--- defs.h
+++ defs.h
@@ -400,10 +400,11 @@
void mnt_net_config(void);
/* From run.c */
int collect(int, char **, const char *, ...) __printflike(3, 4);
int run_program(int, const char *, ...) __printflike(2, 3);
+int launch_command(int, const char *);
void do_logging(void);
int do_system(const char *);
/* from upgrade.c */
void do_upgrade(void);
--MP_/joB4JmgFVA+c7H_120kwHN4
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=menus.mi.diff
--- menus.mi
+++ menus.mi
@@ -374,10 +374,16 @@
yesno = 0;
#endif
};
option MSG_other, exit, action
{ yesno = 0; };
+
+menu runpostinst, title MSG_Run_Postinst, y=-5;
+ option MSG_Postinst, exit, action { *(int *)arg = 0; };
+ option MSG_Etcupdate, exit, action { *(int *)arg = 1; };
+ option MSG_Skip_postinst, exit, action { *(int *)arg = 2; };
+ option MSG_Abandon, exit, action { *(int *)arg = 3; };
menu rootsh, title MSG_Root_shell;
option "/bin/sh", exit, action {*(const char **)arg = "/bin/sh";};
option "/bin/ksh", exit, action {*(const char **)arg = "/bin/ksh";};
option "/bin/csh", exit, action {*(const char **)arg = "/bin/csh";};
--MP_/joB4JmgFVA+c7H_120kwHN4
Content-Type: text/x-patch
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename=msg.mi.de.diff
--- msg.mi.de
+++ msg.mi.de
@@ -106,10 +106,22 @@
Zu diesem Zeitpunkt sollten Sie bereits eine vollst=E4ndige
Datensicherung durchgef=FChrt haben! Wollen Sie NetBSD wirklich aktualisie=
ren?
(Dies ist die letzte Warnung, bevor Ihre Festplatte(n) modifiziert werden.)
}
=20
+message Run_Postinst
+{Dateien in /etc updaten}
+
+message Postinst
+{postinst ausf=FChren (existierende Konfiguration =FCberschreiben)}
+
+message Etcupdate
+{etcupdate ausf=FChren (zu jeder ge=E4nderten Datei nachfragen)}
+
+message Skip_postinst
+{Keine Dateien in /etc updaten}
+
message reinstallusure
{Im folgenden werden die NetBSD Distributionssets (Kernel + Basissystem)
auf eine vorbereitete Festplatte ausgepackt. Diese Prozedur l=E4dt und ent=
packt
die Sets auf eine im Vorfeld partitionierte und bootf=E4hige Festplatte au=
s.
Es werden weder Festplatten gelabelt, Bootbl=F6cke aktualisiert noch beste=
hende
@@ -122,10 +134,13 @@
Wollen Sie die NetBSD Distributionssets wirklich erneut installieren?
(Dies ist die letzte Warnung, bevor die Inhalte Ihres Dateisystems
=FCberschrieben werden!)
}
=20
+message mount_failed
+{Versuch, %s zu mounten ist fehlgeschlagen. Fortfahren?
+}
=20
message nodisk
{Ich kann keine f=FCr NetBSD nutzbaren Festplatten finden.
Zur=FCck zum Hauptmen=FC...
}
@@ -709,13 +724,13 @@
{Erstelle Ger=E4tedateien in /dev ...
}
=20
message badfs
{Das Dateisystem auf /dev/%s%c scheint kein BSD-Dateisystem zu sein,
-die Pr=FCfung des Dateisystems (fsck) ist fehlgeschlagen.
+die Pr=FCfung des Dateisystems (fsck) ist fehlgeschlagen (Fehler %d).
=20
-Die Aktualisierung wird abgebrochen. (Fehlernummer %d.)
+Die Aktualisierung trotzdem fortsetzen?
}
=20
message rootmissing
{Das Zielverzeichnis %s existiert nicht.
}
--MP_/joB4JmgFVA+c7H_120kwHN4
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=msg.mi.en.diff
--- msg.mi.en
+++ msg.mi.en
@@ -102,10 +102,22 @@
before this procedure! Do you really want to upgrade NetBSD?
(This is your last warning before this procedure starts modifying your
disks.)
}
+message Run_Postinst
+{Update files in /etc}
+
+message Postinst
+{Execute postinst (overwrite existing configuration)}
+
+message Etcupdate
+{Execute etcupdate (ask for every overwrite)}
+
+message Skip_postinst
+{Don't update any file on /etc}
+
message reinstallusure
{Ok, let's unpack the NetBSD distribution sets to a bootable hard disk.
This procedure just fetches and unpacks sets onto an pre-partitioned
bootable disk. It does not label disks, upgrade bootblocks, or save
any existing configuration info. (Quit and choose `install' or
@@ -115,10 +127,13 @@
Do you really want to reinstall NetBSD distribution sets?
(This is your last warning before this procedure starts modifying your
disks.)
}
+message mount_failed
+{Mounting %s failed. Continue?
+}
message nodisk
{I can not find any hard disks for use by NetBSD. You will be
returned to the original menu.
}
@@ -678,11 +693,11 @@
{Making device nodes ...
}
message badfs
{It appears that /dev/%s%c is not a BSD file system or the fsck was
-not successful. The upgrade has been aborted. (Error number %d.)
+not successful (Error number %d.). Try mounting it anyway?
}
message rootmissing
{ target root is missing %s.
}
--MP_/joB4JmgFVA+c7H_120kwHN4
Content-Type: text/x-patch
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename=msg.mi.es.diff
--- msg.mi.es
+++ msg.mi.es
@@ -108,10 +108,22 @@
completa antes de este procedimiento! =BFRealmente desea actualizar NetBS=
D?
(=C9ste es su =FAltimo aviso antes de que el programa empiece a modificar
sus discos.)
}
=20
+message Run_Postinst
+{Update files in /etc}
+
+message Postinst
+{Execute postinst (overwrite existing configuration)}
+
+message Etcupdate
+{Execute etcupdate (ask for every overwrite)}
+
+message Skip_postinst
+{Don't update any file on /etc}
+
message reinstallusure
{Se va a desempaquetar los conjuntos de distribuci=F3n de NetBSD
a un disco duro marcado como arrancable. Este procedimiento solamente
descarga y desempaqueta los conjuntos en un disco arrancable preparticiona=
do.
No pone nombre a los discos, ni actualiza los bloques de arranque, ni guar=
da
@@ -122,10 +134,13 @@
=BFRealmente quiere reinstalar los conjuntos de la distribuci=F3n NetBSD?
(=C9ste es su =FAltimo aviso antes de que el programa empiece a modificar
sus discos.)
}
=20
+message mount_failed
+{Mounting %s failed. Continue?
+}
=20
message nodisk
{No se ha podido encontrar ning=FAn disco duro para ser usado por NetBSD.
Se le volver=E1 a llevar al men=FA original.
}
@@ -699,11 +714,11 @@
{Creando nodos de dispositivo ...
}
=20
message badfs
{Parece que /dev/%s%c no es un sistema de archivos BSD o el fsck no ha sido
-correcto. La actualizaci=F3n ha sido interrumpida. (Error n=FAmero %d.)
+correcto (Error n=FAmero %d.) =BFContinuar?
}
=20
message rootmissing
{ el directorio ra=EDz objetivo no existe %s.
}
--MP_/joB4JmgFVA+c7H_120kwHN4
Content-Type: text/x-patch
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename=msg.mi.fr.diff
--- msg.mi.fr
+++ msg.mi.fr
@@ -107,10 +107,22 @@
Voulez-vous vraiment mettre =E0 jour NetBSD ?
(Ceci est le dernier avertissement avant que cette
proc=E9dure ne modifie votre disque.)
}
=20
+message Run_Postinst
+{Update files in /etc}
+
+message Postinst
+{Execute postinst (overwrite existing configuration)}
+
+message Etcupdate
+{Execute etcupdate (ask for every overwrite)}
+
+message Skip_postinst
+{Don't update any file on /etc}
+
message reinstallusure
{D=E9compressons maintenant les composants de NetBSD sur un disque dur
d=E9marrable.
Cette proc=E9dure va rapatrier et d=E9compresser les composants
sur un disque d=E9marrable d=E9j=E0 partitionnn=E9.
@@ -122,10 +134,14 @@
ou une mise =E0 jour avant de d=E9marrer cette proc=E9dure !
=20
Voulez-vous r=E9ellement r=E9installer les composants NetBSD ?
(Ceci est le dernier avertissement avant que cette proc=E9dure ne commence=
=E0
modifier vos disques.)
+}
+
+message mount_failed
+{Mounting %s failed. Continue?
}
=20
message nodisk
{Nous ne trouvons aucun disque utilisable par NetBSD. Vous allez retourner
au menu pr=E9c=E9dent.
@@ -740,13 +756,13 @@
}
=20
message badfs
{
/dev/%s%c ne semble pas =EAtre un syst=E8me de fichiers BSD ou bien
-la v=E9rification de son int=E9grit=E9 par fsck a =E9chou=E9.
+la v=E9rification de son int=E9grit=E9 par fsck a =E9chou=E9, code d'erreu=
r %d.
=20
-Interruption de la proc=E9dure de mise =E0 jour, code d'erreur %d.
+Souhaitez-vous continuer mise =E0 jour?
}
=20
message rootmissing
{
Impossible de trouver la racine du disque cible %s.
--MP_/joB4JmgFVA+c7H_120kwHN4
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=msg.mi.pl.diff
--- msg.mi.pl
+++ msg.mi.pl
@@ -106,10 +106,22 @@
przed rozpoczeciem! Czy napewno chcesz zaktualizowac NetBSD?
(Jest to ostatnie ostrzezenie zanim zacznie sie modyfikacja danych na
twoich dyskach.)
}
+message Run_Postinst
+{Update files in /etc}
+
+message Postinst
+{Execute postinst (overwrite existing configuration)}
+
+message Etcupdate
+{Execute etcupdate (ask for every overwrite)}
+
+message Skip_postinst
+{Don't update any file on /etc}
+
message reinstallusure
{Ok, rozpakujmy pakiety dystrybucyjne NetBSD na bootowalny twardy dysk.
Ta procedura tylko sciaga i rozpakowuje pakiety na pre-partycjonowany
bootowalny dysk. Nie nazywa dyskow, aktualizuje bootblokow, lub zapisuje
istniejacej konfiguracji. (Wyjdz i wybierz `instaluj' lub
@@ -119,10 +131,13 @@
Czy napewno chcesz przeinstalowac pakiety dystrybucjne NetBSD?
(Jest to ostatnie ostrzezenie zanim zacznie sie modyfikacja danych na
twoich dyskach.)
}
+message mount_failed
+{Mounting %s failed. Continue?
+}
message nodisk
{Nie moge znalezc zadnych twardych dyskow do uzycia z NetBSD. Zostaniesz
przeniesiony do menu glownego.
}
@@ -677,10 +692,14 @@
message badfs
{Wyglada na to, ze /dev/%s%c nie jest systemem plikow BSD albo nie powiodlo
sie
jego sprawdzenie. Aktualizacja zostala przerwana. (Blad numer %d.)
}
+/* XXX: Translate:
+ * -not successful. The upgrade has been aborted. (Error number %d.)
+ * +not successful (Error number %d.). Try mounting it anyway?
+ */
message rootmissing
{ docelowy / jest zagubiony %s.
}
--MP_/joB4JmgFVA+c7H_120kwHN4
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=run.c.diff
--- run.c
+++ run.c
@@ -564,10 +564,86 @@
if (WIFSIGNALED(status)) {
*errstr = msg_string(MSG_Command_ended_on_signal);
return WTERMSIG(status);
}
return 0;
+}
+
+/*
+ * launch a program inside a subwindow, and report its return status when done
+ */
+int
+launch_command(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:
--MP_/joB4JmgFVA+c7H_120kwHN4
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=util.c.diff
--- util.c
+++ util.c
@@ -1061,10 +1061,12 @@
* otherwise /var/db/obsolete will only have current information
* from the base, comp, and etc sets.
*/
if (update && (set_status[SET_ETC] & SET_INSTALLED)) {
int oldsendmail;
+ int runpostinstall;
+
oldsendmail = run_program(RUN_DISPLAY | RUN_CHROOT |
RUN_ERROR_OK | RUN_PROGRESS,
"/usr/sbin/postinstall -s /.sysinst
-d / check mailerconf");
if (oldsendmail == 1) {
msg_display(MSG_oldsendmail);
@@ -1072,12 +1074,38 @@
if (yesno) {
run_program(RUN_DISPLAY | RUN_CHROOT,
"/usr/sbin/postinstall -s /.sysinst
-d / fix mailerconf");
}
}
- run_program(RUN_DISPLAY | RUN_CHROOT,
- "/usr/sbin/postinstall -s /.sysinst -d / fix");
+
+ runpostinstall = run_program(RUN_DISPLAY | RUN_CHROOT |
RUN_ERROR_OK
+ | RUN_PROGRESS,
+ "/usr/sbin/postinstall -s /.sysinst -d /
check");
+ if (runpostinstall == 1) {
+ process_menu(MENU_runpostinst, &runpostinstall);
+ /* runpostinstall:
+ * 0: postinstall fix
+ * 1: etcupdate
+ * 2: continue
+ * 3: abandon installation
+ */
+ switch(runpostinstall) {
+ case 0:
+ run_program(RUN_DISPLAY | RUN_CHROOT,
+ "/usr/sbin/postinstall -s
/.sysinst -d / fix");
+ break;
+ case 1:
+ launch_command(RUN_CHROOT,
+ "/usr/sbin/etcupdate -s
/.sysinst");
+ break;
+ case 2:
+ break;
+ case 3:
+ return -1;
+ break;
+ }
+ }
}
/* Configure the system */
if (set_status[SET_BASE] & SET_INSTALLED)
run_makedev();
--MP_/joB4JmgFVA+c7H_120kwHN4--
Home |
Main Index |
Thread Index |
Old Index