Skip site navigation (1)Skip section navigation (2)
Date:      21 Jun 2000 23:40:55 +0200
From:      Cyrille Lefevre <clefevre@no-spam.citeweb.net>
To:        current@FreeBSD.ORG
Subject:   Re: kernel config format migration script
Message-ID:  <itv21zmg.fsf@pc166.gits.fr>
In-Reply-To: Brian Fundakowski Feldman's message of "Wed, 21 Jun 2000 08:47:24 -0700 (PDT)"
References:  <Pine.BSF.4.21.0006210843530.14479-100000@builder.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Brian Fundakowski Feldman <green@FreeBSD.ORG> writes:

> I made a sed script to ease migration of kernel configuration files from
> the few-weeks-ago-CURRENT to current-CURRENT, and thought I might as well
> share it since it makes things easy (autonomous :)
> 
> You can find it at
> 	http://people.freebsd.org/~green/oldconfig2new
> It requires extended regular expression support (because old regexps
> are so cumbersome to actually _use_), so for example:
> 	mv GREEN GREEN.old
> 	perl gethints.pl GREEN
> 	sed -Ef oldconfig2new GREEN.old > GREEN

this one seems to be working w/ a standard sed :

==========----------========== CUT HERE ==========----------==========
#!/usr/bin/sed -f

# since ata[0-9] requires ata alone, delete them.
/^#*[ \t]*device[ \t]\{1,\}ata[0-9]\{1,\}/d

# delete fd[0-9] and fd alone.
/^#*[ \t]*device[ \t]\{1,\}fd[0-9]\{1,\}/d
/^#*[ \t]*device[ \t]\{1,\}fd$/d

# get rid of terminal spaces
s/[ \t]\{1,\}$//

# hints stuffs
/^ident[ \t]\{1,\}/ {
        h
        s/^ident\([ \t]\{1,\}\)\([a-zA-Z0-9_]\{1,\}\)/hints\1"\2.hints"/
#                                 ^^^^^^^^^^ I'm not sure about this
#       are underscore and digits valid characters here ?
        H
        x
}
s/^\(#*[ \t]*\)pseudo-device\([ \t]\{1,\}\)/\1device\2/
s/^\(#*[ \t]*\)device\([ \t]\{1,\}\)\([a-zA-Z_]\{1,\}\)\([0-9]\{1,\}\)\([ \t]*\)\([^#]*\)\(.*\)$/\1device\2\3\5\7/
#                                      ^^^^^^^ also, here ?

==========----------========== CUT HERE ==========----------==========

\t need to be replaced w/ real tabs (under vi, :%s/\\t/<TAB>/g)
just in case, I put them here to be reliable (and visible :) via email.

Cyrille.
-- 
home:mailto:clefevre@no-spam.citeweb.net Supprimer "no-spam." pour me repondre.
work:mailto:Cyrille.Lefevre@no-spam.edf.fr Remove "no-spam." to answer me back.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?itv21zmg.fsf>