Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 139866 - Patch: Add bootdir parameter to genkernel
Summary: Patch: Add bootdir parameter to genkernel
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard: gk-4
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2006-07-10 05:35 UTC by Martin Parm
Modified: 2006-07-31 15:38 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Adds --bootdir commandline parameter (genkernel-3.3.11d_bootdir.patch,11.40 KB, patch)
2006-07-10 05:36 UTC, Martin Parm
Details | Diff
Adds --bootdir commandline parameter (genkernel-3.3.11d_bootdir.patch,11.40 KB, patch)
2006-07-10 08:34 UTC, Martin Parm
Details | Diff
Adds --bootdir commandline parameter (genkernel-3.4.0_pre2 patch) (genkernel-3.4.0_pre2_bootdir.patch,11.70 KB, patch)
2006-07-10 08:44 UTC, Martin Parm
Details | Diff
Fix quoting issues (genkernel-139866.patch,4.28 KB, patch)
2006-07-11 05:10 UTC, Tim Yamin (RETIRED)
Details | Diff
Fixes awk- and egrep-expression, a few print_info's and rewrites isBootRO() (genkernel-3.4.0_pre2-better-awk-expression.patch,2.71 KB, patch)
2006-07-11 09:20 UTC, Martin Parm
Details | Diff
Adds --bootdir commandline parameter (genkernel-3.4.0_pre2 patch, combined with patch 91453 and 91481) (genkerel-3.4.0_pre2-bootdir.patch,11.94 KB, patch)
2006-07-11 09:23 UTC, Martin Parm
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Parm 2006-07-10 05:35:20 UTC
This patch add a commandline parameter to change the boot-directory, instead of just being hardcoded to /boot. This is useful if you have a non-standard boot-location.
The change is transparent to ordinary users as BOOTDIR defaults to /boot if --bootdir is omitted.

The patch also solves one minor issue in genkernel (the file, not the program), line 181-182 in the patch: the syntax in /etc/fstab takes both tabs and spaces.
Comment 1 Martin Parm 2006-07-10 05:36:57 UTC
Created attachment 91356 [details, diff]
Adds --bootdir commandline parameter

This patch was created with genkernel-3.3.11d
Comment 2 Martin Parm 2006-07-10 08:34:22 UTC
Created attachment 91371 [details, diff]
Adds --bootdir commandline parameter

Minor bug fixed.
This patch was made with genkernel-3.3.11d
Comment 3 Martin Parm 2006-07-10 08:44:40 UTC
Created attachment 91372 [details, diff]
Adds --bootdir commandline parameter (genkernel-3.4.0_pre2 patch)

Same enhancement, different genkernel version

This patch was made with genkernel-3.4.0_pre2.
Comment 4 Tim Yamin (RETIRED) gentoo-dev 2006-07-11 05:10:25 UTC
A few problems:

-		GRUB_BOOTFS=$(awk '/^[^#].+[[:space:]]\/boot[[:space:]]/ { print $1 }' /etc/fstab)
+		GRUB_BOOTFS=$(awk '/^[^#].+[[:space:]]\${BOOTDIR}[[:space:]]/ { print $1 }' /etc/fstab)

... don't any slashes in ${BOOTDIR} need escaping? And note the single quotes in the expression, the variable expansion won't kick in... Anyway, please try this patch on top of your existing patch and check things work.
Comment 5 Tim Yamin (RETIRED) gentoo-dev 2006-07-11 05:10:51 UTC
Created attachment 91453 [details, diff]
Fix quoting issues
Comment 6 Martin Parm 2006-07-11 09:11:40 UTC
(In reply to comment #4)
> A few problems:
> 
> -               GRUB_BOOTFS=$(awk '/^[^#].+[[:space:]]\/boot[[:space:]]/ {
> print $1 }' /etc/fstab)
> +               GRUB_BOOTFS=$(awk '/^[^#].+[[:space:]]\${BOOTDIR}[[:space:]]/ {
> print $1 }' /etc/fstab)

Actually I figured out a much better and more correct way to write that expression altogether:
  GRUB_BOOTFS=$(awk 'BEGIN{RS="((#[^\n]*)?\n)"}( $2 == "'${BOOTDIR}'") { print $1; exit }' /etc/fstab)

This new expression filters out comments correctly (unlike to original one, which only filters strictly leading #'s) and it handles dublicates. It also makes use of awk's field-handling and simple string-matching, which makes escaping unneccesary.
Comment 7 Martin Parm 2006-07-11 09:20:46 UTC
Created attachment 91481 [details, diff]
Fixes awk- and egrep-expression, a few print_info's and rewrites isBootRO()

This patch should on top of the two previous ones (91372 and 91453).
It contains :
- Better awk-expressions in gen_bootloader.sh
- A better (more readable) rewrite of isBootRO()
- Better egrep-expressions in genkernel (the file)
- Fixes quotation in a few print_info expressions
Comment 8 Martin Parm 2006-07-11 09:23:34 UTC
Created attachment 91483 [details, diff]
Adds --bootdir commandline parameter (genkernel-3.4.0_pre2 patch, combined with patch 91453 and 91481)

The patch is a combined patch of patches 91372, 91453 and 91481.
Comment 9 Tim Yamin (RETIRED) gentoo-dev 2006-07-18 15:37:03 UTC
3.4.0_pre3 should have all the patches, please check things work and thanks for the patch :)
Comment 10 Martin Parm 2006-07-30 11:21:20 UTC
It seems to work nicely in my setup.
Comment 11 Tim Yamin (RETIRED) gentoo-dev 2006-07-31 15:38:54 UTC
(In reply to comment #10)
> It seems to work nicely in my setup.

Great, closing bug... thanks for the patch.