From: Harlan Stenn Date: Mon, 20 Jun 2011 03:07:56 +0000 (-0400) Subject: genLocInfo improvements X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a06b6b5e0015a749fbe0f428bf9318288eef29d;p=thirdparty%2Fntp.git genLocInfo improvements bk: 4dfeb98cXYOTZppMN5svvQwvBpTOlw --- diff --git a/ChangeLog b/ChangeLog index 5bfc72fb92..a1f0a86a72 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +* genLocInfo improvements. * Add the man page tag "flavor" to the loc.* files. * Add/distribute genLocInfo. (4.2.7p183) 2011/06/19 Released by Harlan Stenn diff --git a/scripts/genLocInfo b/scripts/genLocInfo index 8785a58192..597edce593 100755 --- a/scripts/genLocInfo +++ b/scripts/genLocInfo @@ -1,13 +1,71 @@ #! /bin/sh -# Figure out which loc.* file we want to use. +case "$1" in + -v) + V= ;; + *) V=": " ;; +esac + +PATH=$PATH:sntp/libevent/build-aux +RC=0 + +# Figure out which loc.* file we want to use. +# # Either start parsing them from least- to most-specific, # or just grab the one we like best. -LF="loc.legacy"; +set `scripts/cvo.sh @osname@ @osver@` || exit 1 -echo "Using <$LF>" +CVO_OSNAME=$1 +CVO_OSVER=$2 + +x=$CVO_OSVER +LF= + +while true +do + case "$x" in + '') break ;; + esac + lf=loc.$CVO_OSNAME$x + if test -f $lf + then + LF=$lf + break + fi + case "$x" in + *.*) x=`echo $x | sed -e 's/\.[^.]*$//'` ;; + *) x= ;; + esac +done +case "$LF" in + '') + lf=loc.$CVO_OSNAME + if test -f $lf + then + LF=$lf + fi + ;; +esac +case "$LF" in + '') + lf=loc.legacy + if test -f $lf + then + LF=$lf + fi + ;; +esac + +case "$LF" in + '') + echo "No loc.XXX file found!" >&2 + exit 1 + ;; +esac + +${V}echo "Using <$LF>" >&2 ### @@ -19,13 +77,14 @@ while true do if read c d s x then - # echo "Got <$c><$d><$s><$x>" + # echo "Got <$c><$d><$s><$x>" >&2 case "$c" in \#*) continue ;; esac case "$x" in '') ;; - *) echo "Unrecognized input: <$c,$d,$s,$x>" + *) echo "Unrecognized input: <$c,$d,$s,$x>" >&2 + RC=1 continue ;; esac @@ -40,9 +99,10 @@ do ;; esac case "$c,$d,$s" in - *,bin,*) ;; - *,sbin,*) ;; - *) echo "Unrecognized input: <$c,$d,$s>" + *,bin,*) DB=bin ; DS= ;; + *,sbin,*) DB= ; DS=sbin ;; + *) echo "Unrecognized input: <$c,$d,$s>" >&2 + RC=1 continue ;; esac @@ -50,17 +110,42 @@ do *,*,1) ;; *,*,1m) ;; *,*,8) ;; - *) echo "Unrecognized input: <$c,$d,$s>" + *) echo "Unrecognized input: <$c,$d,$s>" >&2 + RC=1 continue ;; esac + # Should be OK, mostly... - echo "<$c> gets installed in <$d> with a <$s> manpage suffix" + C=`echo $c | sed -e 'y/abcdefghijklmnopqrstuvwxyz-/ABCDEFGHIJKLMNOPQRSTUVWXYZ_/'` + # echo "c: <$c>, C: <$C>, DB: <$DB>, DS: <$DS>" >&2 + + case "$d" in + bin) + eval ${C}_DB=$c + eval ${C}_DS= + ;; + sbin) + eval ${C}_DB= + eval ${C}_DS=$c + ;; + *) echo "$0: GRONK: d" >&2 + exit 1 + ;; + esac + eval ${C}_MS=$s + + # echo "<$c> gets installed in <$d> with a <$s> manpage suffix" >&2 + # echo "${C}_DB is <`eval echo '$'${C}_DB`>" >&2 + # echo "${C}_DS is <`eval echo '$'${C}_DS`>" >&2 + # echo "${C}_MS is <`eval echo '$'${C}_MS`>" >&2 else break fi done < $LF IFS=$oIFS -echo "All done:" -echo "TF is <$TF>" +${V}echo "All done:" >&2 +${V}echo "TF is <$TF>" >&2 + +exit $RC