opkg instal
seems not support specify ipk version.
but we can install from file/url.
opkg install $url_of_ipk
and, I wrote a function to find the ipk url, if they in current opkg repo:
usage:
find_pkg tree
found 9.9.9-1 @chen_test.txt
http://www.example.com/path/to/file?xxx/aaa/bbb/aa_tree_9.9.9-1_mips_24kc.ipk
found 1.7.0-2 @test_30
http://10.1.1.30/ipk/tree_1.7.0-2_ramips_24kec.ipk
found 1.8.0-1 @packages
http://downloads.openwrt.org/releases/18.06.1/packages/mipsel_24kc/packages/tree_1.8.0-1_mipsel_24kc.ipk
the shell function:
find_pkg(){
local name=$1
awk '$1 ~ /^src/' /etc/opkg.conf /etc/opkg/*.conf | while read type repo url pad; do
local f=/var/opkg-lists/$repo
{
[ $type == "src/gz" ] && zcat $f || cat $f;
} | {
awk -vname="$name" '$1=="Package:" && $2==name {f=1;r=1} $0=="" {f=0} f {print} END{exit 1-r}'
} | while read key val pad; do
[ "$key" == "Version:" ] && ver=$val
[ "$key" == "Filename:" ] && {
echo found $ver @$repo
echo $url/$val
}
done
done
}