#!/bin/sh # Copyright (C) 2008 Richard Hughes # # Some material taken from yum-cron, Copyright 2007 Alec Habig # # Licensed under the GNU General Public License Version 2 # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. [ -f /etc/sysconfig/packagekit-background ] && . /etc/sysconfig/packagekit-background # are we disabled? if [ "$ENABLED" == "no" ]; then exit 1 fi # set default for SYSTEMNAME [ -z "$SYSTEMNAME" ] && SYSTEMNAME=$(hostname) PKTMP=$(mktemp /var/run/packagekit-cron.XXXXXX) # wait a random amount of time to avoid hammering the servers sleep $RANDOM # do action if [ "$CHECK_ONLY" == "yes" ]; then pkcon get updates > $PKTMP else pkcon update-system > $PKTMP fi # send email if [ -n "$MAILTO" ]; then mail -s "System updates available: $SYSTEMNAME" $MAILTO < $PKTMP else # default behavior is to use cron's internal mailing of output from cron-script cat $PKTMP fi rm -f $PKTMP