命令行通过 Q 和 Y 到许可协议

命令行通过 Q 和 Y 到许可协议

在构建项目之前,我必须接受命令行协议。Q需要按下 键才能转到协议页面的末尾,然后需要按下Yy。我试过了

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

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

什么都没起作用。在命令行中执行此操作的正确方法是什么?

这是许可功能

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
}

也尝试设置ans="y"

因为echo y | source ../digi-dey-2.4/mkproject.sh我只需要按Q,但直到不工作QY

寻找命令行解决方案接受许可协议。

Ubuntu-18.04

答案1

如果这是你唯一的问题,你可以注释掉 while 循环并设置 ans=y

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

或者只是阻止调用函数 do_license()

或者你可以尝试这个,但不能访问整个脚本,这只是问题

./build.sh << EOF
q

y

EOF

我脑子里最后想到的是

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

所有这些方法都不参考这些软件的许可证,因此请确认您可以这样做。

相关内容