[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dpkg cassé?



Dans un message du 07 jun à 17:30, Charles écrivait :
> Peux-tu me dire en deux mots ce qui n'allait pas? dpkg m'a ensuite dit que
> dpkg était cassé. C'est la source du problème??

J'avoue que je n'en ai pas la moindre idée, j'ai vu le fix avant même
d'avoir le problème, ça m'a évité de me poser des questions. Par contre,
je peux te donner le diff :

--- /usr/lib/dpkg/methods/apt/update.old	Wed Jun  6 15:18:12 2001
+++ /usr/lib/dpkg/methods/apt/update	Wed Jun  6 15:18:18 2001
@@ -2,6 +2,7 @@
 set -e
 
 # Get the configuration from /etc/apt/apt.conf
+CLEAN="prompt"
 OPTS="-f"
 APTGET="/usr/bin/apt-get"
 APTCACHE="/usr/bin/apt-cache"
@@ -11,28 +12,36 @@
 APT_OPT1="-oDPkg::Options::=$DPKG_OPTS"
 CACHEDIR="/var/cache/apt"
 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
 
 # It looks slightly ugly to have a double / in the dpkg output
 CACHEDIR=`echo $CACHEDIR | sed -e "s|/$||"`
 
-set +e
-FAILED=0
-$APTGET $OPTS "$APT_OPT0" "$APT_OPT1" update || FAILED=1
-set -e
-
-echo "Merging Available information"
-rm -f $CACHEDIR/available
-$APTCACHE dumpavail > $CACHEDIR/available
-$DPKG "$DPKG_OPTS" --update-avail $CACHEDIR/available
-rm -f $CACHEDIR/available
+STATUS=1
+if $APTGET $OPTS "$APT_OPT0" "$APT_OPT1" update
+then
+    echo "Merging Available information"
+    rm -f $CACHEDIR/available
+    $APTCACHE dumpavail | sed '/^[A-Za-z]*:/{s/(  */(/g;s/  *)/)/g;}' \
+	> $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
+
+    STATUS=0
+fi
 
 if [ x$PROMPT = "xtrue" ]; then
    echo "Press enter to continue." && read RES;
 fi
 
-exit $FAILED
+exit $STATUS

-- 
Guillaume Morin <guillaume@morinfr.org>

      A part of me left that only you knew will never be understood (RHCP)



Reply to: