summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--loader/cdrom.c2
-rw-r--r--loader/devices.c6
-rw-r--r--loader/kickstart.c6
-rw-r--r--loader/lang.c297
-rw-r--r--loader/lang.h16
-rw-r--r--loader/loader.c15
-rw-r--r--loader/net.c6
-rw-r--r--loader/urls.c8
8 files changed, 334 insertions, 22 deletions
diff --git a/loader/cdrom.c b/loader/cdrom.c
index d8d557e5f..482c05212 100644
--- a/loader/cdrom.c
+++ b/loader/cdrom.c
@@ -31,7 +31,7 @@ static int setupCDdevicePanel(int * type) {
rc = newtWinMenu(_("CDROM type"), _("What type of CDROM do you have?"),
30, 5, 5, 7, menuItems,
- &cdromType, _("Ok"), _("Back"), NULL);
+ &cdromType, _("OK"), _("Back"), NULL);
if (rc == 2) return LOADER_BACK;
diff --git a/loader/devices.c b/loader/devices.c
index d5cfcf6e4..46bfaa1f6 100644
--- a/loader/devices.c
+++ b/loader/devices.c
@@ -54,8 +54,8 @@ static int getModuleArgs(struct moduleInfo * mod, char *** argPtr) {
rc = newtWinEntries(_("Module Parameters"), _("This module can take "
"parameters which affects its operation. If you don't "
"know what parameters to supply, just skip this "
- "screen by pressing the \"Ok\" button now."),
- 40, 5, 15, 20, entries, _("Ok"), _("Back"), NULL);
+ "screen by pressing the \"OK\" button now."),
+ 40, 5, 15, 20, entries, _("OK"), _("Back"), NULL);
if (rc == 2) {
for (i = 0; i < numArgs; i++)
@@ -131,7 +131,7 @@ static int pickModule(moduleInfoSet modInfo, enum driverMajor type,
}
}
- buttons = newtButtonBar(_("Ok"), &ok, _("Back"), &back, NULL);
+ buttons = newtButtonBar(_("OK"), &ok, _("Back"), &back, NULL);
checkbox = newtCheckbox(-1, -1, _("Specify module parameters"),
specifyParameters, NULL, &specifyParameters);
subgrid = newtGridVStacked(NEWT_GRID_COMPONENT, listbox,
diff --git a/loader/kickstart.c b/loader/kickstart.c
index 5f09d3859..e576cf314 100644
--- a/loader/kickstart.c
+++ b/loader/kickstart.c
@@ -53,7 +53,7 @@ int ksReadCommands(char * cmdFile) {
int commandsAlloced = 5;
if ((fd = open(cmdFile, O_RDONLY)) < 0) {
- newtWinMessage(_("Kickstart Error"), _("Ok"),
+ newtWinMessage(_("Kickstart Error"), _("OK"),
_("Error opening: kickstart file %s: %s"), cmdFile,
strerror(errno));
return LOADER_ERROR;
@@ -63,7 +63,7 @@ int ksReadCommands(char * cmdFile) {
buf = alloca(sb.st_size + 1);
if (read(fd, buf, sb.st_size) != sb.st_size) {
- newtWinMessage(_("Kickstart Error"), _("Ok"),
+ newtWinMessage(_("Kickstart Error"), _("OK"),
_("Error reading contents of kickstart file %s: %s"),
cmdFile, strerror(errno));
close(fd);
@@ -102,7 +102,7 @@ int ksReadCommands(char * cmdFile) {
inPackages = 1;
} else {
if (poptParseArgvString(start, &argc, &argv) || !argc) {
- newtWinMessage(_("Kickstart Error"), _("Ok"),
+ newtWinMessage(_("Kickstart Error"), _("OK"),
_("Error on line %d of kickstart file %s."),
argv[0], line, cmdFile);
} else {
diff --git a/loader/lang.c b/loader/lang.c
index 272f2bfd6..15d725025 100644
--- a/loader/lang.c
+++ b/loader/lang.c
@@ -11,11 +11,17 @@
#include <unistd.h>
#include <zlib.h>
#include <rpm/rpmio.h>
+#include <linux/keyboard.h>
+#include <linux/kd.h>
#include "isys/cpio.h"
#include "loader.h"
#include "lang.h"
#include "log.h"
+#include "windows.h"
+
+#define errorWindow(String) \
+ newtWinMessage(_("Error"), _("OK"), String, strerror (errno));
struct aString {
unsigned int hash;
@@ -72,12 +78,15 @@ static const struct langInfo languages[] = {
{ "German", "de", "lat0-sun16", "iso15", "de_DE" },
{ "Hungarian", "hu", "lat2-sun16", "iso02", "hu_HU" },
{ "Icelandic", "is", "lat0-sun16", "iso15", "is_IS" },
+ { "Indonesian", "id", "lat0-sun16", "iso01", "id_ID" },
{ "Italian", "it", "lat0-sun16", "iso15", "it_IT" },
{ "Norwegian", "no", "lat0-sun16", "iso15", "no_NO" },
+ { "Polish", "pl", "lat2-sun16", "iso02", "pl_PL" },
{ "Romanian", "ro", "lat2-sun16", "iso02", "ro_RO" },
{ "Slovak", "sk", "lat2-sun16", "iso02", "sk_SK" },
+ { "Spanish", "es", "lat0-sun16", "iso01", "es_MX" },
{ "Russian", "ru", "Cyr_a8x16", "koi2alt", "ru_SU" },
- { "Ukrainian", "uk", "RUSCII_8x16", "koi2alt", "uk_UA" },
+ { "Ukrainian", "uk", "RUSCII_8x16", "koi2alt", "uk_UA" },
};
/* FONT LIST ENDS */
const int numLanguages = sizeof(languages) / sizeof(struct langInfo);
@@ -107,7 +116,7 @@ void loadLanguage (char * file, int flags) {
stream = fdOpen(file, O_RDONLY, 0644);
if (fdFileno(stream) < 0) {
- newtWinMessage("Error", "Ok", "Cannot open %s: %s. Installation will "
+ newtWinMessage("Error", "OK", "Cannot open %s: %s. Installation will "
"proceed in English.", file, strerror(errno));
return ;
}
@@ -118,14 +127,14 @@ void loadLanguage (char * file, int flags) {
fdClose(stream);
if (rc || access("/tmp/translation", R_OK)) {
- newtWinMessage("Error", "Ok", "Cannot get translation file %s.\n",
+ newtWinMessage("Error", "OK", "Cannot get translation file %s.\n",
filename);
return;
}
fd = open("/tmp/translation", O_RDONLY);
if (fd < 0) {
- newtWinMessage("Error", "Ok", "Failed to open /tmp/translation: %s\n",
+ newtWinMessage("Error", "OK", "Failed to open /tmp/translation: %s\n",
strerror(errno));
return;
}
@@ -161,10 +170,12 @@ static int loadFont(char * fontFile, int flags) {
FD_t stream;
int rc;
+#if 0
if (!FL_TESTING(flags)) {
+#endif
stream = fdOpen("/etc/fonts.cgz", O_RDONLY, 0644);
if (fdFileno(stream) < 0) {
- newtWinMessage("Error", "Ok",
+ newtWinMessage("Error", "OK",
"Cannot open fonts: %s", strerror(errno));
return LOADER_ERROR;
}
@@ -196,7 +207,9 @@ static int loadFont(char * fontFile, int flags) {
logMessage("PIO_UNISCRNMAP failed: %s", strerror(errno));
fprintf(stderr, "\033(K");
+#if 0
}
+#endif
return 0;
}
@@ -231,7 +244,7 @@ int chooseLanguage(int flags) {
newtWinMenu(_("Choose a Language"), _("What language should be used "
"during the installation process?"), 40, 5, 5, 8,
- langs, &choice, _("Ok"), NULL);
+ langs, &choice, _("OK"), NULL);
if (choice == english) {
/* stick with the default (English) */
@@ -251,5 +264,277 @@ int chooseLanguage(int flags) {
return 0;
}
+struct defaultKeyboardByLang {
+ char * lang, * keyboard;
+} defaultKeyboards[] = {
+ { "de", "de-latin1" },
+ { "fi", "fi-latin1" },
+ { "se", "se-latin1" },
+ { "no", "no-latin1" },
+ { "cs", "cz-lat2" },
+ { "tr", "trq" },
+ { NULL, NULL } };
+
+#ifdef __sparc__
+struct defaultKeyboardByLang
+defaultSunKeyboards[] = {
+ { "fi", "sunt5-fi-latin1" },
+ { "cs", "sunt5-cz-us" },
+ { NULL, NULL } };
+#endif
+
+/* the file pointer must be at the beginning of the section already! */
+static int loadKeymap(gzFile stream) {
+ int console;
+ int kmap, key;
+ struct kbentry entry;
+ int keymaps[MAX_NR_KEYMAPS];
+ int count = 0;
+ int magic;
+ short keymap[NR_KEYS];
+
+ if (gzread(stream, &magic, sizeof(magic)) != sizeof(magic)) {
+ logMessage("failed to read kmap magic: %s", strerror(errno));
+ return LOADER_ERROR;
+ }
+
+ if (magic != KMAP_MAGIC) {
+ logMessage("bad magic for keymap!");
+ return LOADER_ERROR;
+ }
+
+ if (gzread(stream, keymaps, sizeof(keymaps)) != sizeof(keymaps)) {
+ logMessage("failed to read keymap header: %s", strerror(errno));
+ return LOADER_ERROR;
+ }
+
+
+ console = open("/dev/console", O_RDWR);
+ if (console < 0) {
+ logMessage("failed to open /dev/console: %s", strerror(errno));
+ return LOADER_ERROR;
+ }
+
+ for (kmap = 0; kmap < MAX_NR_KEYMAPS; kmap++) {
+ if (!keymaps[kmap]) continue;
+
+ if (gzread(stream, keymap, sizeof(keymap)) != sizeof(keymap)) {
+ logMessage("failed to read keymap data: %s", strerror(errno));
+ close(console);
+ return LOADER_ERROR;
+ }
+
+ count++;
+ for (key = 0; key < NR_KEYS; key++) {
+ entry.kb_index = key;
+ entry.kb_table = kmap;
+ entry.kb_value = keymap[key];
+ if (KTYP(entry.kb_value) != KT_SPEC) {
+ if (ioctl(console, KDSKBENT, &entry)) {
+ close(console);
+ logMessage("keymap ioctl failed: %s", strerror(errno));
+ }
+ }
+ }
+ }
+
+ logMessage("loaded %d keymap tables", count);
+
+ close(console);
+
+ return 0;
+}
+int chooseKeyboard(char ** keymap, char ** kbdtypep, int flags) {
+ int num = -1;
+ int rc;
+ gzFile f;
+ struct kmapHeader hdr;
+ struct kmapInfo * infoTable;
+ char ** argv;
+ int argc;
+ char ** kbds;
+ char buf[16384]; /* I hope this is big enough */
+ int i;
+ char * defkbd = keymap ? *keymap : NULL;
+ struct defaultKeyboardByLang * kbdEntry;
+
+#ifdef __sparc__
+#define KBDTYPE_SUN 0
+#define KBDTYPE_PC 1
+ int kbdtype = -1;
+ int j;
+#endif
+
+ /*if (testing) return 0;*/
+
+#ifdef __sparc__
+ if (kickstart) {
+ kbdtype = KBDTYPE_SUN;
+ if (!ksGetCommand(KS_CMD_KBDTYPE, NULL, &argc, &argv)) {
+ if (argc < 2) {
+ logMessage("no argument passed to keyboard "
+ "kickstart command");
+ } else {
+ if (!strcasecmp (argv[1], "sun"))
+ kbdtype = KBDTYPE_SUN;
+ else if (!strcasecmp (argv[1], "pc"))
+ kbdtype = KBDTYPE_PC;
+ }
+ }
+ } else {
+ char twelve = 12;
+ int fd;
+
+ if (ioctl (0, TIOCLINUX, &twelve) < 0)
+ kbdtype = KBDTYPE_SUN; /* probably serial console, but one should not call us in such a case */
+ else {
+ fd = open("/dev/kbd", O_RDWR);
+ if (fd < 0)
+ kbdtype = KBDTYPE_PC; /* if PC keyboard, then there is no driver for /dev/kbd */
+ else {
+ close(fd);
+ kbdtype = KBDTYPE_SUN;
+ }
+ }
+ }
+#endif
+
+ if (!defkbd && getenv("LANG")) {
+ kbdEntry = defaultKeyboards;
+#ifdef __sparc__
+ if (kbdtype == KBDTYPE_SUN)
+ kbdEntry = defaultSunKeyboards;
+#endif
+ while (kbdEntry->lang &&
+ strcmp(kbdEntry->lang, getenv("LANG")))
+ kbdEntry++;
+ if (kbdEntry->keyboard) defkbd = kbdEntry->keyboard;
+ }
+ if (!defkbd)
+#ifdef __sparc__
+ if (kbdtype == KBDTYPE_SUN)
+ defkbd = "sunkeymap";
+ else
+#endif
+ defkbd = "us";
+ f = gzopen("/etc/keymaps.gz", "r");
+ if (!f) {
+ errorWindow("cannot open /etc/keymaps.gz: %s");
+ return LOADER_ERROR;
+ }
+
+ if (gzread(f, &hdr, sizeof(hdr)) != sizeof(hdr)) {
+ errorWindow("failed to read keymaps header: %s");
+ gzclose(f);
+ return LOADER_ERROR;
+ }
+
+ logMessage("%d keymaps are available", hdr.numEntries);
+
+ i = hdr.numEntries * sizeof(*infoTable);
+ infoTable = alloca(i);
+ if (gzread(f, infoTable, i) != i) {
+ errorWindow("failed to read keymap information: %s");
+ gzclose(f);
+ return LOADER_ERROR;
+ }
+
+#if 0
+ if (kickstart) {
+ if (!ksGetCommand(KS_CMD_KEYBOARD, NULL, &argc, &argv)) {
+ if (argc < 2) {
+ logMessage("no argument passed to keyboard "
+ "kickstart command");
+ } else {
+ for (i = 0; i < hdr.numEntries; i++)
+ if (!strcmp(infoTable[i].name, argv[1])) break;
+#ifdef __sparc__
+ if (i < hdr.numEntries) {
+ if (kbdtype == KBDTYPE_SUN && strncmp (argv[1], "sun", 3))
+ i = hdr.numEntries;
+ else if (kbdtype == KBDTYPE_PC && !strncmp (argv[1], "sun", 3))
+ i = hdr.numEntries;
+ }
+#endif
+ if (i < hdr.numEntries)
+ num = i;
+ else
+ newtWinMessage("Kickstart Error", "OK", "Bad keymap "
+ "name %s passed to kickstart command.",
+ argv[1]);
+ }
+ }
+ }
+#endif
+
+ if (num == -1 ) {
+#ifdef __sparc__
+ kbds = alloca(sizeof(*kbds) * (hdr.numEntries + 1));
+ for (j = 0, i = 0; j < hdr.numEntries; j++) {
+ if (kbdtype == KBDTYPE_SUN && strncmp (infoTable[j].name, "sun", 3))
+ continue;
+ else if (kbdtype == KBDTYPE_PC && !strncmp (infoTable[j].name, "sun", 3))
+ continue;
+ kbds[i] = infoTable[j].name;
+ if (!strcmp(infoTable[j].name, defkbd))
+ num = i;
+ i++;
+ }
+#else
+ kbds = alloca(sizeof(*kbds) * (hdr.numEntries + 1));
+ for (i = 0; i < hdr.numEntries; i++) {
+ kbds[i] = infoTable[i].name;
+ if (!strcmp(infoTable[i].name, defkbd))
+ num = i;
+ }
+#endif
+
+ kbds[i] = NULL;
+
+ rc = newtWinMenu(_("Keyboard Type"),
+ _("What type of keyboard do you have?"),
+ 40, 5, 5, 8, kbds, &num, _("OK"), _("Back"), NULL);
+ if (rc == 2) return LOADER_BACK;
+ }
+
+ rc = 0;
+
+#ifdef __sparc__
+ for (j = 0, i = 0; i < hdr.numEntries; i++) {
+ if (kbdtype == KBDTYPE_SUN && strncmp (infoTable[i].name, "sun", 3))
+ continue;
+ if (kbdtype == KBDTYPE_PC && !strncmp (infoTable[i].name, "sun", 3))
+ continue;
+ if (j == num) {
+ num = i;
+ break;
+ }
+ j++;
+ }
+#endif
+
+ logMessage("using keymap %s", infoTable[num].name);
+
+ for (i = 0; i < num; i++) {
+ if (gzread(f, buf, infoTable[i].size) != infoTable[i].size) {
+ logMessage("error reading %d bytes from file: %s",
+ infoTable[i].size, strerror(errno));
+ gzclose(f);
+ rc = LOADER_ERROR;
+ }
+ }
+
+ if (!rc) rc = loadKeymap(f);
+
+ gzclose(f);
+
+ if (keymap) *keymap = strdup(infoTable[num].name);
+
+#ifdef __sparc__
+ if (kbdtypep) *kbdtypep = (kbdtype == KBDTYPE_SUN) ? "sun" : "pci";
+#endif
+
+ return rc;
+}
diff --git a/loader/lang.h b/loader/lang.h
index 945878cb7..bd0454cbe 100644
--- a/loader/lang.h
+++ b/loader/lang.h
@@ -5,6 +5,22 @@
#define N_(foo) (foo)
int chooseLanguage(int flags);
+int chooseKeyboard(char ** keymap, char ** kbdtypep, int flags);
char * translateString(char * str);
+/* define ask johnsonm@redhat.com where this came from */
+#define KMAP_MAGIC 0x8B39C07F
+#define KMAP_NAMELEN 40 /* including '\0' */
+
+struct kmapHeader {
+ int magic;
+ int numEntries;
+};
+
+struct kmapInfo {
+ int size;
+ char name[KMAP_NAMELEN];
+};
+
+
#endif /* _LANG_H_ */
diff --git a/loader/loader.c b/loader/loader.c
index e62b8848b..b9ee0b8bb 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -971,7 +971,9 @@ static char * doMountImage(char * location, struct knownDevices * kd,
int localAvailable = 0;
void * class;
char * url = NULL;
- enum { STEP_LANG, STEP_METHOD, STEP_URL, STEP_DONE } step;
+ char * keymap = NULL;
+ char * kbdtype = NULL;
+ enum { STEP_LANG, STEP_KBD, STEP_METHOD, STEP_URL, STEP_DONE } step;
if ((class = isysGetModuleList(modInfo, DRIVER_NET))) {
networkAvailable = 1;
@@ -1038,7 +1040,16 @@ static char * doMountImage(char * location, struct knownDevices * kd,
switch (step) {
case STEP_LANG:
chooseLanguage(flags);
- step = STEP_METHOD;
+ step = STEP_KBD;
+ break;
+
+ case STEP_KBD:
+ rc = chooseKeyboard (&keymap, &kbdtype, flags);
+
+ if (rc == LOADER_BACK)
+ step = STEP_LANG;
+ else
+ step = STEP_METHOD;
break;
case STEP_METHOD:
diff --git a/loader/net.c b/loader/net.c
index 5e982dd2f..bfbde5837 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -159,7 +159,7 @@ int nfsGetSetup(char ** hostptr, char ** dirptr) {
" o the name or IP number of your NFS server\n"
" o the directory on that server containing\n"
" Red Hat Linux for your architecture"), 60, 5, 15,
- 24, entries, _("Ok"), _("Back"), NULL);
+ 24, entries, _("OK"), _("Back"), NULL);
if (rc == 2) {
if (newServer) free(newServer);
@@ -281,7 +281,7 @@ int readNetConfig(char * device, struct networkDeviceConfig * cfg, int flags) {
newtGridSetField(subgrid, 1, 3, NEWT_GRID_COMPONENT, c.nsEntry,
1, 0, 0, 0, 0, 0);
- buttons = newtButtonBar(_("Ok"), &okay, _("Back"), &back, NULL);
+ buttons = newtButtonBar(_("OK"), &okay, _("Back"), &back, NULL);
grid = newtCreateGrid(1, 4);
newtGridSetField(grid, 0, 0, NEWT_GRID_COMPONENT, text,
@@ -556,7 +556,7 @@ int kickstartNetwork(char * device, struct networkDeviceConfig * netDev,
}
if (rc < -1) {
- newtWinMessage(_("kickstart"), _("Ok"),
+ newtWinMessage(_("kickstart"), _("OK"),
_("bad argument to kickstart network command %s: %s"),
poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
poptStrerror(rc));
diff --git a/loader/urls.c b/loader/urls.c
index 9d4ba040a..88b98e96e 100644
--- a/loader/urls.c
+++ b/loader/urls.c
@@ -121,7 +121,7 @@ int urlMainSetupPanel(struct iurlinfo * ui, urlprotocol protocol,
else
*doSecondarySetup = ' ';
- buttons = newtButtonBar(_("Ok"), &okay, _("Back"), &cancel, NULL);
+ buttons = newtButtonBar(_("OK"), &okay, _("Back"), &cancel, NULL);
switch (protocol) {
case URL_METHOD_FTP:
@@ -198,12 +198,12 @@ int urlMainSetupPanel(struct iurlinfo * ui, urlprotocol protocol,
answer = newtRunForm(form);
if (answer != cancel) {
if (!strlen(site)) {
- newtWinMessage(_("Error"), _("Ok"),
+ newtWinMessage(_("Error"), _("OK"),
_("You must enter a server name."));
continue;
}
if (!strlen(dir)) {
- newtWinMessage(_("Error"), _("Ok"),
+ newtWinMessage(_("Error"), _("OK"),
_("You must enter a directory."));
continue;
}
@@ -319,7 +319,7 @@ int urlSecondarySetupPanel(struct iurlinfo * ui, urlprotocol protocol) {
newtGridSetField(entryGrid, 1, 3, NEWT_GRID_COMPONENT, proxyPortEntry,
0, 0, 0, 0, NEWT_ANCHOR_LEFT, 0);
- buttons = newtButtonBar(_("Ok"), &okay, _("Back"), &cancel, NULL);
+ buttons = newtButtonBar(_("OK"), &okay, _("Back"), &cancel, NULL);
grid = newtCreateGrid(1, 3);
newtGridSetField(grid, 0, 0, NEWT_GRID_COMPONENT, text, 0, 0, 0, 0, 0, 0);