| 1 |
#!/bin/sh |
| 2 |
# dctrl-tools - Debian control file inspection tools |
| 3 |
# Copyright (C) 2004 Antti-Juhani Kaijanaho |
| 4 |
# |
| 5 |
# This program is free software; you can redistribute it and/or modify |
| 6 |
# it under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation; either version 2 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# This program is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with this program; if not, write to the Free Software |
| 17 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 |
|
| 19 |
set -e |
| 20 |
|
| 21 |
aptcache=/usr/bin/apt-cache |
| 22 |
|
| 23 |
if [ $# -ge 1 ] |
| 24 |
then |
| 25 |
if [ "x$@" = "x--version" ] |
| 26 |
then |
| 27 |
echo "update-avail (dctrl-tools) VERSION" |
| 28 |
else |
| 29 |
echo "Usage:" |
| 30 |
echo " $0" |
| 31 |
echo " $0 --version" |
| 32 |
echo " $0 --help" |
| 33 |
fi |
| 34 |
exit 0 |
| 35 |
fi |
| 36 |
|
| 37 |
if [ `id -u` -ne "0" ] |
| 38 |
then |
| 39 |
echo "$0: root privileges are required" |
| 40 |
exit 1 |
| 41 |
fi |
| 42 |
|
| 43 |
if [ ! -x $aptcache ] |
| 44 |
then |
| 45 |
echo "$0: $aptcache not executable, aborting" 1>&2 |
| 46 |
exit 1 |
| 47 |
fi |
| 48 |
|
| 49 |
tf=`mktemp -t apt-available.XXXXXX` || exit 1 |
| 50 |
echo -n "Merging available database in $tf..." |
| 51 |
$aptcache dumpavail >> $tf |
| 52 |
echo "done." |
| 53 |
dpkg --update-avail $tf |
| 54 |
rm $tf |