Last active
March 4, 2025 16:14
-
-
Save 5p0ng3b0b/9b3785721729d344a9f536cc341c2397 to your computer and use it in GitHub Desktop.
List openwrt user installed packages without the additional dependencies. Used for generating the PACKAGES variable in openwrt imagebuilder.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
P=/usr/lib/opkg/status | |
T=$(awk -v RS= '/^P.{0,8}ker/' $P|grep '^I'|cut -d' ' -f2) #get timestamp of firmware | |
I=$(awk -v RS= -v t="$T" '$0 !~t' $P|grep '^Pa'|cut -d' ' -f2|sort) #get all user installed packages | |
D=$(awk -v RS= -v t="$T" '$0 !~t' $P|grep '^D'|cut -d' ' -f2-|sed 's#, #\n#g'|sort|uniq) #get packages that are dependencies | |
p=;for i in $I;do if [ $(echo $D|grep -c $i) = 0 ];then p="$p $i";fi;done;echo $p #get user packages not listed as a dependency |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment