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