Introduction
opkg is the package manager that is shipped with LEDE linux. With opkg you can't do the usual "upgrade" like you do with apt, dnf, etc . With opkg the upgrade requires the package name.
We provide commands to upgrade every package install in the router. The idea of the script is to use opkg list-upgradable, then we use bash to pipe the list to opkg upgrade.
Commands to upgrade all packages on LEDE
#!/bin/ash
echo "Updating package list..."
opkg update > /dev/null
if [ `opkg list-upgradable | cut -d " " -f1 | wc -l` -gt 0 ]; then
echo "Available updates:"
opkg list-upgradable
echo ""
valid=0
while [ $valid == 0 ]
do
read -n1 -s -p "Upgrade all available packages? [Y/n]" choice
case $choice in
y|Y|"" )
valid=1
echo ""
echo "Upgrading all packages..."
opkg list-upgradable | cut -d " " -f1 | xargs -r opkg upgrade
;;
n|N)
valid=1
echo ""
echo "Upgrade cancelled"
;;
*)
echo ""
echo "Unknown input"
;;
esac
done
else
echo "No updates available"
fi
The important code in the script is this:
opkg list-upgradable | cut -d " " -f1 | xargs -r opkg upgrade
This bash command will pipe upgradable packages to opkg upgrade. All other code in the script is user workflow.