summaryrefslogtreecommitdiff
path: root/dselect/update
blob: 904648428191ce1e718d38a82059faba5c00b431 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
set -e

# Get the configuration from /etc/apt/apt.conf
OPTS="-f"
APTGET="/usr/bin/apt-get"
APTCACHE="/usr/bin/apt-cache"
DPKG="/usr/bin/dpkg"
CACHEDIR="/var/cache/apt"
PROMPT="no"
RES=`apt-config shell OPTS DSelect::UpdateOptions \
      DPKG Dir::Bin::dpkg APTGET Dir::Bin::apt-get \
      APTCACHE Dir::Bin::apt-cache CACHEDIR Dir::Cache \
      PROMPT DSelect::PromptAfterUpdate`
eval $RES

# It looks slightly ugly to have a double / in the dpkg output
CACHEDIR=`echo $CACHEDIR | sed -e "s|/$||"`

set +e
FAILED=0
$APTGET $OPTS update || FAILED=1
set -e

echo "Merging Available information"
rm -f /var/cache/apt/available
$APTCACHE dumpavail > $CACHEDIR/available
$DPKG --update-avail $CACHEDIR/available
rm -f $CACHEDIR/available

if [ $PROMPT = "yes" ]; then
   echo "Press enter to continue." && read RES;
fi

exit $FAILED