~ubuntu-branches/ubuntu/oneiric/eggdrop/oneiric

« back to all changes in this revision

Viewing changes to misc/modconfig

  • Committer: Bazaar Package Importer
  • Author(s): Guilherme de S. Pastore
  • Date: 2004-06-17 09:15:28 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040617091528-64rrw1sa33lkfhmh
Tags: 1.6.16-2
* Fixed typo on README.Debian
* Fixed hyphens in manual page
* Converted debian/rules to CDBS
* Set path to binary on example config file
* Changed LANGDIR on src/eggdrop.h (Closes: #254824)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
#
3
3
# modconfig
4
4
#
5
 
# Copyright (C) 2000, 2001, 2002 Eggheads Development Team
 
5
# Copyright (C) 2000, 2001, 2002, 2003, 2004 Eggheads Development Team
6
6
# Written by Fabian Knittel
7
7
#
8
8
# This program is free software; you can redistribute it and/or
18
18
# You should have received a copy of the GNU General Public License
19
19
# along with this program; if not, write to the Free Software
20
20
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21
 
 
22
 
# $Id: modconfig,v 1.8 2002/01/02 03:46:35 guppy Exp $
 
21
#
 
22
# $Id: modconfig,v 1.14 2004/01/09 05:56:36 wcc Exp $
23
23
 
24
24
 
25
25
mc_pn=`echo $0 | sed -e 's/^.*\///'`
209
209
        if ${mc_self_call} -q is-configured; then
210
210
                mc_known_mods=`cat ${mc_fknownmods}`
211
211
 
212
 
                echo ${mc_n} "checking for removed modules...${mc_c}" 1>&6
 
212
                echo ${mc_n} "Checking for removed modules...${mc_c}" 1>&6
213
213
                #  Check wether all known mods still exist
214
214
                for mc_mod in ${mc_known_mods}; do
215
215
                        echo ${mc_n} ".${mc_c}" >&6
227
227
#  behaviour changes as soon as `.modules' already exists.
228
228
#
229
229
 
230
 
        echo ${mc_n} "detecting modules...${mc_c}" >&6
 
230
        echo ${mc_n} "Detecting modules...${mc_c}" >&6
231
231
 
232
232
        if ${mc_self_call} -q is-configured; then
233
233
                mc_mods_configured=yes
258
258
                #  Do we have an existing configuration?
259
259
                if (test "${mc_mods_configured}" = yes); then
260
260
                        #  Is the module active?
261
 
                        if (grep "^${mc_mod}.mod\$" ${mc_fmodules} 1>&7 2>&1)
 
261
                        if (grep "^${mc_mod}\.mod\$" ${mc_fmodules} 1>&7 2>&1)
262
262
                        then
263
263
                                mc_new_mod_state=enabled
264
264
                        else
265
265
                                #  Was it configured before?
266
 
                                if (grep "^${mc_mod}.mod\$" ${mc_fknownmods} 1>&7 2>&1); then
 
266
                                if (grep "^${mc_mod}\.mod\$" ${mc_fknownmods} 1>&7 2>&1); then
267
267
                                        :
268
268
                                else
269
269
                                        mc_new_mod_state=enabled
297
297
#  Build `src/mod/Makefile'
298
298
#
299
299
 
300
 
        echo ${mc_n} "building ${mc_fMakefile}... ${mc_c}" 1>&6
 
300
        echo ${mc_n} "Building ${mc_fMakefile}... ${mc_c}" 1>&6
301
301
 
302
302
        #  Check for selected modules
303
303
        if test -r ${mc_fmodules}; then
309
309
                exit 1
310
310
        fi
311
311
 
312
 
        mc_mod_objs=`echo ${mc_sel_modules} | sed -e 's/.mod/.mod_o/g'`
313
 
        mc_mod_libs=`echo ${mc_sel_modules} | sed -e 's/.mod/.mod_so/g'`
 
312
        mc_mod_objs=`echo ${mc_sel_modules} | sed -e 's/\.mod/.mod_o/g'`
 
313
        mc_mod_libs=`echo ${mc_sel_modules} | sed -e 's/\.mod/.mod_so/g'`
314
314
 
315
315
        if test ! -f ${mc_fMakefile}; then
316
316
                echo "failed." 1>&6
339
339
#  Build `static.h'
340
340
#
341
341
 
342
 
        echo ${mc_n} "building static.h..." 1>&6
 
342
        echo ${mc_n} "Building static.h..." 1>&6
343
343
 
344
344
        #  Check for selected modules
345
345
        if test ! -r ${mc_fmodules}; then
347
347
                echo "${mc_pn}: error: no modules selected. You did not run \`make config' yet." 1>&2;
348
348
                exit 1
349
349
        fi
350
 
        mc_sel_modules=`cat ${mc_fmodules} | sed -e 's/.mod//g'`
 
350
        mc_sel_modules=`cat ${mc_fmodules} | sed -e 's/\.mod//g'`
351
351
 
352
352
 
353
353
        #  Note:  All data is written to `src/mod/static.h' which is
402
402
        mc_nfmodules="${mc_fmodules}_new"
403
403
 
404
404
        #  Remove trailing `.mod'
405
 
        mc_mods=`echo ${mc_paras} | sed -e 's/.mod//g'`
 
405
        mc_mods=`echo ${mc_paras} | sed -e 's/\.mod//g'`
406
406
        for mc_mod in ${mc_mods}; do
407
407
                #  Remove any path information
408
408
                mc_mod=`echo ${mc_mod} | sed -e 's/.*\///'`
409
409
                echo "${mc_pn}: disabling eggdrop module: ${mc_mod}" 1>&6
410
410
 
411
411
                #  Add module to the list of known modules.
412
 
                if grep "^${mc_mod}.mod$" ${mc_fknownmods} 1>&7 2>&7; then
 
412
                if grep "^${mc_mod}\.mod$" ${mc_fknownmods} 1>&7 2>&7; then
413
413
                        if test ! -d ${mc_mod_dir}/${mc_mod}.mod; then
414
 
                                grep -v "^${mc_mod}.mod$" ${mc_fknownmods} \
 
414
                                grep -v "^${mc_mod}\.mod$" ${mc_fknownmods} \
415
415
                                        > ${mc_fknownmods}_new
416
416
                                mv ${mc_fknownmods}_new ${mc_fknownmods}
417
417
                        fi
426
426
                # In case there are any active modules ...
427
427
                if test -r ${mc_fmodules}; then
428
428
                        #  Remove module from list of active modules.
429
 
                        if grep -v "^${mc_mod}.mod$" ${mc_fmodules} \
 
429
                        if grep -v "^${mc_mod}\.mod$" ${mc_fmodules} \
430
430
                                1> ${mc_nfmodules}
431
431
                        then
432
432
                                :
433
433
                        else
434
434
                                echo "${mc_pn}: error: building new module file failed" 1>&2
435
 
                                echo "grepping for ${mc_mod}.mod in ${mc_fmodules} and writing to ${mc_nfmodules}"
 
435
                                echo "Grepping for ${mc_mod}.mod in ${mc_fmodules} and writing to ${mc_nfmodules}."
436
436
                                kill -STOP $$
437
437
                                exit 1
438
438
                        fi
451
451
        fi
452
452
 
453
453
        #  Remove trailing `.mod'
454
 
        mc_mods=`echo ${mc_paras} | sed -e 's/.mod//g'`
 
454
        mc_mods=`echo ${mc_paras} | sed -e 's/\.mod//g'`
455
455
        for mc_mod in ${mc_mods}; do
456
456
                #  Remove any path information
457
457
                mc_mod=`echo ${mc_mod} | sed -e 's/.*\///'`
458
458
 
459
459
                #  Add module to the list of known modules.
460
 
                if grep "^${mc_mod}.mod$" ${mc_fknownmods} 1>&7 2>&7; then
 
460
                if grep "^${mc_mod}\.mod$" ${mc_fknownmods} 1>&7 2>&7; then
461
461
                        if test ! -d ${mc_mod_dir}/${mc_mod}.mod; then
462
 
                                grep -v "^${mc_mod}.mod$" ${mc_fknownmods} \
 
462
                                grep -v "^${mc_mod}\.mod$" ${mc_fknownmods} \
463
463
                                        > ${mc_fknownmods}_new
464
464
                                mv ${mc_fknownmods}_new ${mc_fknownmods}
465
465
                        fi
472
472
                fi
473
473
 
474
474
                #  Add module to the list of active modules.
475
 
                if grep "^${mc_mod}.mod$" ${mc_fmodules} 1>&7 2>&7; then
 
475
                if grep "^${mc_mod}\.mod$" ${mc_fmodules} 1>&7 2>&7; then
476
476
                        :
477
477
                else
478
478
                        if test ! -d ${mc_mod_dir}/${mc_mod}.mod; then
504
504
        mc_all_depends=
505
505
        mc_missing=
506
506
 
507
 
        echo ${mc_n} "calculating dependencies...${mc_c}" 1>&6
 
507
        echo ${mc_n} "Calculating dependencies...${mc_c}" 1>&6
508
508
 
509
509
        #  Check for selected modules
510
510
        if test ! -r ${mc_fmodules}; then
533
533
 
534
534
                        #  Check wether the dependencies are fulfilled
535
535
                        for mc_m_depend in ${mc_mod_depends}; do
536
 
                                if ((echo ${mc_sel_modules} | \
 
536
                                if (echo ${mc_sel_modules} | \
537
537
                                        grep " ${mc_m_depend}" 1>&7 2>&7) || \
538
538
                                    (echo ${mc_sel_modules} | \
539
 
                                        grep "^${mc_m_depend}" 1>&7 2>&7))
 
539
                                        grep "^${mc_m_depend}" 1>&7 2>&7)
540
540
                                then
541
541
                                        :
542
542
                                else
576
576
        fi
577
577
 
578
578
        if test "x${mc_all_depends}" != x; then
579
 
                echo ${mc_n} "adding modules needed to match dependencies... ${mc_c}" 1>&6
 
579
                echo ${mc_n} "Adding modules needed to match dependencies... ${mc_c}" 1>&6
580
580
                echo ${mc_all_depends} | sed -e 's/ /, /g' 1>&6
581
581
 
582
582
                #  Add the modules
629
629
                fi
630
630
 
631
631
                #  Remove .mod ending
632
 
                mc_modname=`echo ${mc_mod} | sed -e 's/.mod//g'`
 
632
                mc_modname=`echo ${mc_mod} | sed -e 's/\.mod//g'`
633
633
 
634
634
                #  Note: We need to make sure that we only catch module names
635
635
                #        that match _exactly_. e.g. don't mix bseen and seen.
636
 
                if ((echo ${mc_sel_modules} | grep " ${mc_mod}" 1>&7 2>&7) ||
637
 
                    (echo ${mc_sel_modules} | grep "^${mc_mod}" 1>&7 2>&7))
 
636
                if (echo ${mc_sel_modules} | grep " ${mc_mod}" 1>&7 2>&7) ||
 
637
                    (echo ${mc_sel_modules} | grep "^${mc_mod}" 1>&7 2>&7)
 
638
 
638
639
                then
639
640
                        #  The module is selected.
640
641
                        mc_mstate="enabled"
641
 
                        mc_mdisp="(E)nable / (d)isable  [E/d]"
 
642
                        mc_mdisp="(E)nable / (d)isable [E/d] ->"
642
643
                else
643
644
                        #  The module is NOT selected.
644
645
                        mc_mstate="disabled"
645
 
                        mc_mdisp="(e)nable / (D)isable  [e/D]"
 
646
                        mc_mdisp="(e)nable / (D)isable [e/D] ->"
646
647
                fi
647
648
 
648
649
                #  Display description
654
655
                fi
655
656
 
656
657
                while true; do
657
 
                        echo ${mc_n} "\`${mc_modname}' is ${mc_mstate}, ${mc_mdisp} ${mc_c}" 1>&6
 
658
                        echo ${mc_n} "\`${mc_modname}' is ${mc_mstate}: ${mc_mdisp} ${mc_c} " 1>&6
658
659
                        read mc_ask_response;
659
660
 
660
661
                        if (test "${mc_ask_response}" = D); then
667
668
                        #  If the user just presses [return] or
668
669
                        #  if the selected state matches the old state,
669
670
                        #  then we change nothing.
670
 
                        if ((test "x${mc_ask_response}" = x) || \
671
 
                            ((test "${mc_ask_response}" = d) && \
672
 
                             (test "${mc_mstate}" = disabled)) || \
673
 
                            ((test "${mc_ask_response}" = e) && \
674
 
                             (test "${mc_mstate}" = enabled))); then
 
671
                        if test "x${mc_ask_response}" = x || \
 
672
                            (test "${mc_ask_response}" = d && \
 
673
                             test "${mc_mstate}" = disabled) || \
 
674
                            (test "${mc_ask_response}" = e && \
 
675
                             test "${mc_mstate}" = enabled); then
675
676
                                echo "Changing nothing." 1>&6
676
677
                                break;
677
678
                        fi
678
679
                        if (test "${mc_ask_response}" = e); then
679
680
                                #  Add it to the list.
680
681
                                mc_sel_modules="${mc_sel_modules} ${mc_mod}"
681
 
                                echo "Enabled module ${mc_modname}." 1>&6
 
682
                                echo "Enabled module '${mc_modname}'." 1>&6
682
683
                                break;
683
684
                        fi
684
685
                        if (test "${mc_ask_response}" = d); then
685
686
                                #  Remove module from list.
686
687
                                mc_sel_modules=`echo ${mc_sel_modules} | sed -e "s/ ${mc_mod}//g" -e "s/^${mc_mod}//g"`
687
 
                                echo "Disabled module ${mc_modname}." 1>&6
 
688
                                echo "Disabled module '${mc_modname}'." 1>&6
688
689
                                break;
689
690
                        fi
690
691
                done
691
692
                echo "" 1>&6
692
693
        done
693
694
 
694
 
        echo ${mc_n} "recreating list of active modules... ${mc_c}" 1>&6
 
695
        echo ${mc_n} "Recreating list of active modules...${mc_c}" 1>&6
695
696
        ${mc_self_call} -q clear
696
697
        if (${mc_self_call} -q add ${mc_sel_modules}); then
697
 
                echo "done." 1>&6
 
698
                echo " done." 1>&6
698
699
        else
699
 
                echo "failed!" 1>&6
 
700
                echo " failed!" 1>&6
700
701
                exit 1
701
702
        fi
702
703
;;
723
724
 
724
725
                #  Remove directory information from name
725
726
                mc_mod=`echo ${mc_modd} | sed -e 's/.*\///'`
726
 
                echo "creating configure for module \`${mc_mod}'."
 
727
                echo "Creating configure for module '${mc_mod}'."
727
728
                (cd ${mc_modd} && ../eggautoconf)
728
729
        done
729
730
;;