On two of my devices, the package list on the custom area of the firmware-selector site (same as what you are calling firmware builder I think) matches the manifest and json files you pointed out to me. Thanks for that by the way.
I hacked this script together to determine what depends on each package provided in a list.
This process depends on packages being installed but not having a current opkg update
list.
Create the input list with one entry per line in file /tmp/my-wd-input
.
The input file can have other data per line following the package name like from the output of opkg list-installed
. (space separated fields.)
The script:
for i in $( cat /tmp/my-wd-input | cut -d\ -f 1 | sort -u )
do
echo $i
k=$( opkg whatdepends $i | grep "^\t" | sed 's/^\t//g' | cut -d\ -f1 | sed 's/\n/ /g' )
j=$( echo "$k" | wc -w )
printf "$j\t$i\t $( echo $k )\n" >>/tmp/my-wd-output
printf "$j\t$i\t $( echo $k )\n"
done
echo
echo Done
The output goes to /tmp/my-wd-output
.
Move the output to a new location before running a new data set or you will get a larger combined output data set.
The form of the output is:
F1=count F2=package_name F3 is a space separated list of what installed packages depend on the searched-for package.
count package-name what depends list (space separated)
Sample output snippet:
0 ath10k-firmware-qca9888-ct
0 base-files
0 busybox
0 ca-bundle
0 dnsmasq
0 dropbear
1 fstools base-files
3 kmod-nft-offload firewall4 luci-app-firewall luci
1 libustream-wolfssl luci-ssl
1 netifd base-files
3 nftables firewall4 luci-app-firewall luci
2 opkg luci-app-opkg luci
3 uclient-fetch opkg luci-app-opkg luci
The output can be sorted, grepped and cut to provide interesting sub lists.
For instance, to get the list of what you call base packages, run something like this (assuming the output is still at /tmp/my-wd-output
).
cat /tmp/my-wd-output | grep "^0" |cut -f 2
to get a list of packages that nothing depends on, strpped of the number, tabs, and what-depends lists.
To get a space separated list (like for custom firmware selector) convert the new lines to spaces
with |tr '\n' ' '
cat /tmp/my-wd-out | grep "^0" |cut -f 2 | tr '\n' ' '
I hope this is useful!
In a few days I may get back to the script to list all the dependencies and sub-dependencies given a list of packages. Usefull for your idea of local installation on an off-line OpenWrt device.
One more for today.
This script should list the packages installed since the image installation/upgrade:
#!/bin/sh
#
out_fqn=$(mktemp)
install_time=`opkg status kernel | awk '$1 == "Installed-Time:" { print $2 }'`
opkg status | awk '$1 == "Package:" {package = $2} \
$1 == "Status:" { user_inst = / user/ && / installed/ } \
$1 == "Installed-Time:" && $2 != '$install_time' && user_inst { print package }' | \
sort >> $out_fqn 2>> $out_fqn
cat $out_fqn
I called mine getuserinstalled.sh
Manually remove the temp file or modify the script to do it.