- if (l_initrd) {
- *p++ = "--initrd"; /* 2 */
- *p++ = l_initrd; /* 3 */
- }
-
- if (args) {
- *p++ = "--append"; /* 4 */
- *p++ = args; /* 5 */
- }
-
- /* First try by telling kexec to run shutdown */
-
- *(p + 0) = l_image;
- *(p + 1) = NULL;
-
- result = pb_run_cmd(argv);
-
- /* kexec will return zero on success */
- /* On error, force a kexec with the -f option */
-
- if (result) {
- *(p + 0) = "-f"; /* 6 */
- *(p + 1) = l_image; /* 7 */
- *(p + 2) = NULL; /* 8 */
-
- result = pb_run_cmd(argv);
- }
-
- if (result)
- pb_log("%s: failed: (%d)\n", __func__, result);
-
- return result;
-}
-
-/**
- * pb_run_kexec - Run kexec with the supplied boot options.
- *
- * For the convenience of the user, tries to load both files before
- * returning error.
- */
-
-int pb_run_kexec(const struct pb_kexec_data *kd)
-{
- int result;
- char *l_image;
- char *l_initrd;
-
- pb_log("%s: image: '%s'\n", __func__, kd->image);
- pb_log("%s: initrd: '%s'\n", __func__, kd->initrd);
- pb_log("%s: args: '%s'\n", __func__, kd->args);
-
- if (kd->image)
- l_image = pb_load_file(NULL, kd->image);
- else {
- l_image = NULL;
- pb_log("%s: error null image\n", __func__);
- }
+ argv = talloc_array(process, const char *, 2);
+ name = talloc_asprintf(process, "%s/sbin/pb-discover",
+ pb_system_apps.prefix);