#!/bin/sh

. /lib/functions.sh
PACKAGE_FILE="/etc/package_restore.txt"

# Tcpdump moved from the firmware image to the Package Manager. Re-register it
# for automatic restore only on devices that actually had packet capture set up,
# so that everyone else keeps the freed flash space.
[ -f "/usr/lib/opkg/info/vuci-app-tcpdump-ui.control" ] && exit 0
grep -qsF 'tcpdump - TCPdump' "$PACKAGE_FILE" && exit 0
[ -n "$(uci_get system system tcp_dump)" ] || exit 0

echo "tcpdump - TCPdump - tlt_packages" >>"$PACKAGE_FILE"

exit 0
