ostadmin: Import latest grubby.c from Git
grubby: Add forward declarations for functions

Certain compilers may spit out a huge amount of warnings about
missing prototypes, or even fail to compile grubby.c if they
default to the C99 standard. This adds the missing prototypes
at the beginning of the source file, also marking the functions
as static -- they are not going to be used anywhere else after
all.
grubby: Add "const" specifier to function arguments

Functions addNewKernel() and getInitrdVal() do not modify their arguments,
so it is safe to mark them as "const". Also, the compiler can make extra
checks and optimizations this way.
grubby: Avoid string duplication calling dirname()

The dirname() function does not modify its argument, so it is uneeded to
duplicate the string passed to it.
grubby: Make grubby source amenable to inclusion

Wraps the main() function of grubby and some of the includes inside
GRUBBY_AS_LIBRARY defines, in such a way that its code is suitable
for inclusion in other source files, like this:

  #define GRUBBY_AS_LIBRARY
  #include "grubby.c"

Also, some functions in grubby.c use abort() to stop execution. This
is not friendly when done from a library, so when GRUBBY_AS_LIBRARY
is defined the uses of abort() are redefined:

* addNewKernel() will return -1 on error, instead of aborting.
* addLine() will return NULL on error, instead of aborting.
grubby: Avoid C99 declaration inside for-loop

Avoids declaring an integer variable inside the initializer of a for-loop.
This patch avoids needing to compile the source in C99 mode.
grubby: Allow using glib functions, avoid popt dependency

When defining GRUBBY_USE_GLIB, function sdupprintf() will be redefined
to use g_strdup_printf() instead. Also, uses of poptParseArgvString()
are replaced to corresponding calls to g_shell_parse_argv(), thus
completely avoding the libpopt dependency when both GRUBBY_USE_GLIB
and GRUBBY_AS_LIBRARY.
ostadmin: Add the OtAdminBootloader class

The OtAdminBootloader class defines a singleton which can be used
to inspect and modify the configuration of boot loaders installed
in the system. So far, it can do the following:

* Probing which boot loaders are available.
* Checking whether a particular entry is defined.
* Adding new entries to the boot loaders.
ostadmin: Use OtAdminBootloader instead of grubby

Instead of spawning grubby, use OtAdminBootloader to check and add entries
to the bootloader configuration file.
ostadmin: Remove unused grep_literal() function

Now that OtAdminBootloader is used, it is no longer needed for the
implementation of the "deploy" command to grep the Grub configuration
file, ot_admin_bootloader_has_entry() is used instead.
ostadmin: Function to free Grubby config structs

Unfortunately grubby.c does not include a function to free a
struct grubConfig, so define one, plus the ot_lgrubcfg macro
to conveniently free those structures when they go out of
scope.
ostadmin: Use access(2) to check for config existence
ostadmin: Canonicalize paths for addNewKernel()

Kernel and initrd paths have to be full canonicalized paths to pass them to
addNewKernel(). For sanity, it is also checked that the full paths are
inside the boot prefix directory.