1
0
mirror of https://github.com/aquatix/dotfiles.git synced 2025-12-06 21:45:10 +01:00

Auto-download on demand and give warning if file is old

This commit is contained in:
2022-04-11 16:35:56 +02:00
parent d9bbe483ba
commit 838aa1df81

View File

@@ -14,9 +14,21 @@ ouilocation="${HOME}/.dot/oui.txt"
#################
if [ ! -f "${ouilocation}" ] ; then
echo 'OUI location can not be found. Have you updated the config?' 1>&2
echo "OUI location can not be found at ${ouilocation}. Have you updated the config?" 1>&2
read -p "Do you want to download it now [y/N]? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
wget https://standards-oui.ieee.org/oui/oui.txt -O "${ouilocation}"
else
echo "Aborted"
exit 1
fi
fi
if [[ $(find "${ouilocation}" -mtime +30 -print) ]]; then
echo "File ${ouilocation} is older than 30 days"
fi
if [ -z "${1}" ] ; then
echo 'No mac address specified, please do so as first argument' 1>&2