Skip to content

Instantly share code, notes, and snippets.

@omalley
Created August 5, 2024 04:37
Show Gist options
  • Save omalley/a097b8f999b9661126ec84db3bf9d3c2 to your computer and use it in GitHub Desktop.
Save omalley/a097b8f999b9661126ec84db3bf9d3c2 to your computer and use it in GitHub Desktop.
# Get the initial install time
FLASH_TIME=$(opkg info busybox | grep '^Installed-Time: '| cut -d' ' -f2)
# For each installed package
# if it was installed by the user
# and it was installed after the flash_time
# and it isn't a dependency, print it out
opkg list-installed | cut -d' ' -f1 | xargs -n 1 opkg info | \
awk -F: '/Package:/ {pkg = $2; gsub(" ","", pkg)} /Depends:/ {split($2,parts,", "); for (i in parts) {split(parts[i], words, " "); dep[words[1]] = 1}} /Status:/ {status = $2} /Installed-Time:/ {if ($2 > '"$FLASH_TIME"' && status == " install user installed") {pkglist[pkgcnt++] = pkg}} END {for (i in pkglist) {pkg = pkglist[i]; if (!(pkg in dep)) {print pkglist[i]}}}' | \
sort
@omalley
Copy link
Author

omalley commented Aug 24, 2024

The script takes a couple of minutes to run on my router.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment