Gettext stuff
[ntk/apt.git] / dselect / update
CommitLineData
7a1b1f8b
AL
1#!/bin/sh
2set -e
3
4# Get the configuration from /etc/apt/apt.conf
ebace016 5CLEAN="prompt"
7a1b1f8b
AL
6OPTS="-f"
7APTGET="/usr/bin/apt-get"
8APTCACHE="/usr/bin/apt-cache"
9DPKG="/usr/bin/dpkg"
b2e465d6
AL
10DPKG_OPTS="--admindir=$1"
11APT_OPT0="-oDir::State::status=$1/status"
12APT_OPT1="-oDPkg::Options::=$DPKG_OPTS"
7a1b1f8b 13CACHEDIR="/var/cache/apt"
b2e465d6 14PROMPT="false"
ebace016
AL
15RES=`apt-config shell CLEAN DSelect::Clean OPTS DSelect::UpdateOptions \
16 DPKG Dir::Bin::dpkg/f APTGET Dir::Bin::apt-get/f \
17 APTCACHE Dir::Bin::apt-cache/f CACHEDIR Dir::Cache/d \
18 PROMPT DSelect::PromptAfterUpdate/b`
7a1b1f8b
AL
19eval $RES
20
5b8c90bf
AL
21# It looks slightly ugly to have a double / in the dpkg output
22CACHEDIR=`echo $CACHEDIR | sed -e "s|/$||"`
23
ebace016
AL
24STATUS=1
25if $APTGET $OPTS "$APT_OPT0" "$APT_OPT1" update
26then
27 echo "Merging Available information"
28 rm -f $CACHEDIR/available
29 $APTCACHE dumpavail > $CACHEDIR/available
30 $DPKG "$DPKG_OPTS" --update-avail $CACHEDIR/available
31 rm -f $CACHEDIR/available
32
33 case "$CLEAN" in
34 Pre-Auto|PreAuto|pre-auto)
35 $APTGET "$APT_OPT0" "$APT_OPT1" autoclean;;
36 esac
7a1b1f8b 37
ebace016
AL
38 STATUS=0
39fi
c217f42a 40
b2e465d6 41if [ x$PROMPT = "xtrue" ]; then
c217f42a
AL
42 echo "Press enter to continue." && read RES;
43fi
44
ebace016 45exit $STATUS