Rewrite grub-install, grub-mkrescue, grub-mkstandalone and grub-mknetdir

the function of these files exceeds what can be sanely handled in shell
	in posix-comaptible way. Also writing it in C extends the functionality
	to non-UNIX-like OS and minimal environments.
This commit is contained in:
Vladimir Serbinenko 2013-11-16 20:21:16 +01:00
parent 9ef81064a3
commit cd46aa6cef
52 changed files with 5811 additions and 2101 deletions

48
include/grub/emu/config.h Normal file
View file

@ -0,0 +1,48 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2013 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_CONFIG_EMU_HEADER
#define GRUB_CONFIG_EMU_HEADER 1
#include <grub/disk.h>
#include <grub/partition.h>
#include <grub/emu/hostfile.h>
#include <stdio.h>
const char *
grub_util_get_config_filename (void);
const char *
grub_util_get_pkgdatadir (void);
const char *
grub_util_get_pkglibdir (void);
const char *
grub_util_get_localedir (void);
struct grub_util_config
{
int is_cryptodisk_enabled;
char *grub_distributor;
};
void
grub_util_load_config (struct grub_util_config *cfg);
void
grub_util_parse_config (FILE *f, struct grub_util_config *cfg, int simple);
#endif

View file

@ -20,8 +20,10 @@
#define GRUB_UTIL_GETROOT_HEADER 1
#include <grub/types.h>
#include <grub/device.h>
#include <sys/types.h>
#include <stdio.h>
enum grub_dev_abstraction_types {
GRUB_DEV_ABSTRACTION_NONE,
@ -89,4 +91,14 @@ grub_util_get_grub_dev_os (const char *os_dev);
grub_disk_addr_t
grub_util_find_partition_start_os (const char *dev);
char *
grub_util_guess_bios_drive (const char *orig_path);
char *
grub_util_guess_efi_drive (const char *orig_path);
char *
grub_util_guess_baremetal_drive (const char *orig_path);
void
grub_util_fprint_full_disk_name (FILE *f,
const char *drive, grub_device_t dev);
#endif /* ! GRUB_UTIL_GETROOT_HEADER */

View file

@ -31,6 +31,11 @@ grub_util_is_special_file (const char *path);
int
grub_util_is_regular (const char *path);
char *
grub_util_path_concat (size_t n, ...);
char *
grub_util_path_concat_ext (size_t n, ...);
int
grub_util_fd_seek (grub_util_fd_t fd, grub_uint64_t off);
ssize_t
@ -49,5 +54,13 @@ EXPORT_FUNC(grub_util_fd_close) (grub_util_fd_t fd);
grub_uint64_t
grub_util_get_fd_size (grub_util_fd_t fd, const char *name, unsigned *log_secsize);
char *
grub_util_make_temporary_file (void);
char *
grub_util_make_temporary_dir (void);
void
grub_util_unlink_recursive (const char *name);
grub_uint32_t
grub_util_get_mtime (const char *name);
#endif /* ! GRUB_BIOSDISK_MACHINE_UTIL_HEADER */