]> git.saurik.com Git - apt.git/blame - dselect/update
Merge with Michael
[apt.git] / dselect / update
CommitLineData
a8c2695b 1#!/bin/bash
7a1b1f8b
AL
2set -e
3
a8c2695b
AL
4# Set the textdomain for the translations using $"..."
5TEXTDOMAIN="apt"
6
7a1b1f8b 7# Get the configuration from /etc/apt/apt.conf
ebace016 8CLEAN="prompt"
7a1b1f8b
AL
9OPTS="-f"
10APTGET="/usr/bin/apt-get"
11APTCACHE="/usr/bin/apt-cache"
12DPKG="/usr/bin/dpkg"
b2e465d6
AL
13DPKG_OPTS="--admindir=$1"
14APT_OPT0="-oDir::State::status=$1/status"
15APT_OPT1="-oDPkg::Options::=$DPKG_OPTS"
7a1b1f8b 16CACHEDIR="/var/cache/apt"
b2e465d6 17PROMPT="false"
ebace016
AL
18RES=`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
22eval $RES
23
5b8c90bf
AL
24# It looks slightly ugly to have a double / in the dpkg output
25CACHEDIR=`echo $CACHEDIR | sed -e "s|/$||"`
26
ebace016
AL
27STATUS=1
28if $APTGET $OPTS "$APT_OPT0" "$APT_OPT1" update
29then
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
42fi
c217f42a 43
b2e465d6 44if [ x$PROMPT = "xtrue" ]; then
a8c2695b 45 echo $"Press enter to continue." && read RES;
c217f42a
AL
46fi
47
ebace016 48exit $STATUS