#!/bin/sh # # execute apt-get upate for update-watch # extract URL from sources.list.d/main.list URL=`grep "^rpm" /etc/apt/sources.list.d/main.list | head -1 | awk '{for(i=1;i<=NF;i++) {if ($i ~ /tp:/) print $i}}'` # check network connection if wget -q --spider $URL ; then # do apt-get update when network is available if [ -x /usr/bin/update-watch ]; then /usr/bin/apt-get update > /dev/null 2>&1 fi fi