-
Notifications
You must be signed in to change notification settings - Fork 0
/
rctl.subr
42 lines (30 loc) · 984 Bytes
/
rctl.subr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
if [ ! "$_CBSD_RCTL_SUBR" ]; then
_CBSD_RCTL_SUBR=1
###
#v10.0.2
# this is a temporary wrapper for version 9.2.2 is intended to make the transition to sqlite3 version if rc.conf more painless
# required:
# strings.subr
#
# init_rctlconf ( $jname must be not empty )
# ( $sqlfile - specify sqlfile in dbdir for searching data. If empty - local file is prefered )
init_rctlconf()
{
local _A _ALLCOL jname _sqlfile _datafile="local"
[ -n "${2}" ] && _datafile="${2}"
_sqlfile="${dbdir}/${_datafile}.sqlite"
[ ! -f "${_sqlfile}" ] && return 0
. ${sharedir}/rctl.conf
#sets to default
for i in ${MYCOL}; do
eval ${i}=0
done
_ALLCOL=$( echo ${MYCOL}| /usr/bin/tr " " "," )
# empty string on remote node if cbsd version is mistmatch ( diff. jail schema )
_A=$( 2>/dev/null env sqldelimer="|" ${miscdir}/sqlcli ${_sqlfile} "SELECT ${_ALLCOL} FROM rctl WHERE jname=\"$1\"" )
[ -z "${_A}" ] && return 1
sqllist "${_A}" ${MYCOL}
}
init_rctlconf $jname $sqlfile
###
fi