summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2018-01-30 12:47:47 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2018-01-30 12:47:47 -0600
commitd0032dedcbb36dd22f52b11ed858bb828c1d15f3 (patch)
tree2560012d93a3d8462fb497b09cdaa342243f19fd
parent7f53ffe632aa2d27c47aaaa37c085386e50e3324 (diff)
downloadimage-d0032dedcbb36dd22f52b11ed858bb828c1d15f3.tar.gz
image-d0032dedcbb36dd22f52b11ed858bb828c1d15f3.tar.bz2
image-d0032dedcbb36dd22f52b11ed858bb828c1d15f3.tar.xz
image-d0032dedcbb36dd22f52b11ed858bb828c1d15f3.zip
cdinit: Wait 5 seconds and try again if no system is found
-rwxr-xr-xcdinit-ppcbin69128 -> 74080 bytes
-rw-r--r--cdinit.c27
2 files changed, 15 insertions, 12 deletions
diff --git a/cdinit-ppc b/cdinit-ppc
index 5739320..3a478c9 100755
--- a/cdinit-ppc
+++ b/cdinit-ppc
Binary files differ
diff --git a/cdinit.c b/cdinit.c
index 6ee72a8..c24134e 100644
--- a/cdinit.c
+++ b/cdinit.c
@@ -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;