View | Details | Raw Unified | Return to bug 16749
Collapse All | Expand All

(-)a/debian/scripts/koha-functions.sh (-8 / +19 lines)
Lines 222-237 adjust_paths_dev_install() Link Here
222
# corresponding tag in koha-conf.xml
222
# corresponding tag in koha-conf.xml
223
223
224
    local instancename=$1
224
    local instancename=$1
225
    local dev_install
225
    local dev_install=$(run_safe_xmlstarlet $instancename dev_install)
226
227
    if [ -e /etc/koha/sites/$instancename/koha-conf.xml ]; then
228
        dev_install=$(xmlstarlet sel -t -v 'yazgfs/config/dev_install' /etc/koha/sites/$instancename/koha-conf.xml)
229
    fi
230
226
231
    if [ "$dev_install" != "" ]; then
227
    if [ "$dev_install" != "" ]; then
232
        DEV_INSTALL=1
228
        DEV_INSTALL=1
233
        KOHA_HOME=$dev_install
229
        KOHA_HOME=$dev_install
234
        PERL5LIB=$dev_install
230
        PERL5LIB=$dev_install
231
    else
232
        DEV_INSTALL=0
235
    fi
233
    fi
236
}
234
}
237
235
Lines 244-256 get_instances() Link Here
244
get_loglevels()
242
get_loglevels()
245
{
243
{
246
    local instancename=$1
244
    local instancename=$1
247
    local retval=$(xmlstarlet sel -t -v 'yazgfs/config/zebra_loglevels' /etc/koha/sites/$instancename/koha-conf.xml)
245
    local retval=$(run_safe_xmlstarlet $instancename zebra_loglevels)
248
    if [ "$retval" != "" ]; then
246
    if [ "$retval" != "" ]; then
249
        echo "$retval"
247
        echo "$retval"
250
    else
248
    else
251
        echo "none,fatal,warn"
249
        echo "none,fatal,warn"
252
    fi
250
    fi
253
254
}
251
}
255
252
256
get_tmpdir()
253
get_tmpdir()
Lines 272-274 get_tmpdir() Link Here
272
    fi
269
    fi
273
    echo $(dirname $retval)
270
    echo $(dirname $retval)
274
}
271
}
275
- 
272
273
run_safe_xmlstarlet()
274
{
275
    # When running xmlstarlet and the expr is not found, the script may fail
276
    # silently under certain conditions. For instance, script koha-plack
277
    # failed under kohadevbox/jessie. Until we resolve that, this function
278
    # does a grep first (assuming a unique tag).
279
    local instancename=$1
280
    local myexpr=$2
281
    if [ -e /etc/koha/sites/$instancename/koha-conf.xml ] && grep -q "<$myexpr>" /etc/koha/sites/$instancename/koha-conf.xml; then
282
        echo $(xmlstarlet sel -t -v "yazgfs/config/$myexpr" /etc/koha/sites/$instancename/koha-conf.xml)
283
        return 0
284
    fi
285
    return 1
286
}

Return to bug 16749