Jump to content

Recommended Posts

Posted

Hello,

 

When patching or generally compiling, "dialog" is not my friend for reading & testing

 

I would propose adding a wrapper in common.sh (as in branch "second")

dialog_wrapper () {

        ARGS=$(getopt -o b:p: -l "backtitle:,progressbox:" -n "$0" -- "$@");
        if [ $? -ne 0 ]; then exit 1; fi
        eval set -- "$ARGS";
        unset cmdl

        while true; do
                case "$1" in
                        -b|--backtitle)
                                shift; if [ -n "$1" ]; then cmdl="$cmdl --backtitle '$1'"; shift; fi
                        ;;
                        -p|--progressbox)
                                shift; if [ -n "$1" ]; then cmdl="$cmdl --progressbox '$1'"; shift; fi
                        ;;
                        --)
                                shift;
                        break;
                        ;;
                esac
        done

        for args in "$@"
        do
                cmdl="$cmdl $args"
        done

        LOGFILE=/dev/null

         if [[ $DIALOG_LOGFILE != "" ]] ; then
                LOGFILE=$DIALOG_LOGFILE
                [ ! -f $DIALOG_LOGFILE  ] && touch $LOGFILE
                lines=$(wc -l <$DIALOG_LOGFILE)
                if [[ $lines -ge 2000 ]]; then
                        rm -f $DIALOG_LOGFILE.log
                        mv $DIALOG_LOGFILE $DIALOG_LOGFILE.log
                        touch $DIALOG_LOGFILE
                fi
        fi

        if [[ $DIALOG_WRAPPER == "" ]] ; then
                tee -a $LOGFILE | eval "dialog $cmdl"
        else
                tee -a $LOGFILE
        fi
}

and replacing the "dialog" with "dialog_wrapper" for compilation

 

in "compile.sh", 2 options:

#DIALOG_WRAPPER # use dialog as usual

DIALOG_WRAPPER=1 # dialog is not active

#DIALOG_LOGFILE # logfile is /dev/null

DIALOG_LOGFILE=compile.log


Posted

Implemented something similar: https://github.com/zador-blood-stained/lib/commit/8e1551e9faef962d4abca603fe6d8f88d377075b, Igor can merge this if he likes it.

Options are not documented in compile.sh for now and are not dependent on each other. Affect only kernel & u-boot compilation for now.

USE_DIALOG is enabled by default,

USE_DIALOG_LOGGING is disabled by default; writes to output/debug/compilation.log if enabled (also deletes this file before new compilation).

Posted

Zador,blood.stained,

 

Yes great!

 

it is far far simpler and far much better.

 

I wanted a wrapper to avoid Igor changes including "\" as well as to keep learning bash/scripting.

 

dealing with "dialog" non-standard parameters is pretty hard.

 

Thanks!

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines