diff options
-rwxr-xr-x | cdinit-ppc | bin | 69128 -> 74080 bytes | |||
-rw-r--r-- | cdinit.c | 27 |
2 files changed, 15 insertions, 12 deletions
Binary files differ @@ -91,7 +91,7 @@ bool cdi_find_media(void) udev = udev_new(); if(udev == NULL) { - fprintf(stderr, "Cannot establish link to udev.\n"); + fprintf(stderr, "Cannot establish udev link.\n"); return false; } @@ -135,15 +135,10 @@ bool cdi_find_media(void) continue; /* worthless */ } -#ifdef DEBUG - fprintf(stderr, "cdi_find_media: testing candidate %s\n", - dev_node); -#endif - if((fstype = blkid_get_tag_value(NULL, "TYPE", dev_node)) == NULL) { #ifdef DEBUG - fprintf(stderr, "cdi_find_media: %s has unknown FS\n", + fprintf(stderr, "cdi_find_media: %s: unknown FS\n", dev_node); #endif continue; @@ -151,10 +146,8 @@ bool cdi_find_media(void) if(mount(dev_node, "/media", fstype, MS_RDONLY, NULL) != 0) { -#ifdef DEBUG - fprintf(stderr, "cdi_find_media: %s cannot be mounted:" + fprintf(stderr, "cdi_find_media: mounting %s:" " %s\n", dev_node, strerror(errno)); -#endif free(fstype); continue; } @@ -163,7 +156,7 @@ bool cdi_find_media(void) if(access("/media/adelie.squashfs", F_OK) != 0) { #ifdef DEBUG - fprintf(stderr, "cdi_find_media: %s has no squash root:" + fprintf(stderr, "cdi_find_media: %s: system not found:" " %s\n", dev_node, strerror(errno)); #endif umount("/media"); @@ -224,6 +217,8 @@ bool cdi_find_media(void) int main(void) { pid_t our_pid; + bool found = false; + unsigned char tries = 4; #ifndef DEBUG if(getpid() != 1) @@ -297,7 +292,15 @@ int main(void) /* Now we need to iterate over the available block devices, trying to * find our CD media. */ - if(!cdi_find_media()) + found = cdi_find_media(); + while(!found && tries--) + { + fprintf(stderr, "Attempting to acquiesce...\n"); + sleep(5); + found = cdi_find_media(); + } + + if(!found) { fprintf(stderr, "FATAL: no boot media found\n"); return EXIT_FAILURE; |