File run-update-pkgs.sh of Package kolab-scripts
#!/bin/bash
# KPS_CHECK_ORDER: 40
# (c) 2013 Aeneas Jaissle
# (c) 2013 Richard Bos
echo -n "Checking for Kolab updates... "
DATE=$(date +%Y-%m-%d)
if [[ "$FORCE_UPDATE" == yes ]]; then
LAST_REFRESH_DATE=0
else
LAST_REFRESH_DATE=$(stat -c %z $(ls -tr $(find /var/cache/zypp/raw -name "*xml") | tail -1) | awk '{print $1}')
fi
if [[ "$DATE" == "$LAST_REFRESH_DATE" ]]; then
# Check for Kolab updates was already done today
echo OK
else
echo # set cursor on the next line
if [[ "$INTERNET_CONNECTIVITY" != "no" ]]; then
echo " Refreshing repository list..."
zypper clean >/dev/null
zypper refresh
KOLAB_PCKS=$(zypper list-updates -a | grep kolab | tr -d " " | cut -d"|" -f3)
if [[ -z "$KOLAB_PCKS" ]]; then
echo " Kolab packages are up to date"
else
echo " Kolab related updates available:"
echo " " $KOLAB_PCKS
read -p " Do you want to update these packages now? [<y>|n] " ANSWER
if [[ $ANSWER != 'n' ]] ; then
echo " Updating Kolab packages..."
zypper install $KOLAB_PCKS
fi
fi
else
echo " Skipping check for Kolab updates as internet connectivity"
echo " has been disabled (INTERNET_CONNECTIVITY=no)"
fi
fi