#!/bin/sh #------------------------------------------------------------------------------ # /var/install/bin/carddav2xml-force-update - force update of FRITZ!Box # address book # # Copyright (c) 2015-2019 The Eisfair Team, team(at)eisfair(dot)org # # Creation: 2015-04-11 jed # Last Update: $Id$ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #------------------------------------------------------------------------------ # read eislib . /var/install/include/eislib . /var/install/include/check-eisfair-version pgmname=`basename $0` module_name=`echo "${pgmname}" | cut -d- -f1` # debug mode true/false #debug=true if ${debug:-false} then exec 2> /tmp/${pgmname}-trace$$.log set -x ask_debug=true export ask_debug fi carddav2xml_runpath=/var/lib/${module_name} package_configfile=/etc/config.d/${module_name} carddav2xml_bin=/usr/lib/${module_name}/${module_name}.php title_str='Force manual XML export' if [ -f ${package_configfile} ] then . ${package_configfile} if [ "${START_CARDDAV2XML}" = 'yes' ] then ### list available configuration sets ### clrhome mecho --info "Log file view" mecho mecho "Which log file do you want to view?" mecho techo --begin 1 3 2 30 2 30 techo --row "" --info "Nr" "" --info "Comment" "" "" idx=1 active_entries=':' while [ ${idx} -le ${CARDDAV2XML_N} ] do eval active='$CARDDAV2XML_'${idx}'_ACTIVE' if [ "${active}" = 'yes' ] then eval comment='$CARDDAV2XML_'${idx}'_COMMENT' log_file=/var/log/${module_name}-${idx}-output-trace.log if [ ! -f "${log_file}" ] then techo --row "" ${idx} ":" "${comment}" "" --warn "-> no log file found!" else techo --row "" ${idx} ":" "${comment}" active_entries="${active_entries}${idx}:" fi fi idx=`/usr/bin/expr ${idx} + 1` done techo --end mecho idxmax=`/usr/bin/expr ${idx} - 1` endflag=0 if [ ${idxmax} -gt 0 ] then until [ ${endflag} = 1 ] do /var/install/bin/ask "Please enter entry number (1-${idxmax}) or (q)uit:" '' '+' > /tmp/ask.$$ rc=$? nbr=`cat /tmp/ask.$$` rm -f /tmp/ask.$$ if [ $rc = 255 ] then exit 1 fi case "${nbr}" in [qQ] ) ### quit ### endflag=1 exit 1 ;; [0-9] | [1-9][0-9] ) ### number entered ### if [ ${nbr} -ge 1 -a ${nbr} -le ${idxmax} ] then echo "${active_entries}" | grep -q ":${nbr}:" if [ $? -eq 0 ] then log_file=/var/log/${module_name}-${nbr}-output-trace.log # show output if [ -s ${log_file} ] then # check if show-doc.cui supports colors color='' frame='' if $(grep -qE "^MENU=['\"]/var/install/bin/show-menu['\"]" /etc/config.d/setup) then color='--nocolor' frame='--noframe' fi /var/install/bin/show-doc.cui ${color} ${frame} --follow --title "${title_str}" ${log_file} fi endflag=1 fi fi ;; * ) ;; esac done else mecho --info "There are currently no configuration sets defined!" fi mecho anykey fi #else # mecho --error "Configuration file '${package_configfile}' doesn't exist!" fi exit 0