OpenSDE Framework (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

674 lines
17 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: lib/sde-config/functions.in
  5. # Copyright (C) 2006 - 2007 The OpenSDE Project
  6. # Copyright (C) 2004 - 2006 The T2 SDE Project
  7. # Copyright (C) 1998 - 2003 Clifford Wolf
  8. #
  9. # More information can be found in the files COPYING and README.
  10. #
  11. # This program is free software; you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; version 2 of the License. A copy of the
  14. # GNU General Public License can be found in the file COPYING.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. . lib/core-functions.in
  17. # Function to cache config.in and subconfig.in file lists
  18. #
  19. create_configin_list() {
  20. bprof cache_configin_list start
  21. if [ ! -f $cfgtmpdir/noexpert-config.in -o ! -f $cfgtmpdir/expert-config.in ]; then
  22. local file= prio= name=
  23. rm -f $cfgtmpdir/{no,}expert-config.in{,.$$}
  24. rm -f $cfgtmpdir/subconfig-*.in{,.$$}
  25. touch $cfgtmpdir/{no,}expert-config.in{,.$$}
  26. # config.in
  27. # FIXME: this expression may produce duplicated entries!! //mnemoc
  28. ls -1 {package/*,misc,lib}/*/config{,-[a-z]*}{,-[0-9]*}.in 2> /dev/null | while read file; do
  29. prio="$( echo "${file##*/}" | sed -n -e "s,.*-\([0-9]*\).in,\1,p" )"
  30. if [ ${prio:-750} -le 500 ]; then
  31. echo "$prio $file" >> $cfgtmpdir/noexpert-config.in.$$
  32. else
  33. echo "${prio:-750} $file" >> $cfgtmpdir/expert-config.in.$$
  34. fi
  35. done
  36. sort -u $cfgtmpdir/noexpert-config.in.$$ | sed 's,^[^ ]* ,. ,g' > $cfgtmpdir/noexpert-config.in
  37. sort -u $cfgtmpdir/expert-config.in.$$ | sed 's,^[^ ]* ,. ,g' > $cfgtmpdir/expert-config.in
  38. rm -f $cfgtmpdir/{no,}expert-config.in.$$
  39. # subconfig.in
  40. ls -1 package/*/*/subconfig-[a-z]*.in 2> /dev/null | while read file; do
  41. prio="$( echo "${file##*/}" | sed -n -e "s,.*-\([0-9]*\).in,\1,p" )"
  42. name="$( echo "${file##*/}" | sed -e "s,-\([0-9]*\).in,.in," )"
  43. echo "${prio:-750} $file" >> $cfgtmpdir/$name.$$
  44. done
  45. for file in $cfgtmpdir/subconfig-[a-z]*.in.$$; do
  46. sort -n $file | sed 's,^[^ ]* ,. ,g' > ${file%.$$}
  47. rm -f $file
  48. done
  49. fi
  50. bprof cache_configin_list stop
  51. }
  52. # Function to cache config.in and subconfig.in file lists
  53. #
  54. create_dot_in_lists() {
  55. local file= x= y=
  56. # {architecture,misc,lib,target,package/*}/*/{pre,post}config.in
  57. bprof cache_dotin_list start
  58. for x in preconfig.in postconfig.in; do
  59. for y in architecture misc lib target; do
  60. file=$cfgtmpdir/$y-$x
  61. if [ ! -f $file ]; then
  62. ls -1 $y/*/$x 2> /dev/null | sed 's,^,. ,' > $file
  63. fi
  64. done
  65. y=package
  66. file=$cfgtmpdir/$y-$x
  67. if [ ! -f $file ]; then
  68. ls -1 $y/*/*/$x 2> /dev/null | sed 's,^,. ,' > $file
  69. fi
  70. done
  71. bprof cache_dotin_list stop
  72. # and {sub,}config.in, which is more complex
  73. create_configin_list
  74. }
  75. hack_stages() {
  76. local stage="$1----------"; shift
  77. local pkgs="$*"
  78. if [ $# -gt 1 ]; then
  79. pkgs="${pkgs// /\|}"
  80. elif [ $# -eq 1 ]; then
  81. true
  82. fi
  83. if [ "$pkgs" ]; then
  84. pkgfilter sed -e "s,^\(.\) [^ ]* \([^ ]*\) \([^ ]*\) \($pkgs\) ,\1 ${stage:0:10} \2 \3 \4 ,"
  85. fi
  86. }
  87. # Functions for working with config/$config/packages
  88. #
  89. # pkgenable package-list
  90. # pkgdisable package-list
  91. # pkgremove package-list
  92. # pkgcheck pattern X|O|.
  93. # pkgfilter cmd arg1 ...
  94. #
  95. if [ -n "$nobashmod" ]
  96. then
  97. pkgin() { :; }
  98. pkgout() { :; }
  99. __pkgfilter() {
  100. "$@" < $cfgtmpdir/config/packages > $cfgtmpdir/packages.new
  101. mv $cfgtmpdir/packages.new $cfgtmpdir/config/packages
  102. }
  103. pkgfilter() {
  104. bprof pkgfilter start
  105. __pkgfilter "$@"
  106. bprof pkgfilter stop
  107. }
  108. pkgenable() {
  109. bprof pkgenable start
  110. local pattern patterns
  111. for pattern; do
  112. patterns="$patterns -e '/ $pattern / s/^./X/'"
  113. done
  114. if [ "$patterns" ]; then
  115. eval "__pkgfilter sed $patterns"
  116. fi
  117. bprof pkgenable stop
  118. }
  119. pkgdisable() {
  120. bprof pkgdisable start
  121. local pattern patterns
  122. for pattern; do
  123. patterns="$patterns -e '/ $pattern / s/^./O/'"
  124. done
  125. if [ "$patterns" ]; then
  126. eval "__pkgfilter sed $patterns"
  127. fi
  128. bprof pkgdisable stop
  129. }
  130. pkgremove() {
  131. bprof pkgremove start
  132. local pattern patterns
  133. if [ "$1" ]; then
  134. patterns=" $1 "; shift
  135. for pattern; do
  136. patterns="$patterns| $pattern "
  137. done
  138. __pkgfilter egrep -v "$patterns"
  139. fi
  140. bprof pkgremove stop
  141. }
  142. pkgcheck() {
  143. bprof pkgcheck start
  144. local pattern="$1"; pattern="${pattern//+/\\+}"
  145. egrep -q "^$2.*[ =]($pattern) " $cfgtmpdir/config/packages; local ret=$?
  146. bprof pkgcheck stop
  147. return $ret
  148. }
  149. else
  150. pkgin() { cfghlp pkg_in $cfgtmpdir/config/packages; }
  151. pkgout() { cfghlp pkg_out $cfgtmpdir/config/packages ; }
  152. pkgfilter() {
  153. bprof pkgfilter start
  154. cfghlp pkg_out $cfgtmpdir/packages.tmp
  155. "$@" < $cfgtmpdir/packages.tmp > $cfgtmpdir/config/packages
  156. cfghlp pkg_in $cfgtmpdir/config/packages
  157. bprof pkgfilter stop
  158. }
  159. pkgenable() {
  160. bprof pkgenable start
  161. cfghlp pkgenable "$@"
  162. bprof pkgenable stop
  163. }
  164. pkgdisable() {
  165. bprof pkgdisable start
  166. cfghlp pkgdisable "$@"
  167. bprof pkgdisable stop
  168. }
  169. pkgremove() {
  170. bprof pkgremove start
  171. cfghlp pkgremove "$@"
  172. bprof pkgremove stop
  173. }
  174. pkgcheck() {
  175. bprof pkgcheck start
  176. cfghlp pkgcheck "$1" "$2"; local ret=$?
  177. bprof pkgcheck stop
  178. return $ret
  179. }
  180. fi
  181. # pkgchecklicense -- checks for files with license issues
  182. pkgchecklicense() {
  183. rm -f $cfgtmpdir/license-issue.*
  184. while read a b c repo pkg dummy; do
  185. if grep -E "\[(L|LICENSE)\][ ]*(Commercial|Restricted)" \
  186. package/$repo/$pkg/$pkg.desc &> /dev/null; then
  187. echo $pkg >> $cfgtmpdir/license-issue.ask
  188. fi
  189. done < <(grep "^X" $cfgtmpdir/config/packages)
  190. }
  191. # Convert a pkg selection rule into awk format
  192. #
  193. # Usage:
  194. # 1. call pkgsel_init
  195. # 2. call pkgsel_parse as often as necessary
  196. # 3. call pkgsel_finish
  197. # Result:
  198. # awk script for package selection, see config.in for its usage
  199. #
  200. # Example:
  201. # pkgsel X python
  202. # Result: ( / [^/]*\/python / ) { $1="X"; }
  203. # pkgsel "O perl/*"
  204. # Result: ( / perl\/[^/]* / ) { $1="O"; }
  205. # pkgsel_parse < config/${config}/pkgsel
  206. # Result: creates pkgsel.awk output
  207. # pkgsel include file
  208. # Result: continues processing file specified
  209. pkgsel_parse() {
  210. local action patterlist pattern
  211. local address first others
  212. while read action patternlist ; do
  213. case "$action" in
  214. [xX])
  215. action='$1="X"' ;;
  216. [oO])
  217. action='$1="O"' ;;
  218. -)
  219. action='next' ;;
  220. =)
  221. action='$1=def' ;;
  222. include)
  223. pkgsel_parse < $patternlist
  224. continue ;;
  225. *)
  226. echo '{ exit; }'
  227. continue ;;
  228. esac
  229. address=""
  230. while read xpattern ; do
  231. pattern="${xpattern#\!}"
  232. [ "$pattern" = "$xpattern" ]; neg=$?
  233. [ "${pattern}" = "${pattern//\//}" ] && pattern="*/$pattern"
  234. pattern="$( echo "$pattern" | sed \
  235. -e 's,[^a-zA-Z0-9_/\*+\-\[\]],,g' \
  236. -e 's,[/\.\+],\\\\&,g' \
  237. -e 's,\*,[^/]*,g' )"
  238. if [ $neg -eq 0 ]; then
  239. address="$address${address:+ && }( \$5 ~ \"^${pattern}\$\" )"
  240. else
  241. address="$address${address:+ && }( \$5 !~ \"^${pattern}\$\" )"
  242. fi
  243. done < <( echo "$patternlist" | tr '\t ' '\n\n' )
  244. echo "{ if ( $address ) { $action; } }"
  245. done < <( if [ "$*" ]; then echo "$*"; else cat | egrep -v "^((^#.*$)|())$"; fi)
  246. }
  247. pkgsel_init() {
  248. cat <<EOF
  249. {
  250. def=\$1 ;
  251. repo=\$4 ;
  252. pkg=\$5 ;
  253. \$5 = \$4 "/" \$5 ;
  254. \$4 = "placeholder" ;
  255. }
  256. EOF
  257. }
  258. pkgsel_finish() {
  259. cat <<EOF
  260. {
  261. \$4=repo ;
  262. \$5=pkg ;
  263. print ;
  264. }
  265. EOF
  266. }
  267. comment() {
  268. bprof comment start
  269. if [ $SDECFG_EXPERT -eq 1 -o $expert -eq 0 ] && \
  270. [ $menu_current = $menu_this ] ; then
  271. commentnr=$(( $commentnr + 1 ))
  272. echo "COMMENT_$commentnr '$spacer$1'" >> $cfgtmpdir/config.dialog
  273. if [ "$2" != "" ] ; then
  274. set_help "COMMENT_$commentnr" "$2"
  275. fi
  276. fi
  277. bprof comment stop
  278. }
  279. comment_id() {
  280. bprof comment_id start
  281. if [ $SDECFG_EXPERT -eq 1 -o $expert -eq 0 ] &&
  282. [ $menu_current = $menu_this ] ; then
  283. echo "$2 '$spacer$1'" >> $cfgtmpdir/config.dialog
  284. if [ "$3" != "" ] ; then
  285. set_help "$2" "$3"
  286. fi
  287. fi
  288. bprof comment_id stop
  289. }
  290. const() {
  291. bprof const start
  292. local q="'"
  293. local v="${2//$q/$q\\$q$q}"
  294. eval "$1=\"\$2\""
  295. echo "export $1='$v'" >> $cfgtmpdir/config/config
  296. bprof const stop
  297. }
  298. # Usage: set_data NAME DEFAULT
  299. #
  300. set_data() {
  301. bprof set_data start
  302. local q="'" set_name="SDECFGSET_${1#SDECFG_}"
  303. if eval "[ \"\$$set_name\" ]" ; then
  304. eval "data=\"\$$set_name\""
  305. eval "$1=\"\$data\""
  306. if [ $SDECFG_EXPERT -eq 1 -o $expert -eq 0 ]
  307. then menumode=2 ; else menumode=0 ; fi
  308. elif [ $SDECFG_EXPERT -eq 1 -o $expert -eq 0 ] ; then
  309. eval "data=\"\${$1:-$2}\""
  310. eval "$1=\"\$data\""
  311. menumode=1
  312. else
  313. data="$2" ; eval "$1=\"\$data\""
  314. menumode=0
  315. fi
  316. item="$1"
  317. echo "export $1='${data//$q/$q\\$q$q}'" >> $cfgtmpdir/config/config
  318. bprof set_data stop
  319. }
  320. choice() {
  321. bprof choice start
  322. # desired default value
  323. #
  324. local defval="$2"
  325. # reset to default if current value is not in list
  326. # and default to first element if it's not in list
  327. #
  328. eval $(
  329. eval "value=\$$1" ; name=$1 ; dval=$defval; shift ; shift
  330. while [ "$#" != 0 ] ; do
  331. [ "$dval" = "$1" ] && dval=""
  332. [ "$value" = "$1" ] && name="" ; shift ; shift
  333. done
  334. [ "$dval" ] && echo "unset defval;"
  335. [ "$name" ] && echo "unset $name"
  336. )
  337. set_data "$1" "${defval:-$3}"
  338. if [ "$menumode" -eq 1 -a $menu_current = $menu_this ] ; then
  339. { echo -en "$item\tchoice_action '$1' '$data'" ; shift ; shift
  340. for x ; do echo -n " '$x'" ; done ; echo ; } >> $cfgtmpdir/config.data
  341. fi
  342. if [ "$menumode" -gt 0 -a $menu_current = $menu_this ] ; then
  343. if [ "$menumode" -eq 1 ] ; then xdata="($data)"
  344. else xdata="=$data=" ; fi
  345. while [ "$1" -a "$1" != "$data" ] ; do shift ; shift ; done
  346. printf "'$item' '$spacer%-${tabspace}s ${2//_/ }'\n" \
  347. "$xdata" >> $cfgtmpdir/config.dialog
  348. fi
  349. bprof choice stop
  350. }
  351. choice_action() {
  352. command="./tmp/confdialog.bin --title 'Build Config' \
  353. --backtitle '$configtitle' \
  354. --radiolist 'Arrow keys navigate the menu. Press <Enter> to activate menu items. Highlighted letters are hotkeys.' \
  355. $(( $lines - 4 )) $(( $columns - 5 )) $(( $lines - 12 ))"
  356. default=$2 ; item=$1 ; shift ; shift
  357. while [ "$1" ] ; do
  358. if [ "$1" = "$default" ]
  359. then command="$command '$1' '${2//_/ }' ON"
  360. else command="$command '$1' '${2//_/ }' OFF" ; fi
  361. shift ; shift
  362. done
  363. eval "$command" 2> $cfgtmpdir/config.out
  364. case "$?" in
  365. 0|6)
  366. eval "$item='`cat $cfgtmpdir/config.out`'"
  367. ;;
  368. 1|255) return 0 ;;
  369. 2) echo "No help." ; sleep 1 ;;
  370. *) echo "unknown returncode: $?" ; exit 1 ;;
  371. esac
  372. }
  373. text() {
  374. bprof text start
  375. local q="'"
  376. set_data "$2" "$3"
  377. if [ "$menumode" -eq 1 -a $menu_current = $menu_this ] ; then
  378. echo -e "$2\ttext_action '$1' '$2'" \
  379. "'${data//$q/$q\\$q$q}'" >> $cfgtmpdir/config.data
  380. fi
  381. if [ "$menumode" -gt 0 -a $menu_current = $menu_this ] ; then
  382. xdata="$( printf "%-${tabspace}s" \
  383. "$(echo $data | cut -c1-20)")"
  384. if [ "$menumode" -eq 1 ] ; then xdata="($xdata)"
  385. else xdata="=$xdata=" ; fi
  386. printf "'$2' '$spacer%s $1'\n" \
  387. "${xdata//$q/$q\\$q$q}" >> $cfgtmpdir/config.dialog
  388. if [ "$4" != "" ] ; then
  389. set_help "$2" "$4"
  390. fi
  391. fi
  392. bprof text stop
  393. }
  394. text_action() {
  395. ./tmp/confdialog.bin --title 'Build Config' \
  396. --backtitle "$configtitle" \
  397. --inputbox "$1" 9 $(( $columns - 5 )) "$3" 2> $cfgtmpdir/config.out
  398. [ "$?" -eq 0 -o "$?" -eq 1 ] && eval "$2=\"\$(cat $cfgtmpdir/config.out)\""
  399. }
  400. bool() {
  401. bprof bool start
  402. local x
  403. set_data "$2" "$3"
  404. if [ "$menumode" -eq 1 -a $menu_current = $menu_this ] ; then
  405. echo -e "$2\tbool_action '$1' '$2' '$data'" >> $cfgtmpdir/config.data
  406. fi
  407. if [ "$menumode" -gt 0 -a $menu_current = $menu_this ] ; then
  408. if [ "$menumode" -eq 1 ] ; then
  409. if [ $data -eq 0 ] ; then x='[ ]' ; else x='[*]' ; fi
  410. else
  411. if [ $data -eq 0 ] ; then x='= =' ; else x='=*=' ; fi
  412. fi
  413. printf "$2 '$spacer%-${tabspace}s ${1//_/ }'\n" \
  414. "$x" >> $cfgtmpdir/config.dialog
  415. if [ "$4" != "" ] ; then
  416. set_help "$2" "$4"
  417. fi
  418. fi
  419. bprof bool stop
  420. }
  421. bool_action() {
  422. if [ $3 -eq 0 ] ; then eval "$2=1"
  423. else eval "$2=0" ; fi
  424. }
  425. editfile() {
  426. bprof editfile start
  427. if [ $SDECFG_EXPERT -eq 1 -o $expert -eq 0 ] ; then
  428. local x="$spacer" q="'"
  429. comment ",----< $3 >----."
  430. block_begin 0 ; spacer="${spacer%??}| "
  431. touch "$2"
  432. line_nr=1
  433. while read line ; do
  434. line="${line//$q/$q\\$q$q}"
  435. if [ $menu_current = $menu_this ] ; then
  436. printf "$1:${editfilenr} '$spacer%-${tabspace}s %s'\n" \
  437. `printf "%03d:" $line_nr` "$line" >> $cfgtmpdir/config.dialog
  438. echo -e "$1:${editfilenr}\teditfile_action $2" \
  439. "$line_nr '$3'" >> $cfgtmpdir/config.data
  440. fi
  441. editfilenr=$(( $editfilenr + 1 ))
  442. line_nr=$(( $line_nr + 1 ))
  443. done < "$2"
  444. if [ $menu_current = $menu_this ] ; then
  445. printf "$1:${editfilenr} '$spacer%-${tabspace}s %s'\n" \
  446. `printf "%03d:" $line_nr` "<add new rule>" >> $cfgtmpdir/config.dialog
  447. echo -e "$1:${editfilenr}\teditfile_action $2" \
  448. "$line_nr '$3'" >> $cfgtmpdir/config.data
  449. fi
  450. editfilenr=$(( $editfilenr + 1 ))
  451. block_end
  452. comment "\`------${3//?/-}------'\''"
  453. spacer="$x"
  454. else
  455. rm -f "$2"
  456. fi
  457. bprof editfile stop
  458. }
  459. editfile_action() {
  460. line="`tail -n +$2 $1 | head -n 1`"
  461. ./tmp/confdialog.bin --title 'Build Config' \
  462. --backtitle "$configtitle" \
  463. --inputbox "$3 - Line $3" \
  464. 9 $(( $columns - 5 )) "$line" 2> $cfgtmpdir/config.out
  465. head -n $(( $2 - 1 )) $1 > $1.new
  466. [ -s $cfgtmpdir/config.out ] && echo "`cat $cfgtmpdir/config.out`" >> $1.new
  467. tail -n +$(( $2 + 1 )) $1 >> $1.new
  468. mv $1.new $1
  469. }
  470. startprog() {
  471. bprof startprog start
  472. if [ $SDECFG_EXPERT -eq 1 -o $expert -eq 0 ] &&
  473. [ $menu_current = $menu_this ] ; then
  474. printf "$1 '$spacer%-${tabspace}s %s'\n" \
  475. "-->" "$2" >> $cfgtmpdir/config.dialog
  476. echo -e "$1\t$3" >> $cfgtmpdir/config.data
  477. fi
  478. bprof startprog stop
  479. }
  480. block_begin() {
  481. bprof block_begin start
  482. if [ $menu_current = $menu_this ] ; then
  483. [ "$tabspace_list" ] && spacer="$spacer "
  484. tabspace_list="$tabspace $tabspace_list"
  485. tabspace="$(( $tabspace + $1 - 2 ))"
  486. fi
  487. bprof block_begin stop
  488. }
  489. block_end() {
  490. bprof block_end start
  491. if [ $menu_current = $menu_this ] ; then
  492. spacer="${spacer%??}"
  493. tabspace="${tabspace_list%% *}"
  494. tabspace_list="${tabspace_list#* }"
  495. fi
  496. bprof block_end stop
  497. }
  498. expert_begin() {
  499. expert=$(( $exprt + 1 ))
  500. }
  501. expert_end() {
  502. expert=$(( $exprt - 1 ))
  503. }
  504. menu_begin() {
  505. bprof menu_begin start
  506. menu_counter=$(( $menu_counter + 1 ))
  507. if [ $SDECFG_EXPERT -eq 1 -o $expert -eq 0 ] &&
  508. [ $menu_current = $menu_this ] ; then
  509. printf "$1 '$spacer%-${tabspace}s %s'\n" \
  510. "===>" "$2" >> $cfgtmpdir/config.dialog
  511. echo -e "$1\tmenu_current=$menu_counter" >> $cfgtmpdir/config.data
  512. fi
  513. if [ $SDECFG_EXPERT -eq 1 -o $expert -eq 0 ] &&
  514. [ $menu_current = $menu_counter ] ; then
  515. echo "$1 '===> $2'" >> $cfgtmpdir/config.dialog
  516. echo -e "$1\tmenu_current=$menu_this" >> $cfgtmpdir/config.data
  517. fi
  518. if [ $menu_current = $menu_counter ] ; then
  519. menu_back=$menu_this
  520. menu_backpos=$1
  521. fi
  522. menu_stack="$menu_this $menu_stack"
  523. menu_this=$menu_counter
  524. block_begin 3
  525. bprof menu_begin stop
  526. }
  527. menu_end() {
  528. bprof menu_end start
  529. block_end
  530. menu_this="${menu_stack%% *}"
  531. menu_stack="${menu_stack#* }"
  532. bprof menu_end stop
  533. }
  534. set_help() {
  535. bprof set_help start
  536. (echo -ne "$1 '$1:\n\n$2'" | sed 's,$,\\n,' |
  537. tr -d '\n' | sed 's,\\n$,,'; echo ) >> $cfgtmpdir/config.help
  538. bprof set_help stop
  539. }
  540. get_help() {
  541. bprof get_help start
  542. # Create standard help output ...
  543. default_text="
  544. There is no help on '$1' available.
  545. This is the T2 $sdever Configuration Tool.
  546. Please read the Quick Start and the Handbook on
  547. http://www.t2-project.org/buildintro.html and
  548. http://www.t2-project.org/t2-handbook/ respectively
  549. before building T2.
  550. More information can be found on the T2 Homepage:
  551. http://www.t2-project.org/
  552. Subscribe to the mailing list by sending an e-mail with the
  553. subject 'subscribe t2' to <lists@t2-project.org>."
  554. # Ok let us find a help for the current item ...
  555. # First of all mask all special chars in the item name
  556. # Comment: this is sick. You can't get any \n this way !!!
  557. item_name=$( echo "$1" | sed 's/[][\/.^$*]/\\&/g' )
  558. # Now search *.hlp files
  559. hlp_text=$( sed -n "/^$item_name[ ]*\$/,\${
  560. /^$item_name[ ]*\$/c\\
  561. $item_name:\\
  562. /^#/d
  563. /^[^ ]/q
  564. s/^ //
  565. p
  566. }" lib/*/config*.hlp package/*/*/subconfig-*.hlp package/*/*/config*.hlp target/*/config*.hlp 2>/dev/null )
  567. # Get help strings out of the temporary file.
  568. tmp_text=$(grep "^$item_name" $cfgtmpdir/config.help | cut -f2- -d' ' | sed -e "s,^',," -e "s,'$,," )
  569. # Let us see what we have ...
  570. if [ "$hlp_text" -a "$tmp_text" ] ; then
  571. echo "
  572. There are two help text's... one in one of the config.in files and one
  573. in one of the config.hlp files. Please remove one of them to get rid of
  574. this message here.
  575. Here the one out of config.in:
  576. $tmp_text
  577. Here the one out of config.hlp:
  578. $hlp_text"
  579. elif [ "$hlp_text" ] ; then
  580. echo "$hlp_text"
  581. elif [ "$tmp_text" ] ; then
  582. echo "$tmp_text"
  583. else
  584. echo "$default_text"
  585. fi
  586. bprof get_help stop
  587. }