Skip to content

Instantly share code, notes, and snippets.

@franklinmoy3
Last active January 2, 2025 06:42
Show Gist options
  • Save franklinmoy3/84f69b896a0f95626ec270bfb3487f1d to your computer and use it in GitHub Desktop.
Save franklinmoy3/84f69b896a0f95626ec270bfb3487f1d to your computer and use it in GitHub Desktop.
OpenWRT restore installed packages
#!/bin/sh
# Assumes backup was made using sysupgrade -k -b <name>
# Paste package list into /etc/backup/installed_packages.txt
# Reinstalls packages (ignoring source descriptors "overlay" and "rom" using awk)
opkg update
cat /etc/backup/installed_packages.txt | awk 'gsub(/overlay|rom/, ""){print}' | xargs opkg install
# Clean up duplicate conffiles generated by OPKG
rm /etc/*/*-opkg
echo "Done. Any duplicate conffiles created by OPKG have been deleted"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment