summaryrefslogtreecommitdiffstats
path: root/perl-install/any.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-02-15 13:29:21 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-02-15 13:29:21 +0000
commitaf185ba215272ffbafa713f1bea3949e98023967 (patch)
treeb05ad55f1e781f3cd7e01cbb7d072307b33c2c86 /perl-install/any.pm
parent6f6740ad5cc6c0d60440c8a2cece76b9c7b2bf0c (diff)
downloaddrakx-af185ba215272ffbafa713f1bea3949e98023967.tar
drakx-af185ba215272ffbafa713f1bea3949e98023967.tar.gz
drakx-af185ba215272ffbafa713f1bea3949e98023967.tar.bz2
drakx-af185ba215272ffbafa713f1bea3949e98023967.tar.xz
drakx-af185ba215272ffbafa713f1bea3949e98023967.zip
use 'combo' instead of 'type' for bootloader choice and security choice
(requested by fredb&dadou)
Diffstat (limited to 'perl-install/any.pm')
-rw-r--r--perl-install/any.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm
index 641fb8679..8d61d685d 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -160,7 +160,7 @@ sub setupBootloader {
$b->{vga} ||= 'normal';
if (arch !~ /ppc/) {
$in->ask_from('', _("Bootloader main options"), [
-{ label => _("Bootloader to use"), val => \$bootloader, list => [ keys(%bootloaders) ], format => \&translate, type => 'list' },
+{ label => _("Bootloader to use"), val => \$bootloader, list => [ keys(%bootloaders) ], format => \&translate },
arch() =~ /sparc/ ? (
{ label => _("Bootloader installation"), val => \$silo_install_lang, list => \@silo_install_lang },
) : if_(arch() !~ /ia64/,
@@ -192,7 +192,7 @@ sub setupBootloader {
} else {
$b->{boot} = $partition_table_mac::bootstrap_part;
$in->ask_from('', _("Bootloader main options"), [
- { label => _("Bootloader to use"), val => \$bootloader, list => [ keys(%bootloaders) ], format => \&translate, type => 'list' },
+ { label => _("Bootloader to use"), val => \$bootloader, list => [ keys(%bootloaders) ], format => \&translate },
{ label => _("Init Message"), val => \$b->{initmsg} },
{ label => _("Boot device"), val => \$b->{boot}, list => [ map { "/dev/$_" } (map { $_->{device} } (grep { isAppleBootstrap($_) } @$fstab))], not_edit => !$::expert },
{ label => _("Open Firmware Delay"), val => \$b->{delay} },
@@ -1023,7 +1023,7 @@ Security features are at their maximum.")),
$in->ask_from('', _("Choose security level") . "\n\n" .
join('', map { "$l{$_}: $help{$_}\n\n" } keys %l),
[
- { label => _("Security level"), val => $security, list => [ sort keys %l ], format => sub { $l{$_} }, type => 'list' },
+ { label => _("Security level"), val => $security, list => [ sort keys %l ], format => sub { $l{$_} } },
if_($in->do_pkgs->is_installed('libsafe') && arch() =~ /^i.86/,
{ label => _("Use libsafe for servers"), val => $libsafe, type => 'bool', text =>
_("A library which defends against buffer overflow and format string attacks.") }
n class="hl ppc"> #include "automatic.h" #include "disk.h" #include "partition.h" struct partition_detection_anchor { off_t offset; const char * anchor; }; static int seek_and_compare(int fd, struct partition_detection_anchor anch) { char buf[500]; size_t count; if (lseek(fd, anch.offset, SEEK_SET) == (off_t)-1) { log_perror("seek failed"); return -1; } count = read(fd, buf, strlen(anch.anchor)); if (count != strlen(anch.anchor)) { log_perror("read failed"); return -1; } buf[count] = '\0'; if (strcmp(anch.anchor, buf)) return 1; return 0; } static const char * detect_partition_type(char * dev) { struct partition_detection_info { const char * name; struct partition_detection_anchor anchor0; struct partition_detection_anchor anchor1; struct partition_detection_anchor anchor2; }; struct partition_detection_info partitions_signatures[] = { { "Linux Swap", { 4086, "SWAP-SPACE" }, { 0, NULL }, { 0, NULL } }, { "Linux Swap", { 4086, "SWAPSPACE2" }, { 0, NULL }, { 0, NULL } }, { "Ext2", { 0x438, "\x53\xEF" }, { 0, NULL }, { 0, NULL } }, { "ReiserFS", { 0x10034, "ReIsErFs" }, { 0, NULL }, { 0, NULL } }, { "ReiserFS", { 0x10034, "ReIsEr2Fs" }, { 0, NULL }, { 0, NULL } }, { "XFS", { 0, "XFSB" }, { 0x200, "XAGF" }, { 0x400, "XAGI" } }, { "JFS", { 0x8000, "JFS1" }, { 0, NULL }, { 0, NULL } }, { "NTFS", { 0x1FE, "\x55\xAA" }, { 0x3, "NTFS" }, { 0, NULL } }, { "FAT32", { 0x1FE, "\x55\xAA" }, { 0x52, "FAT32" }, { 0, NULL } }, { "FAT", { 0x1FE, "\x55\xAA" }, { 0x36, "FAT" }, { 0, NULL } }, { "Linux LVM", { 0, "HM\1\0" }, { 0, NULL }, { 0, NULL } } }; int partitions_signatures_nb = sizeof(partitions_signatures) / sizeof(struct partition_detection_info); int i; int fd; const char *part_type = NULL; char device_fullname[50]; strcpy(device_fullname, "/dev/"); strcat(device_fullname, dev); if (ensure_dev_exists(device_fullname)) return NULL; log_message("guessing type of %s", device_fullname); if ((fd = open(device_fullname, O_RDONLY, 0)) < 0) { log_perror("open"); return NULL; } for (i=0; i<partitions_signatures_nb; i++) { int results = seek_and_compare(fd, partitions_signatures[i].anchor0); if (results == -1) goto detect_partition_type_end; if (results == 1) continue; if (!partitions_signatures[i].anchor1.anchor) goto detect_partition_found_it; results = seek_and_compare(fd, partitions_signatures[i].anchor1); if (results == -1) goto detect_partition_type_end; if (results == 1) continue; if (!partitions_signatures[i].anchor2.anchor) goto detect_partition_found_it; results = seek_and_compare(fd, partitions_signatures[i].anchor2); if (results == -1) goto detect_partition_type_end; if (results == 1) continue; detect_partition_found_it: part_type = partitions_signatures[i].name; break; } detect_partition_type_end: close(fd); return part_type; } int list_partitions(char * dev_name, char ** parts, char ** comments) { int major, minor, blocks; char name[100]; FILE * f; int i = 0; char buf[512]; if (!(f = fopen("/proc/partitions", "rb")) || !fgets(buf, sizeof(buf), f) || !fgets(buf, sizeof(buf), f)) { log_perror(dev_name); return 1; } while (fgets(buf, sizeof(buf), f)) { memset(name, 0, sizeof(name)); sscanf(buf, " %d %d %d %s", &major, &minor, &blocks, name); if ((strstr(name, dev_name) == name) && (blocks > 1) && (name[strlen(dev_name)] != '\0')) { const char * partition_type = detect_partition_type(name); parts[i] = strdup(name); comments[i] = (char *) malloc(sizeof(char) * 100); sprintf(comments[i], "size: %d Mbytes", blocks >> 10); if (partition_type) { strcat(comments[i], ", type: "); strcat(comments[i], partition_type); } i++; } } parts[i] = NULL; fclose(f); return 0; }