[WBEL-users] Need some help with sed
Benjamin J. Weiss
Benjamin J. Weiss" <benjamin@birdvet.org
Mon, 15 Nov 2004 10:35:24 -0600 (CST)
Howdy, y'all! :)
I'm trying to write a script that can be run on new WBEL installations
that will turn the box into an email server with anti-virus, spam, TLS,
etc. Anyway, I'm using sed to change the configuration files, and I'm
running into a problem. (Note that this is the first time I've used sed
for anything).
I'm trying to use sed to append Dag Wieer's repo to the /etc/yum.conf
file. Everything works great except the final expression. The two before
it work fine, where I'm using single quotes for the append command.
However, I want to use a shell variable in the final expressin, so I'm
using double quotes. I've read the sed chapter in "Linux in a Nutshell"
and googled and read other sites, but I can't seem to figure this one out.
The relevant parts of the script are as follows:
--------------
YUM_BASE=http://cassandra/whitebox_mirror/\$releasever/en/os/\$basearch/
YUM_UPDATES=http://cassandra/whitebox_mirror/\$releasever/en/updates/
YUM_DAG=http://cassandra/whitebox_mirror/dag/
# Set up Yum to hit a local repository. I'm including Dag Wieer's
# repo becuase he maintains packages that otherwise we'd have to compile
# and maintain ourselves.
mv /etc/yum.conf /etc/yum.conf.000
sed -e '/http:/s/\(.*\)/#\1/' \
-e '/ftp:/s/\(.*\)/#\1/' \
-e "/Base/abaseurl=$YUM_BASE" \
-e "/Updates/abaseurl=$YUM_UPDATES" \
-e '$a\[dag]' \
-e '$a\name=Dag Wieers Repo' \
-e "$a\baseurl=$YUM_DAG" \
/etc/yum.conf.000 > /etc/yum.conf
--------------
Any ideas what I'm doing wrong?
Thanks!
Ben