#!/bin/sh #---------------------------------------------------------------------------------- # /var/install/bin/afick-update-db - script to compare database # # Copyright (c) 2018-2021 The Eisfair Team, team(at)eisfair(dot)org # # Creation: 2018-01-16 jed # Last Update: $Id$ # # Usage: afick-update-db [--nogui] # --nogui - don't use GUI to display results # # 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. #---------------------------------------------------------------------------------- # include eislib . /var/install/include/eislib # activate debug output #debug_certs=true if ${debug_certs:-false} then exec 2> /tmp/$(basename ${0})-trace$$.log set -x ask_debug=true export ask_debug fi #---------------------------------------------------------------------------------- # show wait #---------------------------------------------------------------------------------- show_wait () { mecho -n " wait [ " colpos=1 while [ -n "`ps --no-headers $!`" ] do mecho --info -n "." sleep 1 colpos=`expr ${colpos} + 1` if [ "${colpos}" -ge 52 ] then mecho " ]" mecho -n " wait [ " colpos=1 fi done mecho " ] " } #================================================================================== # main #================================================================================== pgmname=`basename $0` module_name=`basename ${pgmname} | cut -d- -f1` logfile=/var/${module_name}/log/${module_name}.log tmpfile=/tmp/${module_name}-update-db.$$ nogui=0 if [ "$1" = '--nogui' ] then nogui=1 fi clrhome mecho --info "Compare and update the database" echo /usr/bin/afick --update > ${tmpfile} 2> ${tmpfile} & # entertain the user show_wait # evaluate exit code wait $! if [ -s ${tmpfile} ] then # output file exists and has a size greater than zero # 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 sleep 1 if [ ${nogui} -eq 0 ] then # show GUI /var/install/bin/show-doc.cui ${color} ${frame} --follow --title ${tmpfile} ${tmpfile} else more ${tmpfile} fi else mecho "nothing to do." fi # append configuration messages to log file # cat ${tmpfile} >> ${logfile} rm -f ${tmpfile} mecho "done." #================================================================================== # end #================================================================================== exit 0