update 997 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. set -e
  3. # Get the configuration from /etc/apt/apt.conf
  4. OPTS="-f"
  5. APTGET="/usr/bin/apt-get"
  6. APTCACHE="/usr/bin/apt-cache"
  7. DPKG="/usr/bin/dpkg"
  8. DPKG_OPTS="--admindir=$1"
  9. APT_OPT0="-oDir::State::status=$1/status"
  10. APT_OPT1="-oDPkg::Options::=$DPKG_OPTS"
  11. CACHEDIR="/var/cache/apt"
  12. PROMPT="false"
  13. RES=`apt-config shell OPTS DSelect::UpdateOptions \
  14. DPKG Dir::Bin::dpkg/f APTGET Dir::Bin::apt-get/f \
  15. APTCACHE Dir::Bin::apt-cache/f CACHEDIR Dir::Cache/d \
  16. PROMPT DSelect::PromptAfterUpdate/b`
  17. eval $RES
  18. # It looks slightly ugly to have a double / in the dpkg output
  19. CACHEDIR=`echo $CACHEDIR | sed -e "s|/$||"`
  20. set +e
  21. FAILED=0
  22. $APTGET $OPTS "$APT_OPT0" "$APT_OPT1" update || FAILED=1
  23. set -e
  24. echo "Merging Available information"
  25. rm -f $CACHEDIR/available
  26. $APTCACHE dumpavail > $CACHEDIR/available
  27. $DPKG "$DPKG_OPTS" --update-avail $CACHEDIR/available
  28. rm -f $CACHEDIR/available
  29. if [ x$PROMPT = "xtrue" ]; then
  30. echo "Press enter to continue." && read RES;
  31. fi
  32. exit $FAILED