Skip to content

Instantly share code, notes, and snippets.

@courtarro
Created October 19, 2017 20:23
Show Gist options
  • Save courtarro/a283067f6abd947f3c5b65c5d30942fa to your computer and use it in GitHub Desktop.
Save courtarro/a283067f6abd947f3c5b65c5d30942fa to your computer and use it in GitHub Desktop.
List all user-installed packages in OpenWRT / LEDE without dependencies or packages that are included with the firmware
#!/bin/sh
# Original source: https://gist.github.com/devkid/8d4c2a5ab62e690772f3d9de5ad2d978#gistcomment-2223412
FLASH_TIME="$(awk '
$1 == "Installed-Time:" && ($2 < OLDEST || OLDEST=="") {
OLDEST=$2
}
END {
print OLDEST
}
' /usr/lib/opkg/status)"
awk -v FT="$FLASH_TIME" '
$1 == "Package:" {
PKG=$2
USR=""
}
$1 == "Status:" && $3 ~ "user" {
USR=1
}
$1 == "Installed-Time:" && USR && $2 != FT {
print PKG
}
' /usr/lib/opkg/status | sort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment