Annotation of dmsdos/src/Menuconfig, revision 1.1

1.1     ! root        1: #! /bin/sh
        !             2: #
        !             3: # This script is used to configure dmsdos options.
        !             4: # It is shamelessly stolen from the Linux kernel.
        !             5: # For a list of credits see there.
        !             6: #
        !             7: #----------------------------------------------------------------------------
        !             8: 
        !             9: #
        !            10: # Make sure we're really running bash.
        !            11: #
        !            12: [ -z "$BASH" ] && { echo "Menuconfig requires bash" 1>&2; exit 1; }
        !            13: 
        !            14: #
        !            15: # Cache function definitions, turn off posix compliance
        !            16: #
        !            17: set -h +o posix
        !            18: 
        !            19: 
        !            20: #
        !            21: # If you prefer all kernel options listed in a single menu rather than
        !            22: # the standard menu hierarchy, set SINGLE_MENU_MODE to "TRUE" in your
        !            23: # environment.
        !            24: #
        !            25: single_menu_mode="${SINGLE_MENU_MODE:-FALSE}"
        !            26: 
        !            27: 
        !            28: #
        !            29: # Load the functions used by the config.in files.
        !            30: #
        !            31: # I do this because these functions must be redefined depending
        !            32: # on whether they are being called for interactive use or for
        !            33: # saving a configuration to a file.
        !            34: #
        !            35: # Thank the heavens bash supports nesting function definitions.
        !            36: #
        !            37: load_functions () {
        !            38: 
        !            39: #
        !            40: # Additional comments
        !            41: #
        !            42: function comment () {
        !            43:        comment_ctr=$[ comment_ctr + 1 ]
        !            44:        echo -ne "': $comment_ctr' '--- $1' " >>MCmenu
        !            45: }
        !            46: 
        !            47: #
        !            48: # Don't need this yet, but we don't want to puke either.
        !            49: #
        !            50: function define_bool () {
        !            51:        :       
        !            52: }
        !            53: 
        !            54: #
        !            55: # Create a boolean (Yes/No) function for our current menu
        !            56: # which calls our local bool function.
        !            57: #
        !            58: function bool () {
        !            59:        eval $2=\${$2:-'n'}  x=\$$2
        !            60: 
        !            61:        case $x in
        !            62:        y|m)    flag="*" ;;
        !            63:        n)      flag=" " ;;
        !            64:        esac
        !            65: 
        !            66:        echo -ne "'$2' '[$flag] $1' " >>MCmenu
        !            67: 
        !            68:        echo -e "function $2 () { l_bool '$2' \"\$1\" ;}\n" >>MCradiolists
        !            69: }
        !            70: 
        !            71: #
        !            72: # Create a tristate (Yes/No/Module) radiolist function
        !            73: # which calls our local tristate function.
        !            74: #
        !            75: # Collapses to a boolean (Yes/No) if module support is disabled.
        !            76: #
        !            77: function tristate () {
        !            78:        if [ "$CONFIG_MODULES" != "y" ]
        !            79:        then
        !            80:                bool "$1" "$2"
        !            81:        else
        !            82:                eval $2=\${$2:-'n'}  x=\$$2
        !            83:        
        !            84:                case $x in
        !            85:                y) flag="*" ;;
        !            86:                m) flag="M" ;;
        !            87:                *) flag=" " ;;
        !            88:                esac
        !            89:        
        !            90:                echo -ne "'$2' '<$flag> $1' " >>MCmenu
        !            91:        
        !            92:                echo -e "
        !            93:                function $2 () { l_tristate '$2' \"\$1\" ;}" >>MCradiolists
        !            94:        fi
        !            95: }
        !            96: 
        !            97: #
        !            98: # Create a tristate radiolist function which is dependent on
        !            99: # another kernel configuration option.
        !           100: #
        !           101: # Quote from the original configure script:
        !           102: #
        !           103: #       If the option we depend upon is a module,
        !           104: #       then the only allowable options are M or N.  If Y, then
        !           105: #       this is a normal tristate.  This is used in cases where modules
        !           106: #       are nested, and one module requires the presence of something
        !           107: #       else in the kernel.
        !           108: #
        !           109: function dep_tristate () {
        !           110:        if [ "$CONFIG_MODULES" != "y" ]
        !           111:        then
        !           112:                bool "$1" "$2"
        !           113:        else
        !           114:                if  eval [ "_$3" != "_m" ]
        !           115:                then
        !           116:                        tristate "$1" "$2" $3
        !           117:                else
        !           118:                        mod_bool "$1" "$2"
        !           119:                fi
        !           120:        fi
        !           121: }
        !           122: 
        !           123: #
        !           124: # Add a menu item which will call our local int function.
        !           125: # 
        !           126: function int () {
        !           127:        eval $2=\${$2:-"$3"} x=\$$2
        !           128: 
        !           129:        echo -ne "'$2' '($x) $1' " >>MCmenu
        !           130: 
        !           131:        echo -e "function $2 () { l_int '$1' '$2' '$3' '$x' ;}" >>MCradiolists
        !           132: }
        !           133: 
        !           134: #
        !           135: # Add a menu item which will call our local int function.
        !           136: # 
        !           137: function hex () {
        !           138:        eval $2=\${$2:-"$3"} x=\${$2##*[x,X]}
        !           139: 
        !           140:        echo -ne "'$2' '($x) $1' " >>MCmenu
        !           141: 
        !           142:        echo -e "function $2 () { l_hex '$1' '$2' '$3' '$x' ;}" >>MCradiolists
        !           143: }
        !           144: 
        !           145: #
        !           146: # Add a menu item which will call our local One-of-Many choice list.
        !           147: #
        !           148: function choice () {
        !           149:        #
        !           150:        # Need to remember params cause they're gonna get reset.
        !           151:        #
        !           152:        title=$1
        !           153:        choices=$2
        !           154:        default=$3
        !           155:        current=
        !           156: 
        !           157:        #
        !           158:        # Find out if one of the choices is already set.
        !           159:        # If it's not then make it the default.
        !           160:        #
        !           161:        set -- $choices
        !           162:        firstchoice=$2
        !           163: 
        !           164:        while [ -n "$2" ]
        !           165:        do
        !           166:                if eval [ "_\$$2" = "_y" ]
        !           167:                then
        !           168:                        current=$1
        !           169:                        break
        !           170:                fi
        !           171:                shift ; shift
        !           172:        done
        !           173: 
        !           174:        : ${current:=$default}
        !           175: 
        !           176:        echo -ne "'$firstchoice' '($current) $title' " >>MCmenu
        !           177: 
        !           178:        echo -e "
        !           179:        function $firstchoice () \
        !           180:                { l_choice '$title' \"$choices\" $current ;}" >>MCradiolists
        !           181: }
        !           182: 
        !           183: } # END load_functions()
        !           184: 
        !           185: 
        !           186: 
        !           187: 
        !           188: 
        !           189: #
        !           190: # Extract available help for an option from Configure.help
        !           191: # and send it to standard output.
        !           192: #
        !           193: # Most of this function was borrowed from the original kernel
        !           194: # Configure script.
        !           195: #
        !           196: function extract_help () {
        !           197:   if [ -f Configure.help ]
        !           198:   then
        !           199:      #first escape regexp special characters in the argument:
        !           200:      var=$(echo "$1"|sed 's/[][\/.^$*]/\\&/g')
        !           201:      #now pick out the right help text:
        !           202:      text=$(sed -n "/^$var[    ]*\$/,\${
        !           203:                         /^$var[        ]*\$/d
        !           204:                         /^#.*/d
        !           205:                        /^[     ]*\$/q
        !           206:                         s/^  //
        !           207:                         p
        !           208:                     }" Configure.help)
        !           209: 
        !           210:      if [ -z "$text" ]
        !           211:      then
        !           212:           echo "There is no help available for this dmsdos option."
        !           213:          return 1
        !           214:      else
        !           215:          echo "$text"
        !           216:      fi
        !           217:   else
        !           218:         echo "There is no help available for this dmsdos option."
        !           219:          return 1
        !           220:   fi
        !           221: }
        !           222: 
        !           223: #
        !           224: # Activate a help dialog.
        !           225: #
        !           226: function help () {
        !           227:        if extract_help $1 >help.out
        !           228:        then
        !           229:                $DIALOG --backtitle "$backtitle" --title "$2"\
        !           230:                        --textbox help.out $ROWS $COLS
        !           231:        else
        !           232:                $DIALOG --backtitle "$backtitle" \
        !           233:                        --textbox help.out $ROWS $COLS
        !           234:        fi
        !           235:        rm help.out
        !           236: }
        !           237: 
        !           238: #
        !           239: # Show the README file.
        !           240: #
        !           241: function show_readme () {
        !           242:        $DIALOG --backtitle "$backtitle" \
        !           243:                --textbox scripts/README.Menuconfig $ROWS $COLS
        !           244: }
        !           245: 
        !           246: #
        !           247: # Begin building the dialog menu command and Initialize the 
        !           248: # Radiolist function file.
        !           249: #
        !           250: function menu_name () {
        !           251:        echo -ne "$DIALOG --title '$1'\
        !           252:                        --backtitle '$backtitle' \
        !           253:                        --menu '$menu_instructions' \
        !           254:                        $ROWS $COLS $((ROWS-10)) \
        !           255:                        '$default' " >MCmenu
        !           256:        >MCradiolists
        !           257: }
        !           258: 
        !           259: #
        !           260: # Add a submenu option to the menu currently under construction.
        !           261: #
        !           262: function submenu () {
        !           263:        echo -ne "'activate_menu $2' '$1  --->' " >>MCmenu
        !           264: }
        !           265: 
        !           266: #
        !           267: # Create a menu entry to handle the traditional sound configuration.
        !           268: #
        !           269: function soundcfg () {
        !           270:        echo -ne "'l_soundcfg' "\
        !           271:                 "'Old configuration script "\
        !           272:                 "(For: SM Wave, PSS & AudioTrix Pro) -->' " >>MCmenu
        !           273: }
        !           274: 
        !           275: #
        !           276: # Startup the traditional sound configuration program.
        !           277: #
        !           278: function l_soundcfg () {
        !           279:        clear
        !           280:        $MAKE -C drivers/sound config
        !           281: }
        !           282: 
        !           283: #
        !           284: # Handle a boolean (Yes/No) option.
        !           285: #
        !           286: function l_bool () {
        !           287:        if [ -n "$2" ]
        !           288:        then
        !           289:                case "$2" in
        !           290:                y|m)    eval $1=y ;;
        !           291:                c)      eval x=\$$1
        !           292:                        case $x in
        !           293:                        y) eval $1=n ;;
        !           294:                        n) eval $1=y ;;
        !           295:                        esac ;;
        !           296:                *)      eval $1=n ;;
        !           297:                esac
        !           298:        else
        !           299:                echo -ne "\007"
        !           300:        fi
        !           301: }
        !           302: 
        !           303: #
        !           304: # Same as bool() except options are (Module/No)
        !           305: #
        !           306: function mod_bool () {
        !           307:        eval $2=\${$2:-'n'}  x=\$$2
        !           308: 
        !           309:        case $x in
        !           310:        y|m) flag='M' ;;
        !           311:        *)   flag=' ' ;;
        !           312:        esac
        !           313: 
        !           314:        echo -ne "'$2' '<$flag> $1' " >>MCmenu
        !           315: 
        !           316:        echo -e "function $2 () { l_mod_bool '$2' \"\$1\" ;}" >>MCradiolists
        !           317: }
        !           318: 
        !           319: #
        !           320: # Same as l_bool() except options are (Module/No)
        !           321: #
        !           322: function l_mod_bool() {
        !           323:        if [ -n "$2" ]
        !           324:        then
        !           325:                case "$2" in
        !           326:                y)      echo -en "\007"
        !           327:                        ${DIALOG} --backtitle "$backtitle" \
        !           328:                                  --infobox "\
        !           329: This feature depends on another which has been configured as a module.  \
        !           330: As a result, this feature will be built as a module." 4 70
        !           331:                        sleep 5
        !           332:                        eval $1=m ;;
        !           333:                m)      eval $1=m ;;
        !           334:                c)      eval x=\$$1
        !           335:                        case $x in
        !           336:                        m) eval $1=n ;;
        !           337:                        n) eval $1=m ;;
        !           338:                        esac ;;
        !           339:                *)      eval $1=n ;;
        !           340:                esac
        !           341:        else
        !           342:                echo -ne "\007"
        !           343:        fi
        !           344: }
        !           345: 
        !           346: #
        !           347: # Handle a tristate (Yes/No/Module) option.
        !           348: #
        !           349: function l_tristate () {
        !           350:        if [ -n "$2" ]
        !           351:        then
        !           352:                eval x=\$$1
        !           353: 
        !           354:                case "$2" in
        !           355:                y) eval $1=y ;;
        !           356:                m) eval $1=m ;;
        !           357:                c) eval x=\$$1
        !           358:                   case $x in
        !           359:                   y) eval $1=n ;;
        !           360:                   n) eval $1=m ;;
        !           361:                   m) eval $1=y ;;
        !           362:                   esac ;;
        !           363:                *) eval $1=n ;;
        !           364:                esac
        !           365:        else
        !           366:                echo -ne "\007"
        !           367:        fi
        !           368: }
        !           369: 
        !           370: #
        !           371: # Create a dialog for entering an integer into a kernel option.
        !           372: #
        !           373: function l_int () {
        !           374:        while true
        !           375:        do
        !           376:                if $DIALOG --title "$1" \
        !           377:                        --backtitle "$backtitle" \
        !           378:                        --inputbox "$inputbox_instructions_int" \
        !           379:                        10 75 "$4" 2>MCdialog.out
        !           380:                then
        !           381:                        answer="`cat MCdialog.out`"
        !           382:                        answer="${answer:-$3}"
        !           383: 
        !           384:                        # Avoid problems with GNU vs POSIX expr semantics.
        !           385:                        if expr "$answer" : '0$\|-[1-9][0-9]*$\|[1-9][0-9]*$' >/dev/null
        !           386:                        then
        !           387:                                eval $2="$answer"
        !           388:                        else
        !           389:                                eval $2="$3"
        !           390:                                echo -en "\007"
        !           391:                                ${DIALOG} --backtitle "$backtitle" \
        !           392:                                        --infobox "You have made an invalid entry." 3 43
        !           393:                                sleep 2
        !           394:                        fi
        !           395: 
        !           396:                        break
        !           397:                fi
        !           398: 
        !           399:                help "$2" "$1"
        !           400:        done
        !           401: }
        !           402: 
        !           403: #
        !           404: # Create a dialog for entering a hexadecimal into a kernel option.
        !           405: #
        !           406: function l_hex () {
        !           407:        while true
        !           408:        do
        !           409:                if $DIALOG --title "$1" \
        !           410:                        --backtitle "$backtitle" \
        !           411:                        --inputbox "$inputbox_instructions_hex" \
        !           412:                        10 75 "$4" 2>MCdialog.out
        !           413:                then
        !           414:                        answer="`cat MCdialog.out`"
        !           415:                        answer="${answer:-$3}"
        !           416:                        answer="${answer##*[x,X]}"
        !           417: 
        !           418:                        # Avoid problems with GNU vs POSIX expr semantics.
        !           419:                        if expr "$answer" : '[0-9a-fA-F][0-9a-fA-F]*$' >/dev/null
        !           420:                        then
        !           421:                                eval $2="$answer"
        !           422:                        else
        !           423:                                eval $2="$3"
        !           424:                                echo -en "\007"
        !           425:                                ${DIALOG} --backtitle "$backtitle" \
        !           426:                                        --infobox "You have made an invalid entry." 3 43
        !           427:                                sleep 2
        !           428:                        fi
        !           429: 
        !           430:                        break
        !           431:                fi
        !           432: 
        !           433:                help "$2" "$1"
        !           434:        done
        !           435: }
        !           436: 
        !           437: #
        !           438: # Handle a one-of-many choice list.
        !           439: #
        !           440: function l_choice () {
        !           441:        #
        !           442:        # Need to remember params cause they're gonna get reset.
        !           443:        #
        !           444:        title="$1"
        !           445:        choices="$2"
        !           446:        current="$3"
        !           447: 
        !           448:        #
        !           449:        # Scan current value of choices and set radiolist switches.
        !           450:        #
        !           451:        list=
        !           452:        set -- $choices
        !           453:        firstchoice=$2
        !           454:        while [ -n "$2" ]
        !           455:        do
        !           456:                case "$1" in
        !           457:                "$current")     list="$list $2 $1 ON "  ;;
        !           458:                *)              list="$list $2 $1 OFF " ;;
        !           459:                esac
        !           460:                        
        !           461:                shift ; shift
        !           462:        done
        !           463: 
        !           464:        while true
        !           465:        do
        !           466:                if $DIALOG --title "$title" \
        !           467:                        --backtitle "$backtitle" \
        !           468:                        --radiolist "$radiolist_instructions" \
        !           469:                        15 70 6 $list 2>MCdialog.out
        !           470:                then
        !           471:                        choice=`cat MCdialog.out`
        !           472:                        break
        !           473:                fi
        !           474: 
        !           475:                help "$firstchoice" "$title"
        !           476:        done
        !           477: 
        !           478:        #
        !           479:        # Now set the boolean value of each option based on
        !           480:        # the selection made from the radiolist.
        !           481:        #
        !           482:        set -- $choices
        !           483:        while [ -n "$2" ]
        !           484:        do
        !           485:                if [ "$2" = "$choice" ]
        !           486:                then
        !           487:                        eval $2="y"
        !           488:                else
        !           489:                        eval $2="n"
        !           490:                fi
        !           491:                
        !           492:                shift ; shift
        !           493:        done
        !           494: }
        !           495: 
        !           496: 
        !           497: #
        !           498: # A faster awk based recursive parser. (I hope)
        !           499: #
        !           500: function parser1 () {
        !           501: awk '
        !           502: BEGIN {
        !           503:        menu_no = 0
        !           504:        comment_is_option = 0
        !           505:        parser("'$CONFIG_IN'","MCmenu0")
        !           506: }
        !           507: 
        !           508: function parser(ifile,menu) {
        !           509: 
        !           510:        while (getline <ifile) {
        !           511:                if ($1 == "mainmenu_option") {
        !           512:                        comment_is_option = "1"
        !           513:                }
        !           514:                else if ($1 == "comment" && comment_is_option == "1") {
        !           515:                        comment_is_option= "0"
        !           516:                        sub($1,"",$0)
        !           517:                        ++menu_no
        !           518: 
        !           519:                        printf("submenu %s MCmenu%s\n", $0, menu_no) >>menu
        !           520: 
        !           521:                        printf( "function MCmenu%s () {\n"\
        !           522:                                "default=$1\n"\
        !           523:                                "menu_name %s\n",\
        !           524:                                 menu_no, $0) >"MCmenu"menu_no
        !           525: 
        !           526:                        parser(ifile, "MCmenu"menu_no)
        !           527:                }
        !           528:                else if ($1 ~ "endmenu") {
        !           529:                        printf("}\n") >>menu
        !           530:                        return
        !           531:                } 
        !           532:                else if ($0 ~ /^#|\$MAKE|mainmenu_name/) {
        !           533:                        printf("") >>menu
        !           534:                }
        !           535:                else if ($1 == "source") {
        !           536:                        # Yuk!  Blah!  Phooey!
        !           537:                        if ($2 ~ "drivers/sound") {
        !           538:                                printf("soundcfg\n") >>menu
        !           539:                        }
        !           540: 
        !           541:                        parser($2,menu)
        !           542:                }
        !           543:                else {
        !           544:                        print >>menu
        !           545:                }
        !           546:        }
        !           547: }'
        !           548: }
        !           549: 
        !           550: #
        !           551: # Secondary parser for single menu mode.
        !           552: #
        !           553: function parser2 () {
        !           554: awk '
        !           555: BEGIN {
        !           556:        parser("'$CONFIG_IN'","MCmenu0")
        !           557: }
        !           558: 
        !           559: function parser(ifile,menu) {
        !           560: 
        !           561:        while (getline <ifile) {
        !           562:                if ($1 ~ /mainmenu_option|endmenu/) {
        !           563:                        printf("") >>menu
        !           564:                } 
        !           565:                else if ($0 ~ /^#|\$MAKE|mainmenu_name/) {
        !           566:                        printf("") >>menu
        !           567:                }
        !           568:                else if ($1 == "source") {
        !           569:                        if ($2 ~ "drivers/sound") {
        !           570:                                printf("soundcfg\n") >>menu
        !           571:                        }
        !           572:                        parser($2,menu)
        !           573:                }
        !           574:                else {
        !           575:                        print >>menu
        !           576:                }
        !           577:        }
        !           578: }'
        !           579: }
        !           580: 
        !           581: #
        !           582: # Parse all the config.in files into mini scripts.
        !           583: #
        !           584: function parse_config_files () {
        !           585:        rm -f MCmenu*
        !           586: 
        !           587:        echo "function MCmenu0 () {" >MCmenu0
        !           588:        echo 'default=$1' >>MCmenu0
        !           589:        echo "menu_name 'Main Menu'" >>MCmenu0
        !           590: 
        !           591:        if [ "_$single_menu_mode" = "_TRUE" ]
        !           592:        then
        !           593:                parser2
        !           594:        else
        !           595:                parser1
        !           596:        fi
        !           597: 
        !           598:        echo "comment ''"       >>MCmenu0
        !           599:        echo "g_alt_config"     >>MCmenu0
        !           600:        echo "s_alt_config"     >>MCmenu0
        !           601: 
        !           602:        echo "}" >>MCmenu0
        !           603: 
        !           604:        #
        !           605:        # These mini scripts must be sourced into the current
        !           606:        # environment in order for all of this to work.  Leaving
        !           607:        # them on the disk as executables screws up the recursion
        !           608:        # in activate_menu(), among other things.  Once they are
        !           609:        # sourced we can discard them.
        !           610:        #
        !           611:        for i in MCmenu*
        !           612:        do
        !           613:                source ./$i
        !           614:        done
        !           615: 
        !           616:        rm -f MCmenu*
        !           617: }
        !           618: 
        !           619: #
        !           620: # This is the menu tree's bootstrap.
        !           621: #
        !           622: # Executes the parsed menus on demand and creates a set of functions,
        !           623: # one per configuration option.  These functions will in turn execute
        !           624: # dialog commands or recursively call other menus.
        !           625: #
        !           626: function activate_menu () {
        !           627:        while true
        !           628:        do
        !           629:                comment_ctr=0           #So comment lines get unique tags
        !           630: 
        !           631:                $1 "$default"           #Create the lxdialog menu & functions
        !           632: 
        !           633:                if [ "$?" != "0" ]
        !           634:                then
        !           635:                        clear
        !           636:                        cat <<EOM
        !           637: 
        !           638: Menuconfig has encountered a possible error in one of the kernel's
        !           639: configuration files and is unable to continue.
        !           640: 
        !           641: Please report this to the author <[email protected]>.  You may also
        !           642: send a problem report to [email protected] or post a
        !           643: message to the linux.dev.kernel news group.
        !           644: 
        !           645: Please indicate the kernel version you are trying to configure and
        !           646: which menu you were trying to enter when this error occurred.
        !           647: 
        !           648: EOM
        !           649:                        cleanup
        !           650:                        exit 1
        !           651:                fi
        !           652: 
        !           653:                . ./MCradiolists                #Source the menu's functions
        !           654: 
        !           655:                . ./MCmenu 2>MCdialog.out       #Activate the lxdialog menu
        !           656:                ret=$?
        !           657: 
        !           658:                read selection <MCdialog.out
        !           659: 
        !           660:                case "$ret" in
        !           661:                0|3|4|5|6)
        !           662:                        defaults="$selection$defaults"  #pseudo stack
        !           663:                        case "$ret" in
        !           664:                        0) eval $selection   ;;
        !           665:                        3) eval $selection y ;;
        !           666:                        4) eval $selection n ;;
        !           667:                        5) eval $selection m ;;
        !           668:                        6) eval $selection c ;;
        !           669:                        esac
        !           670:                        default="${defaults%%*}" defaults="${defaults#*}"
        !           671:                        ;;
        !           672:                2)      
        !           673:                        default="${selection%%\ *}"
        !           674: 
        !           675:                        case "$selection" in
        !           676:                        *"-->"*|*"alt_config"*)
        !           677:                                show_readme ;;
        !           678:                        *)
        !           679:                                eval help $selection ;;
        !           680:                        esac
        !           681:                        ;;
        !           682:                255|1)
        !           683:                        break
        !           684:                        ;;
        !           685:                139)
        !           686:                        stty sane
        !           687:                        clear
        !           688:                        cat <<EOM
        !           689: 
        !           690: There seems to be a problem with the lxdialog companion utility which is
        !           691: built prior to running Menuconfig.  Usually this is an indicator that you
        !           692: have upgraded/downgraded your ncurses libraries and did not remove the 
        !           693: old ncurses header file(s) in /usr/include or /usr/include/ncurses.
        !           694: 
        !           695: It is VERY important that you have only one set of ncurses header files
        !           696: and that those files are properly version matched to the ncurses libraries 
        !           697: installed on your machine.
        !           698: 
        !           699: You may also need to rebuild lxdialog.  This can be done by moving to
        !           700: the /usr/src/linux/scripts/lxdialog directory and issuing the 
        !           701: "make clean all" command.
        !           702: 
        !           703: If you have verified that your ncurses install is correct, you may email
        !           704: the author <[email protected]> or post a message on the linux.dev.kernel
        !           705: news group for additional assistance. 
        !           706: 
        !           707: EOM
        !           708:                        cleanup
        !           709:                        exit 139
        !           710:                        ;;
        !           711:                esac
        !           712:        done
        !           713: }
        !           714: 
        !           715: #
        !           716: # Create a menu item to load an alternate configuration file.
        !           717: #
        !           718: g_alt_config () {
        !           719:        echo -n "get_alt_config 'Load an Alternate Configuration File' "\
        !           720:                >>MCmenu
        !           721: }
        !           722: 
        !           723: #
        !           724: # Get alternate config file name and load the 
        !           725: # configuration from it.
        !           726: #
        !           727: get_alt_config () {
        !           728:        set -f ## Switch file expansion OFF
        !           729: 
        !           730:        while true
        !           731:        do
        !           732:                ALT_CONFIG="${ALT_CONFIG:-$_CONFIG}"
        !           733: 
        !           734:                $DIALOG --backtitle "$backtitle" \
        !           735:                        --inputbox "\
        !           736: Enter the name of the configuration file you wish to load.  \
        !           737: Accept the name shown to restore the configuration you \
        !           738: last retrieved.  Leave blank to abort."\
        !           739:                        11 55 "$ALT_CONFIG" 2>MCdialog.out
        !           740: 
        !           741:                if [ "$?" = "0" ]
        !           742:                then
        !           743:                        ALT_CONFIG=`cat MCdialog.out`
        !           744: 
        !           745:                        [ "_" = "_$ALT_CONFIG" ] && break
        !           746: 
        !           747:                        if eval [ -r "$ALT_CONFIG" ]
        !           748:                        then
        !           749:                                eval load_config_file "$ALT_CONFIG"
        !           750:                                break
        !           751:                        else
        !           752:                                echo -ne "\007"
        !           753:                                $DIALOG --backtitle "$backtitle" \
        !           754:                                        --infobox "File does not exist!"  3 38
        !           755:                                sleep 2
        !           756:                        fi
        !           757:                else
        !           758:                        cat <<EOM >help.out
        !           759: 
        !           760: For various reasons, one may wish to keep several different kernel
        !           761: configurations available on a single machine.  
        !           762: 
        !           763: If you have saved a previous configuration in a file other than the
        !           764: kernel's default, entering the name of the file here will allow you
        !           765: to modify that configuration.
        !           766: 
        !           767: If you are uncertain, then you have probably never used alternate 
        !           768: configuration files.  You should therefor leave this blank to abort.
        !           769: 
        !           770: EOM
        !           771:                        $DIALOG --backtitle "$backtitle"\
        !           772:                                --title "Load Alternate Configuration"\
        !           773:                                --textbox help.out $ROWS $COLS
        !           774:                fi
        !           775:        done
        !           776: 
        !           777:        set +f ## Switch file expansion ON
        !           778:        rm -f help.out MCdialog.out
        !           779: }
        !           780: 
        !           781: #
        !           782: # Create a menu item to store an alternate config file.
        !           783: #
        !           784: s_alt_config () {
        !           785:        echo -n "save_alt_config 'Save Configuration to an Alternate File' "\
        !           786:                 >>MCmenu
        !           787: }
        !           788: 
        !           789: #
        !           790: # Get an alternate config file name and save the current
        !           791: # configuration to it.
        !           792: #
        !           793: save_alt_config () {
        !           794:        set -f  ## Switch file expansion OFF
        !           795:                        
        !           796:        while true
        !           797:        do
        !           798: 
        !           799:                $DIALOG --backtitle "$backtitle" \
        !           800:                        --inputbox "\
        !           801: Enter a filename to which this configuration should be saved \
        !           802: as an alternate.  Leave blank to abort."\
        !           803:                        10 55 "$ALT_CONFIG" 2>MCdialog.out
        !           804: 
        !           805:                if [ "$?" = "0" ]
        !           806:                then
        !           807:                        ALT_CONFIG=`cat MCdialog.out`
        !           808: 
        !           809:                        [ "_" = "_$ALT_CONFIG" ] && break
        !           810: 
        !           811:                        if eval touch $ALT_CONFIG 2>/dev/null
        !           812:                        then
        !           813:                                eval save_configuration $ALT_CONFIG
        !           814:                                load_functions  ## RELOAD
        !           815:                                break
        !           816:                        else
        !           817:                                echo -ne "\007"
        !           818:                                $DIALOG --backtitle "$backtitle" \
        !           819:                                        --infobox "Can't create file!  Probably a nonexistent directory." 3 60
        !           820:                                sleep 2
        !           821:                        fi
        !           822:                else
        !           823:                        cat <<EOM >help.out
        !           824: 
        !           825: For various reasons, one may wish to keep different
        !           826: configurations available on a single machine.  
        !           827: 
        !           828: Entering a file name here will allow you to later retrieve, modify
        !           829: and use the current configuration as an alternate to whatever 
        !           830: configuration options you have selected at that time.
        !           831: 
        !           832: If you are uncertain what all this means then you should probably
        !           833: leave this blank.
        !           834: EOM
        !           835:                        $DIALOG --backtitle "$backtitle"\
        !           836:                                --title "Save Alternate Configuration"\
        !           837:                                --textbox help.out $ROWS $COLS
        !           838:                fi
        !           839:        done
        !           840: 
        !           841:        set +f  ## Switch file expansion ON
        !           842:        rm -f help.out MCdialog.out
        !           843: }
        !           844: 
        !           845: 
        !           846: #
        !           847: # Load config file into the environment converting all
        !           848: # "# OPTION is not set" lines to "OPTION=n".
        !           849: #
        !           850: # The $ARCH defaults are loaded first so "new"/previously 
        !           851: # unconfigured parameters are assigned the proper defaults.
        !           852: #
        !           853: function load_config_file () {
        !           854:        eval "`sed -e 's/# \(.*\) is not set.*/\1=n/' dmsdos-config.default $1`"
        !           855: }
        !           856: 
        !           857: 
        !           858: #
        !           859: # Just what it says.
        !           860: #
        !           861: save_configuration () {
        !           862:        ${DIALOG} --backtitle "$backtitle" \
        !           863:                  --infobox "Saving dmsdos configuration..."  3 40
        !           864: 
        !           865:        #
        !           866:        # Now, let's redefine the configuration functions for final
        !           867:        # output to the config files.
        !           868:        #
        !           869:        # Nested function definitions, YIPEE!
        !           870:        #
        !           871:        function bool () {
        !           872:                eval define_bool "$2" "\${$2:-n}"
        !           873:        }
        !           874: 
        !           875:        function tristate () {
        !           876:                eval define_bool "$2" "\${$2:-n}"
        !           877:        }
        !           878: 
        !           879:        function dep_tristate () {
        !           880:                eval x=\${$2:-n}
        !           881: 
        !           882:                if eval [ "_$3" = "_m" ]
        !           883:                then
        !           884:                        if [ "$x" = "y" ]
        !           885:                        then
        !           886:                                x="m"
        !           887:                        fi
        !           888:                fi
        !           889: 
        !           890:                define_bool "$2" "$x"
        !           891:        }
        !           892: 
        !           893:        function int () {
        !           894:                eval x=\${$2:-"$3"}
        !           895:                echo "$2=$x"            >>$CONFIG
        !           896:                echo "#define $2 ($x)"  >>$CONFIG_H
        !           897:        }
        !           898: 
        !           899:        function hex () {
        !           900:                eval x=\${$2:-"$3"}
        !           901:                echo "$2=$x"                     >>$CONFIG
        !           902:                echo "#define $2 0x${x##*[x,X]}" >>$CONFIG_H
        !           903:        }
        !           904: 
        !           905:        function define_bool () {
        !           906:                eval $1="$2"
        !           907: 
        !           908:                case "$2" in
        !           909:                y)
        !           910:                        echo "$1=y"             >>$CONFIG
        !           911:                        echo "#define $1 1"     >>$CONFIG_H
        !           912:                        ;;
        !           913: 
        !           914:                m)
        !           915:                        if [ "$CONFIG_MODULES" = "y" ]
        !           916:                        then
        !           917:                                echo "$1=m"                >>$CONFIG
        !           918:                                echo "#undef  $1"          >>$CONFIG_H
        !           919:                                echo "#define $1_MODULE 1" >>$CONFIG_H
        !           920:                        else
        !           921:                                echo "$1=y"             >>$CONFIG
        !           922:                                echo "#define $1 1"     >>$CONFIG_H
        !           923:                        fi
        !           924:                        ;;
        !           925: 
        !           926:                n)
        !           927:                        echo "# $1 is not set"  >>$CONFIG
        !           928:                        echo "#undef  $1"       >>$CONFIG_H
        !           929:                        ;;
        !           930:                esac
        !           931:        }
        !           932: 
        !           933:        function choice () {
        !           934:                #
        !           935:                # Find the first choice that's already set to 'y'
        !           936:                #
        !           937:                choices="$2"
        !           938:                default="$3"
        !           939:                current=
        !           940: 
        !           941:                set -- $choices
        !           942:                while [ -n "$2" ]
        !           943:                do
        !           944:                        if eval [ "_\$$2" = "_y" ]
        !           945:                        then
        !           946:                                current=$1
        !           947:                                break
        !           948:                        fi
        !           949:                        shift ; shift
        !           950:                done
        !           951: 
        !           952:                #
        !           953:                # Use the default if none were set.  
        !           954:                #
        !           955:                : ${current:=$default}
        !           956: 
        !           957:                #
        !           958:                # Then extract the actual option from the list of choices.
        !           959:                #
        !           960:                current=${choices#*$current} ; set $current
        !           961: 
        !           962:                define_bool "$1" "y"
        !           963:        }
        !           964: 
        !           965:        function mainmenu_name () {
        !           966:                :
        !           967:        }
        !           968: 
        !           969:        function mainmenu_option () {
        !           970:                comment_is_option=TRUE
        !           971:        }
        !           972: 
        !           973:        function endmenu () {
        !           974:                :
        !           975:        }
        !           976: 
        !           977:        function comment () {
        !           978:                if [ "$comment_is_option" ]
        !           979:                then
        !           980:                        comment_is_option=
        !           981:                        echo        >>$CONFIG
        !           982:                        echo "#"    >>$CONFIG
        !           983:                        echo "# $1" >>$CONFIG
        !           984:                        echo "#"    >>$CONFIG
        !           985: 
        !           986:                        echo         >>$CONFIG_H
        !           987:                        echo "/*"    >>$CONFIG_H
        !           988:                        echo " * $1" >>$CONFIG_H
        !           989:                        echo " */"   >>$CONFIG_H
        !           990:                fi
        !           991:        }
        !           992: 
        !           993:        DEF_CONFIG="${1:-$_CONFIG}"
        !           994:        DEF_CONFIG_H="$AUTOCONF_H"
        !           995: 
        !           996:        CONFIG=.tmpconfig
        !           997:        CONFIG_H=.tmpconfig.h
        !           998: 
        !           999:        echo "#" >$CONFIG
        !          1000:        echo "# Automatically generated by make menuconfig: don't edit" >>$CONFIG
        !          1001:        echo "#" >>$CONFIG
        !          1002: 
        !          1003:        echo "/*" >$CONFIG_H
        !          1004:        echo " * Automatically generated by make menuconfig: don't edit" >>$CONFIG_H
        !          1005:        echo " * Use make menuconfig instead." >>$CONFIG_H
        !          1006:        echo " */" >>$CONFIG_H
        !          1007: 
        !          1008:        MAKE=:  #To prevent sound Makefile from running.
        !          1009:        
        !          1010:        if . $CONFIG_IN >>.menuconfig.log 2>&1
        !          1011:        then
        !          1012:                if [ -f "$DEF_CONFIG" ]
        !          1013:                then
        !          1014:                        rm -f ${DEF_CONFIG}.old
        !          1015:                        mv $DEF_CONFIG ${DEF_CONFIG}.old
        !          1016:                fi
        !          1017: 
        !          1018:                mv $CONFIG $DEF_CONFIG
        !          1019:                mv $CONFIG_H $DEF_CONFIG_H
        !          1020:        
        !          1021:                return 0
        !          1022:        else
        !          1023:                return 1
        !          1024:        fi
        !          1025: }
        !          1026: 
        !          1027: 
        !          1028: #
        !          1029: # Remove temporary files
        !          1030: #
        !          1031: cleanup () {
        !          1032:        cleanup1
        !          1033:        cleanup2
        !          1034:        stty $S_TERMIO
        !          1035: }
        !          1036: 
        !          1037: cleanup1 () {
        !          1038:        rm -f MCmenu* MCradiolists MCdialog.out help.out
        !          1039: }
        !          1040: 
        !          1041: cleanup2 () {
        !          1042:        rm -f .tmpconfig .tmpconfig.h
        !          1043: }
        !          1044: 
        !          1045: set_geometry () {
        !          1046:        # Some distributions export these with incorrect values
        !          1047:        # which can really screw up some ncurses programs.
        !          1048:        LINES=  COLUMNS=
        !          1049: 
        !          1050:        ROWS=${1:-24}  COLS=${2:-80} 
        !          1051: 
        !          1052:        # Just in case the nasty rlogin bug returns.
        !          1053:        #
        !          1054:        [ $ROWS = 0 ] && ROWS=24
        !          1055:        [ $COLS = 0 ] && COLS=80
        !          1056: 
        !          1057:        if [ $ROWS -lt 19 -o $COLS -lt 80 ]
        !          1058:        then
        !          1059:                echo -e "\n\007Your display is too small to run Menuconfig!"
        !          1060:                echo "It must be at least 19 lines by 80 columns."
        !          1061:                exit 0
        !          1062:        fi 
        !          1063: 
        !          1064:        ROWS=$((ROWS-4))  COLS=$((COLS-5))
        !          1065: }
        !          1066: 
        !          1067: S_TERMIO=`stty -g`
        !          1068: 
        !          1069: set_geometry `stty size 2>/dev/null`
        !          1070: 
        !          1071: menu_instructions="\
        !          1072: Arrow keys navigate the menu.  \
        !          1073: <Enter> selects submenus --->.  \
        !          1074: Highlighted letters are hotkeys.  \
        !          1075: Pressing <Y> includes, <N> excludes features.  \
        !          1076: Press <Esc><Esc> to exit, <?> for Help.  \
        !          1077: Legend: [*] built-in  [ ] excluded "
        !          1078: 
        !          1079: radiolist_instructions="\
        !          1080: Use the arrow keys to navigate this window or \
        !          1081: press the hotkey of the item you wish to select \
        !          1082: followed by the <SPACE BAR>.
        !          1083: Press <?> for additional information about this option."
        !          1084: 
        !          1085: inputbox_instructions_int="\
        !          1086: Please enter a decimal value. \
        !          1087: Fractions will not be accepted.  \
        !          1088: Use the <TAB> key to move from the input field to the buttons below it."
        !          1089: 
        !          1090: inputbox_instructions_hex="\
        !          1091: Please enter a hexadecimal value. \
        !          1092: Use the <TAB> key to move from the input field to the buttons below it."
        !          1093: 
        !          1094: DIALOG="${DIALOG:-/usr/src/linux/scripts/lxdialog/lxdialog}"
        !          1095: 
        !          1096: if [ ! -x $DIALOG ];
        !          1097: then
        !          1098:        echo "Compiling lxdialog in kernel source tree..."
        !          1099:        make -C /usr/src/linux/scripts/lxdialog lxdialog
        !          1100:        if [ "$?" != "0" ];
        !          1101:        then
        !          1102:                echo "Something's wrong here. Sorry, I don't know what."
        !          1103:                exit 1
        !          1104:        fi
        !          1105: fi
        !          1106: 
        !          1107: backtitle="Dmsdos CVF-FAT Module Configuration"
        !          1108: 
        !          1109: trap "cleanup ; rm -f .menuconfig ; exit 1" 1 2 15
        !          1110: 
        !          1111: 
        !          1112: #
        !          1113: # Locate default files.
        !          1114: #
        !          1115: DEFAULTS="dmsdos-config.default"
        !          1116: 
        !          1117: CONFIG_IN="${1:-./config.in}"
        !          1118: 
        !          1119: _CONFIG="${2:-.config}"
        !          1120: 
        !          1121: AUTOCONF_H="dmsdos-config.h"
        !          1122: 
        !          1123: if [ -f "$_CONFIG" ]; then
        !          1124:   DEFAULTS=$_CONFIG
        !          1125: fi
        !          1126: 
        !          1127: if [ -f $DEFAULTS ]
        !          1128: then
        !          1129:   echo
        !          1130:   echo "Using defaults found in" $DEFAULTS
        !          1131:   load_config_file $DEFAULTS
        !          1132: else
        !          1133:   echo
        !          1134:   echo "No defaults found"
        !          1135: fi
        !          1136: 
        !          1137: # Fresh new log.
        !          1138: >.menuconfig.log
        !          1139: 
        !          1140: $DIALOG        --backtitle "$backtitle" \
        !          1141:        --infobox "Preparing configuration scripts..." 3 40
        !          1142: 
        !          1143: # Load the functions used by the config.in files.
        !          1144: load_functions
        !          1145: 
        !          1146: #
        !          1147: # Read config.in files and parse them into one shell function per menu.
        !          1148: #
        !          1149: parse_config_files $CONFIG_IN
        !          1150: 
        !          1151: #
        !          1152: # Start the ball rolling from the top.
        !          1153: #
        !          1154: activate_menu MCmenu0
        !          1155: 
        !          1156: #
        !          1157: # All done!
        !          1158: #
        !          1159: cleanup1
        !          1160: 
        !          1161: #
        !          1162: # Confirm and Save
        !          1163: #
        !          1164: if $DIALOG --backtitle "$backtitle" \
        !          1165:           --yesno "Do you wish to save your new dmsdos configuration?" 5 60
        !          1166:           
        !          1167: then
        !          1168:        save_configuration
        !          1169:        stty $S_TERMIO
        !          1170:        clear
        !          1171: 
        !          1172:        cat <<EOM
        !          1173: 
        !          1174: 
        !          1175: The dmsdos module is now configured. Do a 'make clean; make' to (re)compile.
        !          1176: 
        !          1177: EOM
        !          1178: else
        !          1179:        clear
        !          1180:        stty $S_TERMIO
        !          1181:        echo -e "Your dmsdos configuration changes were NOT saved.\n"
        !          1182:        exit 1
        !          1183: fi
        !          1184: 
        !          1185: 
        !          1186: exit 0
        !          1187: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.