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