use version string everywhere in user dialogs

This commit is contained in:
Sergey Bolshakov 2007-08-02 20:45:59 +04:00
parent f5120f7acf
commit feea139224
3 changed files with 42 additions and 32 deletions

12
cdrom.c
View File

@ -33,6 +33,7 @@
#include "cdrom.h"
extern char version[];
static int mount_that_cd_device(char * dev_name)
{
@ -56,16 +57,19 @@ static enum return_type try_with_device(char * dev_name, char * dev_model);
static enum return_type do_with_device(char * dev_name, char * dev_model)
{
char msg[256];
if (test_that_cd()) {
enum return_type results;
umount(IMAGE_LOCATION);
results = ask_yes_no("That CDROM disc does not seem to be a " DISTRIB_NAME " Installation CDROM.\nRetry with another disc?");
snprintf(msg, sizeof(msg), "That CDROM disc does not seem to be a %s"
" Installation CDROM.\nRetry with another disc?", version);
results = ask_yes_no(msg);
if (results == RETURN_OK)
return try_with_device(dev_name, dev_model);
return results;
}
log_message("found a " DISTRIB_NAME " CDROM, good news!");
log_message("found a %s CDROM, good news!", version);
if (IS_RESCUE) {
load_ramdisk(NULL);
@ -92,7 +96,7 @@ static enum return_type try_with_device(char * dev_name, char * dev_model)
unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */
remove_wait_message();
snprintf(msg, sizeof(msg), "I can't access a " DISTRIB_NAME " Installation disc in your CDROM drive (%s).\nRetry?", dev_model);
snprintf(msg, sizeof(msg), "I can't access a %s Installation disc in your CDROM drive (%s).\nRetry?", version, dev_model);
results = ask_yes_no(msg);
if (results == RETURN_OK)
return try_with_device(dev_name, dev_model);
@ -143,7 +147,7 @@ enum return_type cdrom_prepare(void)
char ** model = medias_models;
ptr = medias;
while (ptr && *ptr) {
wait_message("Trying to access " DISTRIB_NAME " CDROM disc (drive %s)", *model);
wait_message("Trying to access %s CDROM disc (drive %s)", version, *model);
if (mount_that_cd_device(*ptr) != -1) {
if (!test_that_cd()) {
remove_wait_message();

23
disk.c
View File

@ -38,6 +38,8 @@
#include "disk.h"
extern char version[];
struct partition_detection_anchor {
off_t offset;
const char * anchor;
@ -196,8 +198,8 @@ static enum return_type try_with_device(char *dev_name)
return RETURN_ERROR;
}
results = ask_from_list_comments_auto("Please choose the partition where is copied the " DISTRIB_NAME " Distribution.",
parts, parts_comments, &choice, "partition", parts);
snprintf(buf, sizeof(buf), "Please choose the partition where is copied the %s Distribution.", version);
results = ask_from_list_comments_auto(buf, parts, parts_comments, &choice, "partition", parts);
if (results != RETURN_OK)
return results;
@ -212,8 +214,8 @@ static enum return_type try_with_device(char *dev_name)
return try_with_device(dev_name);
}
if (ask_from_entries_auto("Please enter the directory (or ISO image file) containing the " DISTRIB_NAME " Distribution.",
questions_location, &answers_location, 24, questions_location_auto, NULL) != RETURN_OK) {
snprintf(buf, sizeof(buf), "Please enter the directory (or ISO image file) containing the %s Distribution.", version);
if (ask_from_entries_auto(buf, questions_location, &answers_location, 24, questions_location_auto, NULL) != RETURN_OK) {
umount(IMAGE_LOCATION);
return try_with_device(dev_name);
}
@ -233,7 +235,7 @@ static enum return_type try_with_device(char *dev_name)
if (!stat(location_full, &statbuf) && !S_ISDIR(statbuf.st_mode)) {
log_message("%s exists and is not a directory, assuming this is an ISO image", location_full);
if (lomount(location_full, IMAGE_LOCATION)) {
stg1_error_message("Could not mount file %s as an ISO image of the " DISTRIB_NAME " Distribution.", answers_location[0]);
stg1_error_message("Could not mount file %s as an ISO image of the %s Distribution.", answers_location[0], version);
umount(IMAGE_LOCATION);
return try_with_device(dev_name);
}
@ -242,15 +244,15 @@ static enum return_type try_with_device(char *dev_name)
}
if (access(get_ramdisk_path(iso ? NULL : location_full), R_OK)) {
stg1_error_message("I can't find the " DISTRIB_NAME " Distribution in the specified directory. "
stg1_error_message("I can't find the %s Distribution in the specified directory. "
"Here's a short extract of the files in the directory:\n"
"%s", disk_extract_list_directory(IMAGE_LOCATION));
"%s", version, disk_extract_list_directory(IMAGE_LOCATION));
loumount();
umount(IMAGE_LOCATION);
return try_with_device(dev_name);
}
log_message("found the " DISTRIB_NAME " Installation, good news!");
log_message("found the %s Installation, good news!", version);
if (!IS_LOWMEM && ramdisk_possible()) {
if (load_ramdisk(iso ? NULL : location_full) != RETURN_OK) {
@ -276,6 +278,7 @@ enum return_type disk_prepare(void)
{
char ** medias, ** ptr, ** medias_models;
char * choice;
char msg[256];
int i, count = 0;
enum return_type results;
@ -307,8 +310,8 @@ enum return_type disk_prepare(void)
return disk_prepare();
}
results = ask_from_list_comments_auto("Please choose the DISK drive on which you copied the " DISTRIB_NAME " Distribution.",
medias, medias_models, &choice, "disk", medias);
snprintf(msg, sizeof(msg), "Please choose the DISK drive on which you copied the %s Distribution.", version);
results = ask_from_list_comments_auto(msg, medias, medias_models, &choice, "disk", medias);
if (results != RETURN_OK)
return results;

View File

@ -49,13 +49,13 @@
#include "network.h"
extern char version[];
static void error_message_net(void) /* reduce code size */
{
stg1_error_message("Could not configure network.");
}
int configure_net_device(struct interface_info * intf)
{
struct ifreq req;
@ -625,8 +625,9 @@ static enum return_type intf_select_and_up(void)
enum return_type nfs_prepare(void)
{
char * questions[] = { "NFS server name", DISTRIB_NAME " directory", NULL };
char * questions[] = { "NFS server name", "Directory", NULL };
char * questions_auto[] = { "server", "directory", NULL };
char msg[256];
static char ** answers = NULL;
char * nfsmount_location;
char * ramdisk_path;
@ -639,9 +640,9 @@ enum return_type nfs_prepare(void)
update_splash();
do {
results = ask_from_entries_auto("Please enter the name or IP address of your NFS server, "
"and the directory (or ISO image file) containing the " DISTRIB_NAME " Distribution.",
questions, &answers, 40, questions_auto, NULL);
snprintf(msg, sizeof(msg), "Please enter the name or IP address of your NFS server, "
"and the directory (or ISO image file) containing the %s Distribution.", version);
results = ask_from_entries_auto(msg, questions, &answers, 40, questions_auto, NULL);
if (results != RETURN_OK || streq(answers[0], "")) {
unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */
return nfs_prepare();
@ -684,7 +685,7 @@ enum return_type nfs_prepare(void)
continue;
}
if (lomount(location_full, IMAGE_LOCATION)) {
stg1_error_message("Could not mount file %s as an ISO image of the " DISTRIB_NAME " Distribution.", location_full);
stg1_error_message("Could not mount file %s as an ISO image of the %s Distribution.", location_full, version);
umount(IMAGE_LOCATION);
results = RETURN_BACK;
continue;
@ -695,14 +696,14 @@ enum return_type nfs_prepare(void)
ramdisk_path = get_ramdisk_path(NULL);
if (access(ramdisk_path, R_OK)) {
stg1_error_message("That NFS volume does not seem to contain the " DISTRIB_NAME " Distribution.");
stg1_error_message("That NFS volume does not seem to contain the %s Distribution.", version);
umount(IMAGE_LOCATION);
if (iso) umount(IMAGE_LOCATION);
results = RETURN_BACK;
}
} while (results == RETURN_BACK);
log_message("found the " DISTRIB_NAME " Installation, good news!");
log_message("found the %s Installation, good news!", version);
stat(ramdisk_path, &st);
if (S_ISDIR(st.st_mode)) {
@ -723,7 +724,7 @@ enum return_type nfs_prepare(void)
enum return_type ftp_prepare(void)
{
char * questions[] = { "FTP server", DISTRIB_NAME " directory", "Login", "Password", NULL };
char * questions[] = { "FTP server", "Directory", "Login", "Password", NULL };
char * questions_auto[] = { "server", "directory", "user", "pass", NULL };
static char ** answers = NULL;
enum return_type results;
@ -745,10 +746,11 @@ enum return_type ftp_prepare(void)
int ftp_serv_response;
int fd, size;
results = ask_from_entries_auto("Please enter the name or IP address of the FTP server, "
"the directory containing the " DISTRIB_NAME " Distribution, "
"and the login/pass if necessary (leave login blank for anonymous).",
questions, &answers, 40, questions_auto, NULL);
snprintf(location_full, sizeof(location_full),
"Please enter the name or IP address of the FTP server, "
"the directory containing the %s Distribution, "
"and the login/pass if necessary (leave login blank for anonymous).", version);
results = ask_from_entries_auto(location_full, questions, &answers, 40, questions_auto, NULL);
if (results != RETURN_OK || streq(answers[0], "")) {
unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */
return ftp_prepare();
@ -813,7 +815,7 @@ enum return_type ftp_prepare(void)
enum return_type http_prepare(void)
{
char * questions[] = { "HTTP server", DISTRIB_NAME " directory", NULL };
char * questions[] = { "HTTP server", "Directory", NULL };
char * questions_auto[] = { "server", "directory", NULL };
static char ** answers = NULL;
enum return_type results;
@ -835,9 +837,10 @@ enum return_type http_prepare(void)
char location_full[500];
int fd, size;
results = ask_from_entries_auto("Please enter the name or IP address of the HTTP server, "
"and the directory containing the " DISTRIB_NAME " Distribution.",
questions, &answers, 40, questions_auto, NULL);
snprintf(location_full, sizeof(location_full),
"Please enter the name or IP address of the HTTP server, "
"and the directory containing the %s Distribution.", version);
results = ask_from_entries_auto(location_full, questions, &answers, 40, questions_auto, NULL);
if (results != RETURN_OK || streq(answers[0], "")) {
unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */
return http_prepare();