Just updated my kernel via yum and
# cat /etc/redhat-release CentOS release 4.0 (Final) Red Hat Enterprise Linux AS release 4 (Nahant)
needed the second line to install HP drivers and left it there for any other packages which might need it.
just generated the following in grub:
title CentOS Red Hat Enterprise Linux AS (2.6.9-11.EL) Red Hat Enterprise Linux AS (2.6.9-11.ELsmp) root (hd0,2) kernel /vmlinuz-2.6.9-11.EL ro root=/dev/md0 initrd /initrd-2.6.9-11.EL.img title CentOS Red Hat Enterprise Linux AS (2.6.9-11.ELsmp) root (hd0,2) kernel /vmlinuz-2.6.9-11.ELsmp ro root=/dev/md0 initrd /initrd-2.6.9-11.ELsmp.img
so they're obviously a ' sed "s/ release .*//" ' which should be replaced with sed "s/ release .*//" | head -n 1
i believe this is in /sbin/new-kernel-pkg in mkinitrd-4.1.18-2 on line 132:
title="$(sed 's/ release.*$//' < /etc/redhat-release) ($version)"
which IMHO should be:
title="$(sed 's/ release.*$//' < /etc/redhat-release | head -n 1) ($version)"
Cheers, MaZe.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Fri, Jun 10, 2005 at 09:01:31PM +0200, Maciej ?enczykowski wrote:
i believe this is in /sbin/new-kernel-pkg in mkinitrd-4.1.18-2 on line 132:
title="$(sed 's/ release.*$//' < /etc/redhat-release) ($version)"
which IMHO should be:
title="$(sed 's/ release.*$//' < /etc/redhat-release | head -n 1) ($version)"
There is no need to use "head", since sed can handle that on its own.
Just make it 's/ release.*$//;q'. It will only process 1 line from the input file, even if 's' doesn't match anything.
- -- Rodrigo Barbosa rodrigob@suespammers.org "Quid quid Latine dictum sit, altum viditur" "Be excellent to each other ..." - Bill & Ted (Wyld Stallyns)
On 6/10/05, Rodrigo Barbosa rodrigob@suespammers.org wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Fri, Jun 10, 2005 at 09:01:31PM +0200, Maciej ?enczykowski wrote:
title="$(sed 's/ release.*$//' < /etc/redhat-release | head -n 1) ($version)"
There is no need to use "head", since sed can handle that on its own.
Just make it 's/ release.*$//;q'. It will only process 1 line from the input file, even if 's' doesn't match anything.
These both seem flawed and could be improved by doing the search for CentOS to handle the case where someone puts a new line at the beginning of the file instead of the end. Unless of course the various software that require that entry in the /etc/redhat-release require it to be the last line in the file - I wouldn't know, I don't use them.
Of course, that would be yet another deviation from the upstream SRPM which only helps a few corner cases...seems not worth it.
Greg
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Fri, Jun 10, 2005 at 04:43:24PM -0600, Greg Knaddison wrote:
On 6/10/05, Rodrigo Barbosa rodrigob@suespammers.org wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Fri, Jun 10, 2005 at 09:01:31PM +0200, Maciej ?enczykowski wrote:
title="$(sed 's/ release.*$//' < /etc/redhat-release | head -n 1) ($version)"
There is no need to use "head", since sed can handle that on its own.
Just make it 's/ release.*$//;q'. It will only process 1 line from the input file, even if 's' doesn't match anything.
These both seem flawed and could be improved by doing the search for CentOS to handle the case where someone puts a new line at the beginning of the file instead of the end. Unless of course the various software that require that entry in the /etc/redhat-release require it to be the last line in the file - I wouldn't know, I don't use them.
Of course, that would be yet another deviation from the upstream SRPM which only helps a few corner cases...seems not worth it.
I also don't think it is worth it. After all, redhat-release should only contain 1 line on it, since a single distribution can't be 2 things at once.
In any case, the expression you are looking for is:
sed -n '0,/CentOS/s/ release.*$//p'
Or, alternatively:
sed -n 's/^(.*CentOS.*) release.*$/\1/p;q'
Even tho I don't think that is a good idea. If we are going to lock it to CentOS, might just as well hardcode it on the script.
[]s
- -- Rodrigo Barbosa rodrigob@suespammers.org "Quid quid Latine dictum sit, altum viditur" "Be excellent to each other ..." - Bill & Ted (Wyld Stallyns)