Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
grub-installer
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Debian Installer
grub-installer
Commits
f97462fc
Commit
f97462fc
authored
15 years ago
by
Colin Watson
Browse files
Options
Downloads
Patches
Plain Diff
* Merge from Ubuntu:
- Use grub-probe to convert device names rather than relying on device.map. r62595
parent
a763f28f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
debian/changelog
+8
-0
8 additions, 0 deletions
debian/changelog
grub-installer
+7
-116
7 additions, 116 deletions
grub-installer
with
15 additions
and
116 deletions
debian/changelog
+
8
−
0
View file @
f97462fc
grub-installer (1.51) UNRELEASED; urgency=low
* Merge from Ubuntu:
- Use grub-probe to convert device names rather than relying on
device.map.
-- Colin Watson <cjwatson@debian.org> Mon, 08 Mar 2010 17:40:05 +0000
grub-installer (1.50) unstable; urgency=low
[ Frans Pop ]
...
...
This diff is collapsed.
Click to expand it.
grub-installer
+
7
−
116
View file @
f97462fc
...
...
@@ -75,126 +75,17 @@ grub_serial_console() {
serial
=
"
$(
get_serial_console
)
"
## This is copied from update-grub; we've requested that it be moved
## to a utility or shell library
## TODO: replace this with grub-probe
device_map
=
$ROOT
/boot/grub/device.map
# Usage: convert os_device
# Convert an OS device to the corresponding GRUB drive
# This part is OS-specific
convert
()
{
## First, check if the device file exists
# if test -e "$1"; then
# :
# else
# echo "$1: Not found or not a block device." 1>&2
# exit 1
# fi
host_os
=
$(
uname
-s
|
tr
'A-Z'
'a-z'
)
# Break the device name into the disk part and the partition part
case
"
$host_os
"
in
linux
*
)
tmp_disk
=
$(
echo
"
$1
"
|
sed
-e
's%\(\(s\|h\|v\|xv\)d[a-z]\)[0-9]*$%\1%'
\
-e
's%\(fd[0-9]*\)$%\1%'
\
-e
's%/part[0-9]*$%/disc%'
\
-e
's%\(c[0-7]d[0-9]*\).*$%\1%'
\
-e
's%\(mmcblk[0-9]d[0-9]*\).*$%\1%'
\
-e
's%\(/mapper/mpath[0-9]\+\)-part[0-9]\+$%\1%'
)
tmp_part
=
$(
echo
"
$1
"
|
sed
-e
's%.*/\(s\|h\|v\|xv\)d[a-z]\([0-9]*\)$%\2%'
\
-e
's%.*/fd[0-9]*$%%'
\
-e
's%.*/floppy/[0-9]*$%%'
\
-e
's%.*/\(disc\|part\([0-9]*\)\)$%\2%'
\
-e
's%.*c[0-7]d[0-9]*p*%%'
\
-e
's%.*mmcblk[0-9]d[0-9]*p%%'
\
-e
's%.*/mapper/mpath[0-9]\+-part\([0-9]\+\)%\1%'
)
;;
gnu
*
)
tmp_disk
=
$(
echo
"
$1
"
|
sed
's%\([sh]d[0-9]*\).*%\1%'
)
tmp_part
=
$(
echo
"
$1
"
|
sed
"s%
$tmp_disk
%%"
)
;;
freebsd
*
)
tmp_disk
=
$(
echo
"
$1
"
|
sed
's%r\{0,1\}\([saw]d[0-9]*\).*$%r\1%'
|
\
sed
's%r\{0,1\}\(da[0-9]*\).*$%r\1%'
)
tmp_part
=
$(
echo
"
$1
"
|
\
sed
"s%.*/r
\{
0,1
\}
[saw]d[0-9]
\(
s[0-9]*[a-h]
\)
%
\1
%"
|
\
sed
"s%.*/r
\{
0,1
\}
da[0-9]
\(
s[0-9]*[a-h]
\)
%
\1
%"
)
;;
netbsd
*
)
tmp_disk
=
$(
echo
"
$1
"
|
sed
's%r\{0,1\}\([sw]d[0-9]*\).*$%r\1d%'
|
\
sed
's%r\{0,1\}\(fd[0-9]*\).*$%r\1a%'
)
tmp_part
=
$(
echo
"
$1
"
|
\
sed
"s%.*/r
\{
0,1
\}
[sw]d[0-9]
\(
[abe-p]
\)
%
\1
%"
)
;;
*
)
echo
"update-grub does not support your OS yet."
1>&2
exit
1
;;
esac
# Get the drive name
tmp_drive
=
$(
grep
-v
'^#'
$device_map
|
grep
"
$tmp_disk
*$"
|
\
sed
's%.*\(([hf]d[0-9][a-g0-9,]*)\).*%\1%'
)
# If not found, print an error message and exit
if
[
-z
"
$tmp_drive
"
]
;
then
echo
"
$1
does not have any corresponding BIOS drive."
1>&2
exit
1
fi
if
[
-n
"
$tmp_part
"
]
;
then
# If a partition is specified, we need to translate it into the
# GRUB's syntax
case
"
$host_os
"
in
linux
*
)
echo
"
$tmp_drive
"
|
sed
"s%)
$%
,
`
expr
$tmp_part
-
$partition_offset
`
)%"
;;
gnu
*
)
if
echo
$tmp_part
|
grep
"^s"
>
/dev/null
;
then
tmp_pc_slice
=
$(
echo
$tmp_part
|
\
sed
"s%s
\(
[0-9]*
\)
[a-g]*
$%
\1
%"
)
tmp_drive
=
$(
echo
"
$tmp_drive
"
|
\
sed
"s%)%,
\`
expr "
$tmp_pc_slice
" -
$partition_offset
\`
)%"
)
fi
if
echo
$tmp_part
|
grep
"[a-g]$"
>
/dev/null
;
then
tmp_bsd_partition
=
$(
echo
"
$tmp_part
"
|
\
sed
"s%[^a-g]*
\(
[a-g]
\)
$%
\1
%"
)
tmp_drive
=
$(
echo
"
$tmp_drive
"
|
\
sed
"s%)%,
$tmp_bsd_partition
)%"
)
fi
echo
"
$tmp_drive
"
;;
freebsd
*
)
if
echo
$tmp_part
|
grep
"^s"
>
/dev/null
;
then
tmp_pc_slice
=
$(
echo
$tmp_part
|
\
sed
"s%s
\(
[0-9]*
\)
[a-h]*
$%
\1
%"
)
tmp_drive
=
$(
echo
"
$tmp_drive
"
|
\
sed
"s%)%,
\`
expr "
$tmp_pc_slice
" -
$partition_offset
\`
)%"
)
fi
if
echo
$tmp_part
|
grep
"[a-h]$"
>
/dev/null
;
then
tmp_bsd_partition
=
$(
echo
"
$tmp_part
"
|
\
sed
"s%s
\{
0,1
\}
[0-9]*
\(
[a-h]
\)
$%
\1
%"
)
tmp_drive
=
$(
echo
"
$tmp_drive
"
|
\
sed
"s%)%,
$tmp_bsd_partition
)%"
)
fi
echo
"
$tmp_drive
"
;;
netbsd
*
)
if
echo
$tmp_part
|
grep
"^[abe-p]$"
>
/dev/null
;
then
tmp_bsd_partition
=
$(
echo
"
$tmp_part
"
|
\
sed
"s%
\(
[a-p]
\)
$%
\1
%"
)
tmp_drive
=
$(
echo
"
$tmp_drive
"
|
\
sed
"s%)%,
$tmp_bsd_partition
)%"
)
fi
echo
"
$tmp_drive
"
;;
esac
else
# If no partition is specified, just print the drive name
echo
"
$tmp_drive
"
tmp_drive
=
"
$(
$chroot
$ROOT
grub-probe
-d
-t
drive
"
$1
"
)
"
||
exit
$?
if
[
"
$partition_offset
"
!=
0
]
;
then
tmp_part
=
"
$(
echo
"
$tmp_drive
"
|
sed
's%.*,\([0-9]*\)).*%\1%'
)
"
if
[
"
$tmp_part
"
]
&&
[
"
$tmp_part
"
!=
"
$tmp_drive
"
]
;
then
tmp_drive
=
"
$(
echo
"
$tmp_drive
"
|
sed
"s%
\(
.*,
\)
[0-9]*
\(
).*
\)
%
\1
`
expr
$tmp_part
-
$partition_offset
`
\2
%"
)
"
fi
fi
echo
"
$tmp_drive
"
}
# Convert a linux non-devfs disk device name into the hurd's syntax
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment