Commit 10a94f91 authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

create-helper: Check input of -p option

Check if the provided file exists and is an snf-image-helper package
parent 12ae4002
......@@ -66,6 +66,26 @@ while getopts "d:hp:y" opt; do
esac
done
if [ -n "$HELPER_PKG" ]; then
if [ ! -f "$HELPER_PKG" ]; then
log_error "File: \`$HELPER_PKG' does not exist"
exit 1
fi
set +e
name=$(dpkg-deb -W --showformat='${Package}\n' "$HELPER_PKG" 2> /dev/null)
ret=$?
set -e
if [ $ret -ne 0 ]; then
log_error "File \`$HELPER_PKG' is not a debian package"
exit 1
fi
if [ "$name" != snf-image-helper ]; then
log_error "File \`$HELPER_PKG' is not an snf-image-helper package"
exit 1
fi
fi
echo
echo "This is the helper image creation script for snf-image."
echo "If you don't know what to do, use \`-h'."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment