Better code in mythweb.postinst

Top Page

Reply to this message
Author: Christian Marillat
Date:  
To: dmo-discussion
Subject: Better code in mythweb.postinst
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