Bug 9454: Use placeholders when adding basket
[koha.git] / install_misc / ubuntu-pkg-check.sh
blob75bec3f32066230ffd9afd99170a1bf57d4eb71f
1 #!/bin/sh
3 # determine what directory this script is in, because the packages files
4 # should be there too.
5 DIR=`dirname $0`
7 #determine which vbersion of ubuntu
8 VERSION=`lsb_release -r | cut -f2 -d' '`
9 UBUNTU_PACKAGES=$DIR/ubuntu.$VERSION.packages
11 # sanity checks
12 if [ ! -e $UBUNTU_PACKAGES ]; then
13 echo "WARNING! We strongly recommend an LTS release."
14 UBUNTU_PACKAGES=$DIR/ubuntu.packages
16 echo "Using the $UBUNTU_PACKAGES file."
18 # main
19 UBUNTU_PACKAGES_LIST=`awk '{print $1}' $UBUNTU_PACKAGES | grep -v '^\s*#' | grep -v '^\s*$'`
20 for F in $UBUNTU_PACKAGES_LIST; do
21 UBUNTU_PKG_POLICY=`apt-cache policy $F 2> /dev/null | grep "Installed:"`
22 if [ "${#UBUNTU_PKG_POLICY}" -eq "0" ]; then
23 UBUNTU_PKG_POLICY="Installed: \(none\)\*"
25 UBUNTU_PKG_VERSION=`echo $UBUNTU_PKG_POLICY | awk '{print $2}'`
26 echo "$F = $UBUNTU_PKG_VERSION"
27 done