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