1) Finding the right packages
In Ubuntu/Debian, typically library packages are prepended with "lib" rather than suffixed. Development packages are usually just suffixed with "-dev" rather than "-devel"
If you are unsure of what the equivalent package is named, you can always do this:
sudo apt-get update
apt-cache search <packagename>
...and do not include the "lib" or "dev" portions in your search and you will get decent results. From there you can manually determine what the correct package is that you are looking for.
2) Finding installed packages
You can use "dpkg -s" and it will work, although from my understanding of what "rpm -qa" outputs, you are propably wanting something less verbose. "dpkg-query -l " piped into "grep " will output the package info on one line and should be much easier to read through.
Here is what the equivalent portion of the script would look like(with the proper package names and the log_file output on a separate line to work properly):
#!/bin/bash
function stack_install()
{
log_file="$HOME/Desktop/stackoverflow/stack-log.txt"
req_libs=( libc6 e2fsprogs libkrb5-3 openssl )
for lib in ${req_libs[@]}
do
local present=$(dpkg-query -l "$lib" | grep "$lib" 2>/dev/null)
echo "$present" >> "$log_file"
if [ "$present" == "" ]; then
echo "The $lib library was not found installed in the dpkg database."
echo "See README for which libraries are required for the $driver_name."
return 1;
fi
done
}
stack_install