0

I have to accept command line agreement before building the project. Key Q need to press to go to end of the agreement page and then need to press Y or y. I have tried

printf 'qy\n' | source ../digi-2.4/mkproject.sh

printf '\ny\n' | LESS='+q' source ../digi-2.4/mkproject.sh

Nothing worked. Whats is correct way to do this in command line ?

This is the license function

do_license() {
        local MKP_LICENSE_FILES=" \
                ${MKP_SCRIPTPATH}/sources/meta-digi/meta-digi-arm/DIGI_EULA \
                ${MKP_SCRIPTPATH}/sources/meta-digi/meta-digi-arm/DIGI_OPEN_EULA \
                ${MKP_SCRIPTPATH}/sources/meta-freescale/EULA \
        "
        [ -z "${MKP_PAGER+x}" ] && MKP_PAGER="| more"
        eval cat - "${MKP_LICENSE_FILES}" <<-_EOF_ ${MKP_PAGER}; printf "\n"
                +-------------------------------------------------------------------------------+
                |                                                                               |
                |                                                                               |
                |  This software depends on libraries and packages that are covered by the      |
                |  following licenses:                                                          |
                |                                                                               |
                |      * Digi's end user license agreement                                      |
                |      * Digi's third party and open source license notice                      |
                |      * NXP Semiconductors' software license agreement                         |
                |                                                                               |
                |  To have the right to use those binaries in your images you need to read and  |
                |  accept the licenses.                                                         |
                |                                                                               |
                |                                                                               |
                +-------------------------------------------------------------------------------+

        _EOF_
        unset MKP_LICENSE_FILES MKP_PAGER

        ans=""
        while [ -z "${ans}" ]; do
                read -p "Do you accept all three license agreements? [y/Y to accept]: " ans
        done
        printf "%80s\n\n" | tr ' ' '-'

        [ "${ans,,}" = "y" ] || return 1
}

also tried setting ans="y"

For echo y | source ../digi-dey-2.4/mkproject.sh I just have to press Q, but till not working for Q and Y

Looking for command line solution to accept the license agreement.

I am on Ubuntu-18.04

  • You should look into executable if it allows unattended mode (there will probably be some swich like --accept-tos) – Aroly7 Apr 10 at 18:13
  • You can easily comment out the while cycle but since I dont know the license to the software you are trying to build I can't say if it is okay from legal side. and set ans="y" – Aroly7 Apr 10 at 18:23
0

If it is the only problem you have you can either comment out while loop and set ans=y

#while [ -z "${ans}" ]; do
#     read -p "Do you accept all three license agreements? [y/Y to accept]: " ans
#done
ans="y"

or just prevent calling the function do_license()

or you can try this but without access to the whole script, it is just ques

./build.sh << EOF
q

y

EOF

Last think on my mind is

(echo "Q"
 echo "y") | program

All those ways do not consult licenses of those softs so, please verify that you can do that.

  • EOF solution does not work q – roy Apr 10 at 20:32
  • @roy The script you showed don't need q to be pressed – Aroly7 Apr 10 at 20:34
  • I think its required because of [ -z "${MKP_PAGER+x}" ] && MKP_PAGER="| more" – roy Apr 10 at 20:47
  • @roy I edited one of the last things on my mind I can think of without having access to the file. – Aroly7 Apr 10 at 20:54
  • 1
    Sorry, then it will be harder to solve by emulating the input. You should take a look if you can prevent calling the function do_license() – Aroly7 Apr 10 at 21:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.