gekmihesg/ansible-openwrt

Adding better support for opkg

Opened this issue · 0 comments

We are trying to install packages via their .ipk - for offline package installations

Ensuring that the list of dependencies is properly organized to meet the required order of installation.

What this tries to resolve is the following

    - opkg:
        name: "/tmp/snmp/libpcre_8.45-1_mips_24kc.ipk"
        state: present
        force: overwrite

Basically, it installs fine, but the module always returns fail, as it is doing:

opkg status /tmp/snmp/libpcre_8.45-1_mips_24kc.ipk

As per:

query_package() {
    [ -n "$(opkg status "$1")" ]
}

So to make it "work" - I modified install_packages() function inside library/openwrt_opkg.sh like so:

install_packages() {
    local _IFS pkg pkg_name install_output
    _IFS="$IFS"; IFS=","; set -- $name; IFS="$_IFS"
    for pkg; do
        pkg_name="$pkg"
        if [[ "$pkg" == *.ipk ]]; then
            pkg_name=$(basename "$pkg" .ipk | sed -r 's/_.*//')
        fi
        ! query_package "$pkg_name" || continue
        [ -n "$_ansible_check_mode" ] || {
            try opkg install$force $nodeps "$pkg"
            query_package "$pkg_name" || fail "failed to install $pkg: $_result"
        }
        changed
    done
}

Anyway, this is working well now, installing and returning OK if installed already, changed if it's really changed etc...

@gekmihesg seems to be AWOL

bit of a shame 😞

great repo