X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/08cfc005c3529d4ff63d229b05d75c6ceb88225b..ebace0167f2a5b5b62d57b288f6059743e9a2fa7:/dselect/update diff --git a/dselect/update b/dselect/update index 904648428..66b942bcb 100755 --- a/dselect/update +++ b/dselect/update @@ -2,34 +2,44 @@ set -e # Get the configuration from /etc/apt/apt.conf +CLEAN="prompt" OPTS="-f" APTGET="/usr/bin/apt-get" APTCACHE="/usr/bin/apt-cache" DPKG="/usr/bin/dpkg" +DPKG_OPTS="--admindir=$1" +APT_OPT0="-oDir::State::status=$1/status" +APT_OPT1="-oDPkg::Options::=$DPKG_OPTS" 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` +PROMPT="false" +RES=`apt-config shell CLEAN DSelect::Clean OPTS DSelect::UpdateOptions \ + DPKG Dir::Bin::dpkg/f APTGET Dir::Bin::apt-get/f \ + APTCACHE Dir::Bin::apt-cache/f CACHEDIR Dir::Cache/d \ + PROMPT DSelect::PromptAfterUpdate/b` 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 +STATUS=1 +if $APTGET $OPTS "$APT_OPT0" "$APT_OPT1" update +then + echo "Merging Available information" + rm -f $CACHEDIR/available + $APTCACHE dumpavail > $CACHEDIR/available + $DPKG "$DPKG_OPTS" --update-avail $CACHEDIR/available + rm -f $CACHEDIR/available + + case "$CLEAN" in + Pre-Auto|PreAuto|pre-auto) + $APTGET "$APT_OPT0" "$APT_OPT1" autoclean;; + esac -echo "Merging Available information" -rm -f /var/cache/apt/available -$APTCACHE dumpavail > $CACHEDIR/available -$DPKG --update-avail $CACHEDIR/available -rm -f $CACHEDIR/available + STATUS=0 +fi -if [ $PROMPT = "yes" ]; then +if [ x$PROMPT = "xtrue" ]; then echo "Press enter to continue." && read RES; fi -exit $FAILED +exit $STATUS