Skip to content

Instantly share code, notes, and snippets.

@ramcq
Last active September 1, 2016 14:01
Show Gist options
  • Save ramcq/86a0d7c3521b89d749c0fcd6528592ff to your computer and use it in GitHub Desktop.
Save ramcq/86a0d7c3521b89d749c0fcd6528592ff to your computer and use it in GitHub Desktop.
static gboolean
check_for_live_boot ()
{
GError *error = NULL;
gchar *cmdline = NULL;
gboolean live_boot = FALSE;
if (g_file_get_contents ("/proc/cmdline", &cmdline, NULL, &error))
{
g_printerr ("unable to read /proc/cmdline: %s\n", error->message);
g_error_free (error);
return;
}
live_boot = g_regex_match_simple ("\\bendless\\.live_boot\\b", cmdline, 0, 0);
g_print ("set live_boot to %u from /proc/cmdline: %s\n", live_boot, cmdline);
g_free (cmdline);
return live_boot;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment