From: Arne Fitzenreiter Date: Thu, 2 Dec 2010 22:07:35 +0000 (+0100) Subject: Installer: if installer was run with serial console patch grub and inittab. X-Git-Tag: v2.9-beta1~30 X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=commitdiff_plain;h=5faa66cfda185c9f7148c886262fddd24be75f3a Installer: if installer was run with serial console patch grub and inittab. --- diff --git a/src/install+setup/install/main.c b/src/install+setup/install/main.c index ca2d5bd619..cb697a1524 100644 --- a/src/install+setup/install/main.c +++ b/src/install+setup/install/main.c @@ -70,6 +70,7 @@ int main(int argc, char *argv[]) char *yesnoharddisk[3]; // char *yesnoharddisk = { "NO", "YES", NULL }; int unattended = 0; + int serialconsole = 0; struct keyvalue *unattendedkv = initkeyvalues(); int hardyn = 0; char restore_file[STRING_SIZE] = ""; @@ -110,6 +111,10 @@ int main(int argc, char *argv[]) unattended = 1; runcommandwithstatus("/bin/sleep 10", "WARNING: Unattended installation will start in 10 seconds..."); } + // check if we have to patch for serial console + if (strstr (line, "console=ttyS0") != NULL) { + serialconsole = 1; + } } // Read gpl ... @@ -511,7 +516,25 @@ int main(int argc, char *argv[]) errorbox(ctr[TR_UNABLE_TO_INSTALL_GRUB]); goto EXIT; } - + + /* Serial console ? */ + if (serialconsole) { + /* grub */ + replace("/harddisk/boot/grub/grub.conf", "splashimage", "#splashimage"); + replace("/harddisk/boot/grub/grub.conf", "#serial", "serial"); + replace("/harddisk/boot/grub/grub.conf", "#terminal", "terminal"); + replace("/harddisk/boot/grub/grub.conf", " panic=10 ", " console=ttyS0,38400 panic=10 "); + + /*inittab*/ + replace("/harddisk/etc/inittab", "1:2345:respawn:", "#1:2345:respawn:"); + replace("/harddisk/etc/inittab", "2:2345:respawn:", "#2:2345:respawn:"); + replace("/harddisk/etc/inittab", "3:2345:respawn:", "#3:2345:respawn:"); + replace("/harddisk/etc/inittab", "4:2345:respawn:", "#4:2345:respawn:"); + replace("/harddisk/etc/inittab", "5:2345:respawn:", "#5:2345:respawn:"); + replace("/harddisk/etc/inittab", "6:2345:respawn:", "#6:2345:respawn:"); + replace("/harddisk/etc/inittab", "#7:2345:respawn:", "7:2345:respawn:"); + } + /* Copy restore file from cdrom */ if (unattended && (strlen(restore_file) > 0)) { fprintf(flog, "unattended: Copy restore file\n");