Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:lafenghu
trustedgrub
grub-1.1.3-devicemap.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File grub-1.1.3-devicemap.diff of Package trustedgrub
Index: TrustedGRUB-1.1.3/grub/main.c =================================================================== --- TrustedGRUB-1.1.3.orig/grub/main.c +++ TrustedGRUB-1.1.3/grub/main.c @@ -44,7 +44,7 @@ int use_curses = 0; int verbose = 0; int read_only = 0; int floppy_disks = 1; -char *device_map_file = 0; +char *device_map_file = "/boot/grub/device.map"; static int default_boot_drive; static int default_install_partition; static char *default_config_file; Index: TrustedGRUB-1.1.3/lib/device.c =================================================================== --- TrustedGRUB-1.1.3.orig/lib/device.c +++ TrustedGRUB-1.1.3/lib/device.c @@ -519,6 +519,7 @@ read_device_map (FILE *fp, char **map, c probing devices. */ char buf[1024]; /* XXX */ int line_number = 0; + int retval = 0; /* default to failure */ while (fgets (buf, sizeof (buf), fp)) { @@ -545,14 +546,14 @@ read_device_map (FILE *fp, char **map, c if (*ptr != '(') { show_error (line_number, "No open parenthesis found"); - return 0; + continue; } ptr++; if ((*ptr != 'f' && *ptr != 'h') || *(ptr + 1) != 'd') { show_error (line_number, "Bad drive name"); - return 0; + continue; } if (*ptr == 'f') @@ -563,7 +564,7 @@ read_device_map (FILE *fp, char **map, c if (drive < 0) { show_error (line_number, "Bad device number"); - return 0; + continue; } else if (drive > 127) { @@ -579,7 +580,7 @@ read_device_map (FILE *fp, char **map, c if (*ptr != ')') { show_error (line_number, "No close parenthesis found"); - return 0; + continue; } ptr++; @@ -590,7 +591,7 @@ read_device_map (FILE *fp, char **map, c if (! *ptr) { show_error (line_number, "No filename found"); - return 0; + continue; } /* Terminate the filename. */ @@ -608,9 +609,11 @@ read_device_map (FILE *fp, char **map, c map[drive] = strdup (ptr); assert (map[drive]); + + retval = 1; /* at least 1 drive configured successfully */ } - return 1; + return retval; } /* Initialize the device map MAP. *MAP will be allocated from the heap @@ -849,7 +852,7 @@ write_to_partition (char **map, int driv int sector, int size, const char *buf) { char dev[PATH_MAX]; /* XXX */ - int fd; + int fd, len, pnum; if ((partition & 0x00FF00) != 0x00FF00) { @@ -867,7 +870,16 @@ write_to_partition (char **map, int driv if (strcmp (dev + strlen(dev) - 5, "/disc") == 0) strcpy (dev + strlen(dev) - 5, "/part"); } - sprintf (dev + strlen(dev), "%d", ((partition >> 16) & 0xFF) + 1); + + len = strlen(dev); + pnum = ((partition >> 16) & 0xFF); + if (isdigit(dev[len-1])) + { + /* It is obviously some RAID disk: "/dev/<dsk>/c0d0" . "p1" */ + sprintf (dev + len, "p%d", pnum + 1); + } + else + sprintf (dev + len, "%d", pnum + 1); /* Open the partition. */ fd = open (dev, O_RDWR); Index: TrustedGRUB-1.1.3/util/grub-md5-crypt.in =================================================================== --- TrustedGRUB-1.1.3.orig/util/grub-md5-crypt.in +++ TrustedGRUB-1.1.3/util/grub-md5-crypt.in @@ -88,7 +88,7 @@ if test "x$password" != "x$password2"; t fi # Run the grub shell. -$grub_shell --batch --device-map=/dev/null <<EOF \ +$grub_shell --batch <<EOF \ | grep "^Encrypted: " | sed 's/^Encrypted: //' md5crypt $password
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor