1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
#!/bin/sh
set -e
is_installed()
{
local pkg="$1"
dpkg-query -s "$pkg" >/dev/null 2>&1 || return 1
local status="$(dpkg-query -W -f '${Status}' $pkg)"
test "$status" != "unknown ok not-installed" || return 1
test "$status" != "deinstall ok config-files" || return 1
return 0
}
PKGS=""
if [ "$PIUPARTS_DISTRIBUTION" = "jessie-backports" ]; then
# downgrading them from jessie-backports to jessie during removal
# is problematic due to triggers
! is_installed systemd || PKGS="${PKGS} systemd"
! is_installed udev || PKGS="${PKGS} udev"
fi
if [ -n "$PKGS" ]; then
apt-get -y -t "$PIUPARTS_DISTRIBUTION" install $PKGS
fi
|