]> git.saurik.com Git - apt.git/blob - dselect/update
Gettext stuff
[apt.git] / dselect / update
1 #!/bin/sh
2 set -e
3
4 # Get the configuration from /etc/apt/apt.conf
5 CLEAN="prompt"
6 OPTS="-f"
7 APTGET="/usr/bin/apt-get"
8 APTCACHE="/usr/bin/apt-cache"
9 DPKG="/usr/bin/dpkg"
10 DPKG_OPTS="--admindir=$1"
11 APT_OPT0="-oDir::State::status=$1/status"
12 APT_OPT1="-oDPkg::Options::=$DPKG_OPTS"
13 CACHEDIR="/var/cache/apt"
14 PROMPT="false"
15 RES=`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`
19 eval $RES
20
21 # It looks slightly ugly to have a double / in the dpkg output
22 CACHEDIR=`echo $CACHEDIR | sed -e "s|/$||"`
23
24 STATUS=1
25 if $APTGET $OPTS "$APT_OPT0" "$APT_OPT1" update
26 then
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
37
38 STATUS=0
39 fi
40
41 if [ x$PROMPT = "xtrue" ]; then
42 echo "Press enter to continue." && read RES;
43 fi
44
45 exit $STATUS