]> git.ipfire.org Git - thirdparty/grub.git/blob - grub-core/osdep/aros/config.c
Clarify several translatable messages.
[thirdparty/grub.git] / grub-core / osdep / aros / config.c
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 1999,2000,2001,2002,2003,2004,2006,2007,2008,2009,2010,2011,2012,2013 Free Software Foundation, Inc.
4 *
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #include <config.h>
20 #include <config-util.h>
21
22 #include <grub/emu/hostdisk.h>
23 #include <grub/emu/exec.h>
24 #include <grub/emu/config.h>
25 #include <grub/util/install.h>
26 #include <grub/util/misc.h>
27 #include <string.h>
28 #include <sys/types.h>
29 #include <sys/wait.h>
30 #include <errno.h>
31 #include <stdlib.h>
32
33 const char *
34 grub_util_get_config_filename (void)
35 {
36 static char *value = NULL;
37 if (!value)
38 value = grub_util_path_concat (3, GRUB_SYSCONFDIR,
39 "default", "grub");
40 return value;
41 }
42
43 const char *
44 grub_util_get_pkgdatadir (void)
45 {
46 const char *ret = getenv ("pkgdatadir");
47 if (ret)
48 return ret;
49 return GRUB_DATADIR "/" PACKAGE;
50 }
51
52 const char *
53 grub_util_get_pkglibdir (void)
54 {
55 return GRUB_LIBDIR "/" PACKAGE;
56 }
57
58 const char *
59 grub_util_get_localedir (void)
60 {
61 return LOCALEDIR;
62 }
63
64 void
65 grub_util_load_config (struct grub_util_config *cfg)
66 {
67 const char *cfgfile;
68 FILE *f = NULL;
69 const char *v;
70
71 memset (cfg, 0, sizeof (*cfg));
72
73 v = getenv ("GRUB_ENABLE_CRYPTODISK");
74 if (v && v[0] == 'y' && v[1] == '\0')
75 cfg->is_cryptodisk_enabled = 1;
76
77 v = getenv ("GRUB_DISTRIBUTOR");
78 if (v)
79 cfg->grub_distributor = xstrdup (v);
80
81 cfgfile = grub_util_get_config_filename ();
82 if (!grub_util_is_regular (cfgfile))
83 return;
84
85 f = grub_util_fopen (cfgfile, "r");
86 if (f)
87 {
88 grub_util_parse_config (f, cfg, 0);
89 fclose (f);
90 }
91 else
92 grub_util_warn (_("cannot open configuration file `%s': %s"),
93 cfgfile, strerror (errno));
94 }