Code Monkey home page Code Monkey logo

Comments (7)

devbis avatar devbis commented on June 12, 2024 1

Oh, you mean that you have a command that works with both gnu and busybox. That's fine, can you please create a PR to fix that?

from homeassistant_on_openwrt.

devbis avatar devbis commented on June 12, 2024

It's difficult to say without logs, but

echo 'python3-base - 3.10.9-1 - This package contains only the interpreter and the bare minimum for the interpreter to start.' | grep -Eo '\d+\.\d+'
3.10

works correctly and returns the python's version.

You may add set -x in the beginning of the file to track every executed command and find a real last command

from homeassistant_on_openwrt.

ohabu avatar ohabu commented on June 12, 2024

Busybox version of grep

root@Openwrt:~# opkg list | grep python3-base | head -n 1 | grep -Eo '\d+.\d+'
3.10
9-1
root@Openwrt:~#
root@Openwrt:~# grep
BusyBox v1.35.0 (2023-04-27 20:28:15 UTC) multi-call binary.

GNU version of grep

root@Openwrt:~# opkg list | grep python3-base | head -n 1 | grep -Eo '\d+.\d+'
root@Openwrt:~#
root@Openwrt:~# opkg list | grep python3-base | head -n 1 | grep -Eo '[[:digit:]]+.[[:digit:]]+'
3.10
9-1
root@Openwrt:~# grep --version
grep (GNU grep) 3.7

from homeassistant_on_openwrt.

devbis avatar devbis commented on June 12, 2024

You use a different command, not from the script. Note a backslash before the dot in the script in the latest version

from homeassistant_on_openwrt.

ohabu avatar ohabu commented on June 12, 2024

You are right. But still my point is valid. Those regex won't work with GNU grep which returns null.

Busybox grep

root@OPIPlusLTS:~# opkg list | grep python3-base | head -n 1 | grep -Eo '\d+\.\d+'
3.9
root@OPIPlusLTS:~# opkg list | grep python3-base | head -n 1 | grep -Eo '[[:digit:]]+\.[[:digit:]]+'
3.9
root@OPIPlusLTS:~# grep
BusyBox v1.33.2 (2022-04-16 12:59:34 UTC) multi-call binary.

GNU grep

root@OPIPlusLTS:~# opkg list | grep python3-base | head -n 1 | grep -Eo '\d+\.\d+'
root@OPIPlusLTS:~# opkg list | grep python3-base | head -n 1 | grep -Eo '[[:digit:]]+\.[[:digit:]]+'
3.9
root@OPIPlusLTS:~# grep --version
grep (GNU grep) 3.6

from homeassistant_on_openwrt.

ohabu avatar ohabu commented on June 12, 2024

@hugoleosp Script works. opkg install python3-pip-src is needed for openwrt 22.03 branch.

from homeassistant_on_openwrt.

devbis avatar devbis commented on June 12, 2024

Fixed by #32

from homeassistant_on_openwrt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.