unixodbc: auto-generate odbcinst.ini
[feed/packages.git] / libs / unixodbc / files / odbc.init
1 #!/bin/sh /etc/rc.common
2
3 START=50
4
5 gen_odbcinst() {
6 local inifile
7
8 echo "[ODBC]"
9 echo "Trace = off"
10 echo "TraceFile ="
11
12 for inifile in /etc/odbcinst.ini.d/*.ini; do
13 cat "$inifile"
14 done
15 }
16
17 start() {
18 [ ! -d /tmp/etc ] && mkdir /tmp/etc
19
20 gen_odbcinst > /tmp/etc/odbcinst.ini.new
21 chmod 0644 /tmp/etc/odbcinst.ini.new
22
23 [ -e /tmp/etc/odbcinst.ini ] && ( rm /tmp/etc/odbcinst.ini || return 1 )
24
25 mv /tmp/etc/odbcinst.ini.new /tmp/etc/odbcinst.ini
26 }