summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2002-03-01 00:14:50 +0000
committerJeremy Katz <katzj@redhat.com>2002-03-01 00:14:50 +0000
commited6af67530adfa19b2d7d4f587e3a7c5c7ddaa9b (patch)
tree71ee2f4b3a0ba64cc0ccf12cb5e9b5e4d6810c4d
parent69265e3d015ee6004eaf8c11eca6aa6a4c5ec01b (diff)
downloadanaconda-ed6af67530adfa19b2d7d4f587e3a7c5c7ddaa9b.tar.gz
anaconda-ed6af67530adfa19b2d7d4f587e3a7c5c7ddaa9b.tar.xz
anaconda-ed6af67530adfa19b2d7d4f587e3a7c5c7ddaa9b.zip
verify that your boot image matches your stage 2 and reboot otherwise, since anything else is nonsense :)
-rw-r--r--loader/loader.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/loader/loader.c b/loader/loader.c
index 9cd3472db..2f0679064 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -2985,6 +2985,41 @@ static void checkForRam(int flags) {
}
}
+/* verify that the stamp files in / of the initrd and the stage2 match */
+static void verifyImagesMatched() {
+ char *stamp1;
+ char *stamp2;
+ FILE *f;
+
+ stamp1 = alloca(13);
+ stamp2 = alloca(13);
+
+ /* grab the one from the initrd */
+ f = fopen("/.buildstamp", "r");
+ if (!f) {
+ /* hrmm... not having them won't be fatal for now */
+ return;
+ }
+ fgets(stamp1, 13, f);
+
+ /* and the runtime */
+ f = fopen("/mnt/runtime/.buildstamp", "r");
+ if (!f) {
+ return;
+ }
+ fgets(stamp2, 13, f);
+
+ if (strncmp(stamp1, stamp2, 12) != 0) {
+ newtWinMessage(_("Error"), _("OK"),
+ _("The second stage of the install which you have "
+ "selected does not match the boot disk which you "
+ "are using. This shouldn't happen, and I'm "
+ "rebooting your system now."));
+ exit(1);
+ }
+}
+
+
int main(int argc, char ** argv) {
char ** argptr;
char * anacondaArgs[50];
@@ -3300,6 +3335,8 @@ int main(int argc, char ** argv) {
spawnShell(flags); /* we can attach gdb now :-) */
+ verifyImagesMatched();
+
/* XXX should free old Deps */
modDeps = mlNewDeps();
mlLoadDeps(&modDeps, "/modules/modules.dep");