Re: Better code in mythweb.postinst

Top Page

Reply to this message
Author: Guillaume Membré
Date:  
To: dmo-discussion
Subject: Re: Better code in mythweb.postinst
Hi, did you try with :
s#\(^[ \t]*setenv[ \t]\+db_server[ \t]\+\"\)[^\"]*\"#\1$hostname\"#g;

I replaced / by # for sed to tell him that # in the command separator
and no more / problem

On Fri, Aug 16, 2013 at 10:30 AM, Christian Marillat <marillat@???> wrote:
> Hi,
>
> In mythweb.postinst we have this code. The problem is that sed fail if
> the mysql server password (db_password) contain a / character.
>
> Someone has a better idea ?
>
> ,----
> |       cat $INPUT | sed -e "
> | s/\(^[ \t]*setenv[ \t]\+db_server[ \t]\+\"\)[^\"]*\"/\1$hostname\"/g;
> | s/\(^[ \t]*setenv[ \t]\+db_name[ \t]\+\"\)[^\"]*\"/\1$database\"/g;
> | s/\(^[ \t]*setenv[ \t]\+db_login[ \t]\+\"\)[^\"]*\"/\1$mythtv_username\"/g;
> | s/\(^[ \t]*setenv[ \t]\+db_password[ \t]\+\"\)[^\"]*\"/\1$mythtv_password\"/g;
> |       " > $NEW
> `----

>
> Here is the sample file provided in
> /usr/share/mythtv/mythweb/mythweb-mysql.conf if
> /etc/mythtv/mythweb-mysql.conf doesn't exist :
>
> ,----
> |       setenv db_server        "localhost"
> |       setenv db_name          "mythconverg"
> |       setenv db_login         "mythtv"
> |       setenv db_password      "mythtv"
> `----

>
> Christian
>