summaryrefslogtreecommitdiffstats
path: root/dselect/update
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 06:14:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 06:14:41 +0000
commit549a391d6438e828001eeeaf235b080c054a7bf3 (patch)
tree1bb6b1ea5987fa167a1d13abe82209cc882dd94b /dselect/update
parentInitial commit. (diff)
downloadapt-549a391d6438e828001eeeaf235b080c054a7bf3.tar.xz
apt-549a391d6438e828001eeeaf235b080c054a7bf3.zip
Adding upstream version 2.2.4.upstream/2.2.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dselect/update')
-rwxr-xr-xdselect/update48
1 files changed, 48 insertions, 0 deletions
diff --git a/dselect/update b/dselect/update
new file mode 100755
index 0000000..0ab317e
--- /dev/null
+++ b/dselect/update
@@ -0,0 +1,48 @@
+#!/bin/bash
+set -e
+
+# Set the textdomain for the translations using $"..."
+TEXTDOMAIN="apt"
+
+# Get the configuration from /etc/apt/apt.conf
+CLEAN="prompt"
+OPTS=""
+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="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|/$||"`
+
+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
+
+ STATUS=0
+fi
+
+if [ x$PROMPT = "xtrue" ]; then
+ echo $"Press [Enter] to continue." && read RES;
+fi
+
+exit $STATUS