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