An install script (for Microsoft® SQL Server® ODBC Driver 1.0 for Linux) has been written for Redhat with RPM
It uses this code to check if certain packages are installed
req_libs=( glibc e2fsprogs krb5-libs openssl )
for lib in ${req_libs[@]}
do
local present=$(rpm -q -a $lib) >> $log_file 2>&1
if [ "$present" == "" ]; then
log "The $lib library was not found installed in the RPM database."
log "See README for which libraries are required for the $driver_name."
return 1;
fi
done
I have overcome this problem by knowing/trusting that the libraries are installed and simply removing the test, but I'd like to tidy this up now.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With