modconfig 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738
  1. #! /bin/sh
  2. #
  3. # modconfig
  4. #
  5. # Copyright (C) 2000, 2001, 2002 Eggheads Development Team
  6. # Written by Fabian Knittel
  7. #
  8. # This program is free software; you can redistribute it and/or
  9. # modify it under the terms of the GNU General Public License
  10. # as published by the Free Software Foundation; either version 2
  11. # of the License, or (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program; if not, write to the Free Software
  20. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. mc_pn=`echo $0 | sed -e 's/^.*\///'`
  22. mc_top_srcdir=
  23. mc_srcdir=
  24. mc_bindir=.
  25. mc_flag_quiet=no
  26. mc_flag_onlynew=no
  27. # Read options
  28. while true; do
  29. case ${1} in
  30. --top_srcdir=*)
  31. mc_top_srcdir=`echo ${1} | sed -e 's/^--top_srcdir=//'`
  32. ;;
  33. --top_srcdir)
  34. shift
  35. mc_top_srcdir=${1}
  36. ;;
  37. --srcdir=*)
  38. mc_srcdir=`echo ${1} | sed -e 's/^--srcdir=//'`
  39. ;;
  40. --srcdir)
  41. shift
  42. mc_srcdir=${1}
  43. ;;
  44. --bindir=*)
  45. mc_bindir=`echo ${1} | sed -e 's/^--bindir=//'`
  46. ;;
  47. --bindir)
  48. shift
  49. mc_bindir=${1}
  50. ;;
  51. --quiet|-q)
  52. mc_flag_quiet=yes
  53. ;;
  54. --only-new|-n)
  55. mc_flag_onlynew=yes
  56. ;;
  57. --*)
  58. echo "${mc_pn}: warning: unknown option \`${1}'." 2>&1
  59. ;;
  60. *)
  61. # Non-option parameter.
  62. break
  63. ;;
  64. esac
  65. # Break out of loop if there are no more arguments to process.
  66. if shift; then
  67. :
  68. else
  69. break;
  70. fi
  71. done
  72. # Find srcdir and top_srcdir
  73. if test "x${mc_srcdir}" = x; then
  74. if test "x${mc_top_srcdir}" != x; then
  75. mc_srcdir=${mc_top_srcdir}/src
  76. else
  77. echo "${mc_pn}: error: could not find src directory." 2>&1
  78. exit 1
  79. fi
  80. fi
  81. if test "x${mc_top_srcdir}" = x; then
  82. if test "x${mc_srcdir}" != x; then
  83. mc_top_srcdir=${mc_srcdir}/..
  84. else
  85. echo "${mc_pn}: error: could not find top src directory." 2>&1
  86. exit 1
  87. fi
  88. fi
  89. #
  90. # Files
  91. #
  92. # List of all selected modules (including the `.mod' at the end)
  93. mc_fmodules=${mc_bindir}/.modules
  94. # List of all modules we have detected so far.
  95. mc_fknownmods=${mc_bindir}/.known_modules
  96. mc_mod_dir=${mc_srcdir}/mod
  97. mc_mod_bin_dir=${mc_bindir}/src/mod
  98. mc_fMakefile=${mc_mod_bin_dir}/Makefile
  99. mc_fstatic_h=${mc_mod_dir}/static.h
  100. # File descriptor usage:
  101. # 1 Standard output
  102. # 2 Errors
  103. #
  104. # 6 Misc messages and warnings
  105. # 7 Goes to /dev/null
  106. exec 7>/dev/null
  107. if test "${mc_flag_quiet}" = yes; then
  108. exec 6>&7
  109. else
  110. exec 6>&1
  111. fi
  112. # Detect flags needed to achieve 'echo -n' (originally from GNU autoconf) ...
  113. if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
  114. # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
  115. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null
  116. then
  117. mc_n= mc_c='
  118. ' mc_t=' '
  119. else
  120. mc_n=-n mc_c= mc_t=
  121. fi
  122. else
  123. mc_n= mc_c='\c' mc_t=
  124. fi
  125. # This helps us call ourself.
  126. mc_self_call="$0 --srcdir=${mc_srcdir} --top_srcdir=${mc_topsrcdir}"
  127. # Assign parameters
  128. mc_cmd=$1
  129. if test "x${mc_cmd}" != x; then
  130. shift
  131. mc_paras=$*
  132. fi
  133. case x${mc_cmd} in
  134. xhelp)
  135. #
  136. # Display help
  137. #
  138. cat 1>&6 <<EOF
  139. Usage: ${mc_pn} [OPTIONS] COMMAND
  140. Commands:
  141. add Add a module to the list of active eggdrop modules.
  142. del Remove a module from that list.
  143. clear Clear the list.
  144. static.h Create \`src/mod/static.h'.
  145. Makefile Create \`src/mod/Makefile'.
  146. configure Interactively select modules.
  147. is-configured Exits 0/1 depending on wether modules where
  148. configured or not.
  149. update-depends Check all module dependencies and add modules missing.
  150. help Displays this information.
  151. detect-modules Find all available modules.
  152. modules-still-exist Check wether all known modules still exist.
  153. eggautoconf Recreate the configure scripts in every module dir.
  154. Options:
  155. --top_srcdir=DIR Top directory (At least one of these two
  156. --srcdir=DIR Source directory directories MUST be supplied.)
  157. --bindir=DIR Binary directory
  158. --quiet [-q] Quiet mode. Only show errors.
  159. Options specific to the \`configure' command:
  160. --only-new [-n] Only query new modules.
  161. EOF
  162. ;;
  163. xis-configured)
  164. #
  165. # Determine wether the modules were configured yet.
  166. #
  167. if test -r "${mc_fmodules}"; then
  168. exit 0
  169. else
  170. exit 1
  171. fi
  172. ;;
  173. xmodules-still-exist)
  174. #
  175. # Check wether all known modules still exist.
  176. #
  177. if ${mc_self_call} -q is-configured; then
  178. mc_known_mods=`cat ${mc_fknownmods}`
  179. echo ${mc_n} "checking for removed modules...${mc_c}" 1>&6
  180. # Check wether all known mods still exist
  181. for mc_mod in ${mc_known_mods}; do
  182. echo ${mc_n} ".${mc_c}" >&6
  183. if test ! -d ${mc_mod_dir}/${mc_mod}; then
  184. grep -v "^${mc_mod}$" ${mc_fknownmods} > ${mc_fknownmods}_new
  185. mv ${mc_fknownmods}_new ${mc_fknownmods}
  186. fi
  187. done
  188. echo " done." 1>&6
  189. fi
  190. ;;
  191. xdetect-modules)
  192. #
  193. # Detect modules. Active modules will be added to the `.modules' file. The
  194. # behaviour changes as soon as `.modules' already exists.
  195. #
  196. echo ${mc_n} "detecting modules...${mc_c}" >&6
  197. if ${mc_self_call} -q is-configured; then
  198. mc_mods_configured=yes
  199. mv ${mc_fmodules} ${mc_fmodules}_old
  200. mc_fmodules_old=${mc_fmodules}
  201. mc_fmodules=${mc_fmodules}_old
  202. else
  203. mc_mods_configured=no
  204. mc_fmodules_old=
  205. fi
  206. mc_mods=`echo ${mc_srcdir}/mod/*.mod | sed -e 's/\.mod//g'`
  207. if test "${mc_mods}" = "${mc_srcdir}/mod/*"; then
  208. echo "${mc_pn}: error: no modules detected." >&2
  209. exit 1
  210. fi
  211. # Add them again.
  212. mc_mods=`echo ${mc_mods} | sed -e 's/\.mod//g'`
  213. for mc_mod in ${mc_mods}; do
  214. mc_mod=`echo ${mc_mod} | sed -e 's/.*\///g'`
  215. mc_new_mod_state=disabled
  216. echo ${mc_n} ".${mc_c}" >&6
  217. # Do we have an existing configuration?
  218. if (test "${mc_mods_configured}" = yes); then
  219. # Is the module active?
  220. if (grep "^${mc_mod}\.mod\$" ${mc_fmodules} 1>&7 2>&1)
  221. then
  222. mc_new_mod_state=enabled
  223. else
  224. # Was it configured before?
  225. if (grep "^${mc_mod}\.mod\$" ${mc_fknownmods} 1>&7 2>&1); then
  226. :
  227. else
  228. mc_new_mod_state=enabled
  229. fi
  230. fi
  231. else
  232. mc_new_mod_state=enabled
  233. fi
  234. if test "${mc_new_mod_state}" = enabled; then
  235. ${mc_self_call} -q add ${mc_mod}
  236. else
  237. ${mc_self_call} -q del ${mc_mod}
  238. fi
  239. done
  240. if test "x${mc_fmodules_old}" != x; then
  241. # mc_fmodules actually points to the .modules_old file.
  242. rm -f ${mc_fmodules}
  243. touch ${mc_fmodules_old}
  244. fi
  245. echo " done." >&6
  246. ;;
  247. xMakefile)
  248. #
  249. # Build `src/mod/Makefile'
  250. #
  251. echo ${mc_n} "building ${mc_fMakefile}... ${mc_c}" 1>&6
  252. # Check for selected modules
  253. if test -r ${mc_fmodules}; then
  254. # Convert newlines to spaces.
  255. mc_sel_modules=`cat ${mc_fmodules} | \
  256. awk '{ printf("%s ", $0); }'`
  257. else
  258. echo "${mc_pn}: error: no modules selected. You did not run \`make config' yet." 1>&2;
  259. exit 1
  260. fi
  261. mc_mod_objs=`echo ${mc_sel_modules} | sed -e 's/\.mod/.mod_o/g'`
  262. mc_mod_libs=`echo ${mc_sel_modules} | sed -e 's/\.mod/.mod_so/g'`
  263. if test ! -f ${mc_fMakefile}; then
  264. echo "failed." 1>&6
  265. echo "${mc_pn}: error: make file template not found." 1>&2
  266. exit 1
  267. fi
  268. # The following sed expression modifies src/mod/Makefile to
  269. # hold the new module names.
  270. if (cat "${mc_fMakefile}" | \
  271. sed -e "s/^\(mods =\).*$/\1 ${mc_sel_modules}/g" \
  272. -e "s/^\(mod_objs =\).*$/\1 ${mc_mod_objs}/g" \
  273. -e "s/^\(mod_libs =\).*$/\1 ${mc_mod_libs}/g" \
  274. 1> "${mc_fMakefile}_new"); then
  275. mv "${mc_fMakefile}_new" "${mc_fMakefile}"
  276. else
  277. echo "failed." 1>&6
  278. echo "${mc_pn}: sed failed to build ${mc_fMakefile}." 1>&2
  279. exit 1
  280. fi
  281. echo "done." 1>&6
  282. ;;
  283. xstatic.h)
  284. #
  285. # Build `static.h'
  286. #
  287. echo ${mc_n} "building static.h..." 1>&6
  288. # Check for selected modules
  289. if test ! -r ${mc_fmodules}; then
  290. echo " failed." 1>&6
  291. echo "${mc_pn}: error: no modules selected. You did not run \`make config' yet." 1>&2;
  292. exit 1
  293. fi
  294. mc_sel_modules=`cat ${mc_fmodules} | sed -e 's/\.mod//g'`
  295. # Note: All data is written to `src/mod/static.h' which is
  296. # later included into `src/main.c'.
  297. # Remove old static.h
  298. rm -f ${mc_fstatic_h}
  299. # Header
  300. cat 1>> ${mc_fstatic_h} << EOF
  301. /* src/mod/static.h -- header file for static compiles.
  302. *
  303. * NOTE: Do not edit directly. Instead, re-run \`make config'.
  304. */
  305. #ifndef _EGG_MOD_STATIC_H
  306. #define _EGG_MOD_STATIC_H
  307. EOF
  308. # Create declarations for module _start functions
  309. for mc_mod in ${mc_sel_modules}; do
  310. echo ${mc_n} ".${mc_c}" 1>&6
  311. if test ${mc_mod} = "server" || test ${mc_mod} = "irc";then echo "#ifdef LEAF" 1>> ${mc_fstatic_h};fi
  312. echo "char *${mc_mod}_start();" 1>> ${mc_fstatic_h}
  313. if test ${mc_mod} = "server" || test ${mc_mod} = "irc";then echo "#endif" 1>> ${mc_fstatic_h};fi
  314. done
  315. echo 1>> ${mc_fstatic_h}
  316. # The link_statics() function ...
  317. echo "static void link_statics()" 1>> ${mc_fstatic_h}
  318. echo "{" 1>> ${mc_fstatic_h}
  319. for mc_mod in ${mc_sel_modules}; do
  320. if test ${mc_mod} = "server" || test ${mc_mod} = "irc";then echo "#ifdef LEAF" 1>> ${mc_fstatic_h};fi
  321. echo " check_static(\"${mc_mod}\", ${mc_mod}_start);" 1>> ${mc_fstatic_h}
  322. if test ${mc_mod} = "server" || test ${mc_mod} = "irc";then echo "#endif" 1>> ${mc_fstatic_h};fi
  323. done
  324. cat 1>> ${mc_fstatic_h} << EOF
  325. }
  326. #endif /* _EGG_MOD_STATIC_H */
  327. EOF
  328. echo " done." 1>&6
  329. ;;
  330. xdel)
  331. #
  332. # Remove a module from the list
  333. #
  334. if test "x${mc_paras}" = x; then
  335. echo "${mc_pn}: error: no modules specified." 2>&1
  336. exit 1
  337. fi
  338. mc_nfmodules="${mc_fmodules}_new"
  339. # Remove trailing `.mod'
  340. mc_mods=`echo ${mc_paras} | sed -e 's/\.mod//g'`
  341. for mc_mod in ${mc_mods}; do
  342. # Remove any path information
  343. mc_mod=`echo ${mc_mod} | sed -e 's/.*\///'`
  344. echo "${mc_pn}: disabling eggdrop module: ${mc_mod}" 1>&6
  345. # Add module to the list of known modules.
  346. if grep "^${mc_mod}\.mod$" ${mc_fknownmods} 1>&7 2>&7; then
  347. if test ! -d ${mc_mod_dir}/${mc_mod}.mod; then
  348. grep -v "^${mc_mod}\.mod$" ${mc_fknownmods} \
  349. > ${mc_fknownmods}_new
  350. mv ${mc_fknownmods}_new ${mc_fknownmods}
  351. fi
  352. else
  353. if test ! -d ${mc_mod_dir}/${mc_mod}.mod; then
  354. :
  355. else
  356. echo ${mc_mod}.mod 1>> ${mc_fknownmods}
  357. fi
  358. fi
  359. # In case there are any active modules ...
  360. if test -r ${mc_fmodules}; then
  361. # Remove module from list of active modules.
  362. if grep -v "^${mc_mod}\.mod$" ${mc_fmodules} \
  363. 1> ${mc_nfmodules}
  364. then
  365. :
  366. else
  367. echo "${mc_pn}: error: building new module file failed" 1>&2
  368. echo "grepping for ${mc_mod}.mod in ${mc_fmodules} and writing to ${mc_nfmodules}"
  369. kill -STOP $$
  370. exit 1
  371. fi
  372. mv ${mc_nfmodules} ${mc_fmodules}
  373. fi
  374. done
  375. ;;
  376. xadd)
  377. #
  378. # Add a module to the list
  379. #
  380. if test "x${mc_paras}" = x; then
  381. echo "${mc_pn}: error: no modules specified." 2>&1
  382. exit 1
  383. fi
  384. # Remove trailing `.mod'
  385. mc_mods=`echo ${mc_paras} | sed -e 's/\.mod//g'`
  386. for mc_mod in ${mc_mods}; do
  387. # Remove any path information
  388. mc_mod=`echo ${mc_mod} | sed -e 's/.*\///'`
  389. # Add module to the list of known modules.
  390. if grep "^${mc_mod}\.mod$" ${mc_fknownmods} 1>&7 2>&7; then
  391. if test ! -d ${mc_mod_dir}/${mc_mod}.mod; then
  392. grep -v "^${mc_mod}\.mod$" ${mc_fknownmods} \
  393. > ${mc_fknownmods}_new
  394. mv ${mc_fknownmods}_new ${mc_fknownmods}
  395. fi
  396. else
  397. if test ! -d ${mc_mod_dir}/${mc_mod}.mod; then
  398. :
  399. else
  400. echo ${mc_mod}.mod 1>> ${mc_fknownmods}
  401. fi
  402. fi
  403. # Add module to the list of active modules.
  404. if grep "^${mc_mod}\.mod$" ${mc_fmodules} 1>&7 2>&7; then
  405. :
  406. else
  407. if test ! -d ${mc_mod_dir}/${mc_mod}.mod; then
  408. echo "${mc_pn}: warning: module does not exist: \`${mc_mod}', ignoring." 1>&2
  409. else
  410. echo "${mc_pn}: enabling eggdrop module: ${mc_mod}" 1>&6
  411. # Add it to the file
  412. echo ${mc_mod}.mod 1>> ${mc_fmodules}
  413. fi
  414. fi
  415. done
  416. ;;
  417. xclear)
  418. #
  419. # Clear list of modules
  420. #
  421. echo "${mc_pn}: cleared list of eggdrop modules." 1>&6
  422. rm -f ${mc_fmodules}
  423. touch ${mc_fmodules}
  424. ;;
  425. xupdate-depends)
  426. #
  427. # Check the dependencies and add modules which are depended on, but
  428. # aren't enabled.
  429. #
  430. mc_all_depends=
  431. mc_missing=
  432. echo ${mc_n} "calculating dependencies...${mc_c}" 1>&6
  433. # Check for selected modules
  434. if test ! -r ${mc_fmodules}; then
  435. echo " failed." 1>&6
  436. echo "${mc_pn}: error: no modules selected. You did not run configure yet." 1>&2
  437. exit 1
  438. fi
  439. mc_sel_modules=`cat ${mc_fmodules}`
  440. mc_new_mods="${mc_sel_modules}"
  441. while (test "x${mc_new_mods}" != x); do
  442. mc_mod_list="${mc_new_mods}"
  443. mc_new_mods=
  444. # Go through every module in the list
  445. for mc_mod in ${mc_mod_list}; do
  446. echo ${mc_n} ".${mc_c}" 1>&6
  447. # We have an info file, don't we?
  448. if (test ! -f ${mc_mod_dir}/${mc_mod}/modinfo); then
  449. continue
  450. fi
  451. # Figure out the module's dependencies
  452. mc_mod_depends=`grep "^DEPENDS:" ${mc_mod_dir}/${mc_mod}/modinfo | sed -e 's/^DEPENDS://'`
  453. # Check wether the dependencies are fulfilled
  454. for mc_m_depend in ${mc_mod_depends}; do
  455. if (echo ${mc_sel_modules} | \
  456. grep " ${mc_m_depend}" 1>&7 2>&7) || \
  457. (echo ${mc_sel_modules} | \
  458. grep "^${mc_m_depend}" 1>&7 2>&7)
  459. then
  460. :
  461. else
  462. # Does the module actually exist?
  463. if test ! -d ${mc_mod_dir}/${mc_m_depend}.mod
  464. then
  465. mc_missing="${mc_missing} ${mc_m_depend}"
  466. continue
  467. fi
  468. # This one is missing. Add it to the
  469. # list.
  470. mc_all_depends="${mc_all_depends} ${mc_m_depend}"
  471. mc_sel_modules="${mc_sel_modules} ${mc_m_depend}"
  472. # Add to list of modules to check in
  473. # next dependency cycle.
  474. mc_new_mods="${mc_new_mods} ${mc_m_depend}.mod"
  475. fi
  476. done
  477. done
  478. done
  479. echo " done." 1>&6
  480. # Warn about missing modules.
  481. if test "x${mc_missing}" != x; then
  482. cat 1>&2 <<EOF
  483. ${mc_pn}: warning:
  484. The following modules were not found but are needed:
  485. `echo ${mc_missing} | sed -e 's/ /, /g'`
  486. EOF
  487. echo ${mc_n} "Press enter to continue... ${mc_c}"
  488. read mc_ask_response
  489. fi
  490. if test "x${mc_all_depends}" != x; then
  491. echo ${mc_n} "adding modules needed to match dependencies... ${mc_c}" 1>&6
  492. echo ${mc_all_depends} | sed -e 's/ /, /g' 1>&6
  493. # Add the modules
  494. ${mc_self_call} -q add ${mc_all_depends}
  495. # Update the makefile
  496. ${mc_self_call} -q Makefile
  497. fi
  498. ;;
  499. xconfigure)
  500. #
  501. # Interactive module selection
  502. #
  503. cat 1>&6 <<EOF
  504. -*- Eggdrop Interactive Module Selection -*-
  505. EOF
  506. # Check for selected modules
  507. if test ! -r ${mc_fmodules}; then
  508. echo "${mc_pn}: error: no modules selected. You did not run configure yet." 1>&2
  509. exit 1
  510. fi
  511. # Read current list
  512. mc_sel_modules=`cat ${mc_fmodules}`
  513. # Detect available modules
  514. mc_mods=`echo ${mc_mod_dir}/*.mod`
  515. # Error out if we have no available modules
  516. if test "${mc_mods}" = "echo ${mc_mod_dir}/*.mod"; then
  517. echo "${mc_pn}: error: no modules found." 1>&2
  518. exit 1
  519. fi
  520. # Loop through each available module
  521. for mc_mod in ${mc_mods}; do
  522. # Remove directory information from name
  523. mc_mod=`echo ${mc_mod} | sed -e 's/.*\///'`
  524. # Only ask for new modules?
  525. if test "${mc_flag_onlynew}" = yes; then
  526. # Did we already query for that module?
  527. if grep "^${mc_mod}$" ${mc_fknownmods} 1>&7 2>&7; then
  528. continue
  529. fi
  530. fi
  531. # Remove .mod ending
  532. mc_modname=`echo ${mc_mod} | sed -e 's/\.mod//g'`
  533. # Note: We need to make sure that we only catch module names
  534. # that match _exactly_. e.g. don't mix bseen and seen.
  535. if (echo ${mc_sel_modules} | grep " ${mc_mod}" 1>&7 2>&7) ||
  536. (echo ${mc_sel_modules} | grep "^${mc_mod}" 1>&7 2>&7)
  537. then
  538. # The module is selected.
  539. mc_mstate="enabled"
  540. mc_mdisp="(E)nable / (d)isable [E/d]"
  541. else
  542. # The module is NOT selected.
  543. mc_mstate="disabled"
  544. mc_mdisp="(e)nable / (D)isable [e/D]"
  545. fi
  546. # Display description
  547. if test -r ${mc_mod_dir}/${mc_mod}/modinfo; then
  548. echo "" 1>&6
  549. grep "^DESC:" ${mc_mod_dir}/${mc_mod}/modinfo | \
  550. sed -e 's/^DESC:/ /' 1>&6
  551. echo "" 1>&6
  552. fi
  553. while true; do
  554. echo ${mc_n} "\`${mc_modname}' is ${mc_mstate}, ${mc_mdisp} ${mc_c}" 1>&6
  555. read mc_ask_response;
  556. if (test "${mc_ask_response}" = D); then
  557. mc_ask_response=d;
  558. fi
  559. if (test "${mc_ask_response}" = E); then
  560. mc_ask_response=e;
  561. fi
  562. # If the user just presses [return] or
  563. # if the selected state matches the old state,
  564. # then we change nothing.
  565. if test "x${mc_ask_response}" = x || \
  566. (test "${mc_ask_response}" = d && \
  567. test "${mc_mstate}" = disabled) || \
  568. (test "${mc_ask_response}" = e && \
  569. test "${mc_mstate}" = enabled); then
  570. echo "Changing nothing." 1>&6
  571. break;
  572. fi
  573. if (test "${mc_ask_response}" = e); then
  574. # Add it to the list.
  575. mc_sel_modules="${mc_sel_modules} ${mc_mod}"
  576. echo "Enabled module ${mc_modname}." 1>&6
  577. break;
  578. fi
  579. if (test "${mc_ask_response}" = d); then
  580. # Remove module from list.
  581. mc_sel_modules=`echo ${mc_sel_modules} | sed -e "s/ ${mc_mod}//g" -e "s/^${mc_mod}//g"`
  582. echo "Disabled module ${mc_modname}." 1>&6
  583. break;
  584. fi
  585. done
  586. echo "" 1>&6
  587. done
  588. echo ${mc_n} "recreating list of active modules... ${mc_c}" 1>&6
  589. ${mc_self_call} -q clear
  590. if (${mc_self_call} -q add ${mc_sel_modules}); then
  591. echo "done." 1>&6
  592. else
  593. echo "failed!" 1>&6
  594. exit 1
  595. fi
  596. ;;
  597. xeggautoconf)
  598. #
  599. # Recreate the eggdrop specific configure scripts for every module.
  600. #
  601. # Detect available modules
  602. mc_mods=`echo ${mc_mod_dir}/*.mod`
  603. # Error out if we have no available modules
  604. if test "${mc_mods}" = "echo ${mc_mod_dir}/*.mod"; then
  605. echo "${mc_pn}: error: no modules found." 1>&2
  606. exit 1
  607. fi
  608. # Loop through each available module
  609. for mc_modd in ${mc_mods}; do
  610. # Skip modules without their own configure script.
  611. if test ! -r "${mc_modd}/configure.in"; then
  612. continue
  613. fi
  614. # Remove directory information from name
  615. mc_mod=`echo ${mc_modd} | sed -e 's/.*\///'`
  616. echo "creating configure for module \`${mc_mod}'."
  617. (cd ${mc_modd} && ../eggautoconf)
  618. done
  619. ;;
  620. *)
  621. if test "x${mc_cmd}" = x; then
  622. echo "${mc_pn}: error: no command supplied." 1>&2
  623. else
  624. echo "${mc_pn}: error: ${mc_cmd}: unknown command." 1>&2
  625. fi
  626. ${mc_self_call} help
  627. ;;
  628. esac
  629. exit 0