Changed handling of the no-dowload case
[ntk/apt.git] / dselect / update
index 3260278..9195912 100755 (executable)
@@ -14,16 +14,22 @@ RES=`apt-config shell OPTS DSelect::UpdateOptions \
       PROMPT DSelect::PromptAfterUpdate`
 eval $RES
 
-$APTGET $OPTS update
+# 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
+rm -f $CACHEDIR/available
 $APTCACHE dumpavail > $CACHEDIR/available
 $DPKG --update-avail $CACHEDIR/available
 rm -f $CACHEDIR/available
 
-if [ $PROMPT == "yes" ]; then
+if [ $PROMPT = "yes" ]; then
    echo "Press enter to continue." && read RES;
 fi
 
-exit 0
+exit $FAILED