2021-10-13 21:11:27 -07:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-10-16 21:17:55 -07:00
|
|
|
# Fail on any error.
|
|
|
|
set -e
|
|
|
|
|
2021-10-13 21:11:27 -07:00
|
|
|
packages=$1
|
|
|
|
|
|
|
|
echo -n "* Validating action arguments... ";
|
|
|
|
if [ "$packages" == "" ]; then
|
|
|
|
echo "aborted."
|
|
|
|
echo "* Packages argument cannot be empty." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
for package in $packages; do
|
|
|
|
apt-cache search ^$package$ | grep $package > /dev/null
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "aborted."
|
|
|
|
echo "* Package '$package' not found." >&2
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo "done."
|