Kaynağa Gözat

Add another DSelect::Clean option: pre-auto, which runs...
Author: bod
Date: 2001-03-13 01:45:36 GMT
Add another DSelect::Clean option: pre-auto, which runs autoclean after
a successful update, to provide space for downloading newer packages.

Arch Librarian 22 yıl önce
ebeveyn
işleme
ebace0167f
1 değiştirilmiş dosya ile 21 ekleme ve 14 silme
  1. 21 14
      dselect/update

+ 21 - 14
dselect/update

@@ -2,6 +2,7 @@
 set -e
 set -e
 
 
 # Get the configuration from /etc/apt/apt.conf
 # Get the configuration from /etc/apt/apt.conf
+CLEAN="prompt"
 OPTS="-f"
 OPTS="-f"
 APTGET="/usr/bin/apt-get"
 APTGET="/usr/bin/apt-get"
 APTCACHE="/usr/bin/apt-cache"
 APTCACHE="/usr/bin/apt-cache"
@@ -11,28 +12,34 @@ APT_OPT0="-oDir::State::status=$1/status"
 APT_OPT1="-oDPkg::Options::=$DPKG_OPTS"
 APT_OPT1="-oDPkg::Options::=$DPKG_OPTS"
 CACHEDIR="/var/cache/apt"
 CACHEDIR="/var/cache/apt"
 PROMPT="false"
 PROMPT="false"
-RES=`apt-config shell 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`
+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
 eval $RES
 
 
 # It looks slightly ugly to have a double / in the dpkg output
 # It looks slightly ugly to have a double / in the dpkg output
 CACHEDIR=`echo $CACHEDIR | sed -e "s|/$||"`
 CACHEDIR=`echo $CACHEDIR | sed -e "s|/$||"`
 
 
-set +e
-FAILED=0
-$APTGET $OPTS "$APT_OPT0" "$APT_OPT1" 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 $CACHEDIR/available
-$APTCACHE dumpavail > $CACHEDIR/available
-$DPKG "$DPKG_OPTS" --update-avail $CACHEDIR/available
-rm -f $CACHEDIR/available
+    STATUS=0
+fi
 
 
 if [ x$PROMPT = "xtrue" ]; then
 if [ x$PROMPT = "xtrue" ]; then
    echo "Press enter to continue." && read RES;
    echo "Press enter to continue." && read RES;
 fi
 fi
 
 
-exit $FAILED
+exit $STATUS