#! /bin/bash

# script to retrive current versions of installed celestia packages.
#

#set -x


# list of package names to check.
PACKAGES=$( cat <<EOF
ags-celestia
ags-ins-reset-dmu
ags-install-scripts
ags-lpcusbcan2-fw
ags-lpcusbcan2-module
ags-pcan-lib
ags-pcan-module
ags-system-configuration
libcups2
libtalloc1
libwbclient0
samba
samba-common
update-inetd
EOF
)

for P in $PACKAGES; do

    # use dpkg -s to get package status, and extract only version info, and remove any new lines.
    RESULT=$(dpkg -s $P 2> /dev/null | grep -i version | sed -e "s/\n//g")
    # if package not installed, "$RESULT" will be "", so it'll be all good.
    printf "%s - %s\n" $P "$RESULT"

done

