cfg2html (cfg2html-6.34.0) | : | cfg2html (cfg2html-6.34.8) | ||
---|---|---|---|---|
# | # | |||
# @(#) $Id: cfg2html,v 6.33 2018/01/04 22:22:37 ralph Exp $ | # @(#) $Id: cfg2html,v 6.35 2018/03/29 07:49:01 ralph Exp $ | |||
# ------------------------------------------------------------------------- | # ------------------------------------------------------------------------- | |||
# This is the wrapper for cfg2html for LINUX and HP-UX | # This is the wrapper for cfg2html for LINUX and HP-UX | |||
# CFG2HTML - license: see GPL v3 | # CFG2HTML - license: see GPL v3 | |||
# ------------------------------------------------------------------------- | # ------------------------------------------------------------------------- | |||
# The cfg2html is developed on https://github.com/cfg2html/cfg2html | # The cfg2html is developed on https://github.com/cfg2html/cfg2html | |||
# The main download area/web site is http://www.cfg2html.com | # The main download area/web site is http://www.cfg2html.com | |||
# SUSE open build service (OBS): https://build.opensuse.org/package/show/home:gd ha/cfg2html | # SUSE open build service (OBS): https://build.opensuse.org/package/show/home:gd ha/cfg2html | |||
PRGNAME=$0 | PRGNAME=$0 | |||
MY_OS=$(uname -s) | MY_OS=$(uname -s) | |||
skipping to change at line 43 | skipping to change at line 43 | |||
touch /tmp/cfg2html.respawn | touch /tmp/cfg2html.respawn | |||
exec /usr/bin/ksh $PRGNAME $args | exec /usr/bin/ksh $PRGNAME $args | |||
fi | fi | |||
rm -f /tmp/cfg2html.respawn # get rid of the temporary lock as soon as possible | rm -f /tmp/cfg2html.respawn # get rid of the temporary lock as soon as possible | |||
#### | #### | |||
PRODUCT="Config to HTML - cfg2html" | PRODUCT="Config to HTML - cfg2html" | |||
# this CVS id is also used by the Makefiles to get the version number! | # this CVS id is also used by the Makefiles to get the version number! | |||
CVS="$Id: cfg2html,v 6.33 2018/01/04 22:22:37 ralph Exp $" | # may be obsoleted by git tag --describe handling? | |||
CVS="$Id: cfg2html,v 6.35 2018/03/29 07:49:01 ralph Exp $" | ||||
PROGRAM=$(echo $CVS|cut -f2 -d" "|cut -f1 -d,) | PROGRAM=$(echo $CVS|cut -f2 -d" "|cut -f1 -d,) | |||
VERSION=$(echo $CVS|cut -f3 -d" ") | VERSION=$(echo $CVS|cut -f3 -d" ") | |||
RELEASE_DATE="2018-01-05" ## YYYY-MM-DD ?! | RELEASE_DATE="2018-01-24" ## YYYY-MM-DD ?! | |||
#echo $PROGRAM,$VERSION,$RELEASE_DATE | #echo $PROGRAM,$VERSION,$RELEASE_DATE | |||
OS=$(uname) | OS=$(uname) | |||
OS=$(echo $OS | tr 'A-Z' 'a-z' | sed -e 's/-//') | OS=$(echo $OS | tr 'A-Z' 'a-z' | sed -e 's/-//') | |||
CFG_CMDLINE=$* | CFG_CMDLINE=$* | |||
COPYRIGHT="Copyright (C) 1999-2018 | COPYRIGHT="Copyright (C) 1999-2018 ROSE SWE, Dipl.-Ing. Ralph Roth" | |||
ROSE SWE, Dipl.-Ing. Ralph Roth" | ||||
STARTTIME=$SECONDS | STARTTIME=$SECONDS | |||
LANG="C" | LANG="C" | |||
LANG_ALL="C" | LANG_ALL="C" | |||
LC_MESSAGE="C" | LC_MESSAGE="C" | |||
## maybe we should skip the root check if the command line option -h or -? is pa ssed? | ## maybe we should skip the root check if the command line option -h or -? is pa ssed? | |||
if [ "$(whoami)" != "root" -a "$1" != "-h" ] | if [ "$(whoami)" != "root" -a "$1" != "-h" ] | |||
then | then | |||
echo "$(whoami) - You must be root to run the script $PROGRAM" | echo "$(whoami) - You must be root to run the script $PROGRAM" | |||
exit 1 | exit 1 | |||
fi | fi | |||
# introduce trap to make sure the temporary directories get cleaned up | # introduce trap to make sure the temporary directories get cleaned up | |||
trap "DoExitTasks" 0 1 2 3 6 11 15 | trap "DoExitTasks" 0 1 2 3 6 11 15 | |||
# initialize defaults | # initialize defaults | |||
case $MY_OS in | case $MY_OS in | |||
HP-UX) TMP_DIR="$(mktemp -d /tmp -p cfg2html_)" ;; | HP-UX) TMP_DIR="$(mktemp -d /tmp -p cfg2html_)" ;; | |||
Linux|SunOS) TMP_DIR="$(mktemp -d /tmp/cfg2html.XXXXXXXXXXXXXXX)" ;; | Linux|SunOS) TMP_DIR="$(mktemp -d /tmp/cfg2html.XXXXXXXXXXXXXXX)" ;; | |||
*) TMP_DIR="/tmp/${PROGRAM}_${RANDOM}" ;; ## hopefu lly AIX and SUN have $RANDOM too - why not using mktemp too, its safer! RR | *) TMP_DIR="/tmp/${PROGRAM}_${RANDOM}" ;; ## hopefully AIX and SUN have $RA NDOM too - why not using mktemp too, its safer! RR | |||
esac | esac | |||
export TMP_DIR # be on the safe side? | ||||
# SHARE_DIR will be redefined (to /opt/$PROGRAM) by 'make depot' not by 'make rp m/deb' | # SHARE_DIR will be redefined (to /opt/$PROGRAM) by 'make depot' not by 'make rp m/deb' | |||
SHARE_DIR=/usr/share/$PROGRAM | SHARE_DIR=/usr/share/$PROGRAM | |||
# /etc/$PROGRAM may contain local.conf (hpux), default.conf always under SHARE_D IR/etc/ | # /etc/$PROGRAM may contain local.conf (hpux), default.conf always under SHARE_D IR/etc/ | |||
CONFIG_DIR="/etc/$PROGRAM" | CONFIG_DIR="/etc/$PROGRAM" | |||
# VAR_DIR can be overruled in default.conf or local.conf file (or by -o option) | # VAR_DIR can be overruled in default.conf or local.conf file (or by -o option) | |||
VAR_DIR="/var/log/$PROGRAM" | VAR_DIR="/var/log/$PROGRAM" | |||
VERBOSE= | VERBOSE= | |||
DEBUG= | DEBUG= | |||
skipping to change at line 119 | skipping to change at line 121 | |||
OLD="" | OLD="" | |||
i=2030 | i=2030 | |||
# date sanity check. complains if cfg2html is too old, must be adjusted every ye ar to fit | # date sanity check. complains if cfg2html is too old, must be adjusted every ye ar to fit | |||
# | # | |||
while [ $i -gt 2018 ] ## where we want to stop, complains if older than two ye ars | while [ $i -gt 2018 ] ## where we want to stop, complains if older than two ye ars | |||
do | do | |||
[ $YEAR -gt $i ] && OLD=$OLD" very" | [ $YEAR -gt $i ] && OLD=$OLD" very" | |||
# echo $i - $OLD | # echo $i - $OLD | |||
((i=(i-1))) | ((i=(i-1))) | |||
[ "${OLD}" != "" ] && echo "WARNING! This version of cfg2html is$OLD old! Up date asap!" | [ "${OLD}" != "" ] && echo "WARNING! This version of cfg2html is$OLD old! Up date ASAP!" | |||
done | done | |||
# source the include functions | # source the include functions | |||
for script in $BASE_DIR/lib/*.sh ; do | for script in $BASE_DIR/lib/*.sh ; do | |||
[[ -f $script ]] && . $script | [[ -f $script ]] && . $script | |||
done | done | |||
# source the main program, e.g. cfg2html-hpux.sh | # source the main program, e.g. cfg2html-hpux.sh | |||
if [ "`echo $MY_OS | grep BSD`" ]; then | if [ "`echo $MY_OS | grep BSD`" ]; then | |||
. $BASE_DIR/${PROGRAM}-bsd.sh | . $BASE_DIR/${PROGRAM}-bsd.sh | |||
skipping to change at line 147 | skipping to change at line 149 | |||
exit 1 | exit 1 | |||
fi | fi | |||
fi | fi | |||
RETCODE=$? | RETCODE=$? | |||
# define OUTPUT_URL in your local.conf file | # define OUTPUT_URL in your local.conf file | |||
CopyFilesAccordingOutputUrl | CopyFilesAccordingOutputUrl | |||
if [ $RETCODE -eq 0 ] | if [ $RETCODE -eq 0 ] | |||
then | then | |||
echo "No errors reported." | echo "No errors reported." | |||
else | else | |||
echo "Returncode=$RETCODE (see file $ERROR_LOG)" | echo "Returncode=$RETCODE (see file $ERROR_LOG)" | |||
fi | fi | |||
# cleanup | # cleanup | |||
rm -f /tmp/cfg2html.respawn $LOCK | rm -f /tmp/cfg2html.respawn $LOCK | |||
rm -rf $TMP_DIR | rm -rf $TMP_DIR | |||
exit $RETCODE | exit $RETCODE | |||
End of changes. 9 change blocks. | ||||
9 lines changed or deleted | 11 lines changed or added |