[yast-devel] replacing string at install time
Hi all, I need to set a value for a variable in a file during the install time. (need to replace FLAG="true" by FLAG="no" in /etc/someconf.conf file). I thought i can place the [replace -s 'FLAG="true"' 'FLAG="no"' -- /etc/someconf.conf] in my script which is called by yast GUI. But it seems replace command is missing in SLES. So i have planned to keep like sed 's/FLAG="true"/FLAG="false"/g' /etc/someconf.conf > tmp && mv tmp /etc/someconf. It works fine in the post install. Will it work in the fresh install scenario? Creating the new file (tmp) will work during the fresh install? If there is a better solution please suggest me. Thanks, -Kalyan -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On Wed, May 23, S Kalyanasundaram wrote:
sed 's/FLAG="true"/FLAG="false"/g' /etc/someconf.conf > tmp && mv tmp /etc/someconf.
It works fine in the post install. Will it work in the fresh install scenario? Creating the new file (tmp) will work during the fresh install? If there is a better solution please suggest me.
Creating files works, but you must not assume there is no file or directory named tmp in the CWD. If CWD is e.g. /, you'd redirect to /tmp, which is most probabely a directory. sed supports inplace editing: -i[SUFFIX], --in-place[=SUFFIX] edit files in place (makes backup if extension supplied) sed --in-place 's/FLAG="true"/FLAG="false"/g' /etc/someconf.conf -- cu, Michael Andres +------------------------------------------------------------------+ Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4 +------------------------------------------------------------------+ Michael Andres YaST Development ma@novell.com SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0 +------------------------------------------------------------------+ -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (2)
-
Michael Andres
-
S Kalyanasundaram