Skip to content

Commit

Permalink
cached_downloader now works with check-updates too.
Browse files Browse the repository at this point in the history
check-updates when running with VERBOSE=3 shows downloader outputs.
  • Loading branch information
zuno committed Jan 24, 2016
1 parent 9162eb5 commit 3f16140
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/slackpkgplus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
case $SRCBASE in
CHECKSUMS.md5|CHECKSUMS.md5.asc) TOCACHE=1 ; CURREPO=$(basename $1|sed -r -e "s/CHECKSUMS.md5-?//" -e "s/\.asc//") ;;
MANIFEST.bz2|PACKAGES.TXT) TOCACHE=1 ; CURREPO=$(basename $1|sed -e "s/-$SRCBASE//" -e "s/SLACKPKGPLUS_//");;
ChangeLog.txt) TOCACHE=0 ;;
ChangeLog.txt) TOCACHE=1 ;;
GPG-KEY) TOCACHE=0 ; CURREPO=${1/*gpgkey-tmp-/};;
FILELIST.TXT) TOCACHE=1 ;;
esac
Expand All @@ -383,15 +383,15 @@ if [ "$SLACKPKGPLUS" = "on" ];then
return $?
fi
echo -n ". " # ... .. -> cache older or corrupted
rm -f $CACHEDIR/$CACHEFILE $CACHEDIR/$CACHEFILE.head
rm -f $CACHEDIR/$CACHEFILE $CACHEDIR/$CACHEFILE.head 2>/dev/null
fi
echo " Downloading... " # ... -> needed # ... .. -> re-needed
$CACHEDOWNLOADER $1 $SRCURL
ERR=$?
echo
if [ "$(ls -l $1 2>/dev/null|awk '{print $5}')" == "$(grep Content-Length: $TMPDIR/cache.head|awk '{print $2}')" ];then
cp $1 $CACHEDIR/$CACHEFILE
cp $TMPDIR/cache.head $CACHEDIR/$CACHEFILE.head
cp $1 $CACHEDIR/$CACHEFILE 2>/dev/null
cp $TMPDIR/cache.head $CACHEDIR/$CACHEFILE.head 2>/dev/null
fi
else
echo " Downloading..." # .. -> tocache=0
Expand Down Expand Up @@ -1186,6 +1186,8 @@ if [ "$SLACKPKGPLUS" = "on" ];then

### =========================== MAIN ============================ ###

export LC_ALL=C

if [ "$DOWNLOADONLY" == "on" ];then
DELALL=off
DOWNLOAD_ALL=on
Expand Down Expand Up @@ -1342,7 +1344,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
fi
fi

if [ "$CMD" == "update" -a "$CACHEUPDATE" == "on" ];then
if [ "$CACHEUPDATE" == "on" ]&&[ "$CMD" == "update" -o "$CMD" == "check-updates" ];then
CACHEDOWNLOADER=$DOWNLOADER
CACHEDIR=$WORKDIR/cache
mkdir -p $CACHEDIR
Expand Down Expand Up @@ -1615,8 +1617,12 @@ if [ "$SLACKPKGPLUS" = "on" ];then
echo -n "" > ~/.slackpkg/updated-repos.txt

UPDATES=false

if ! checkchangelog 1>/dev/null 2>/dev/null; then
if [ $VERBOSE -eq 3 ];then
checkchangelog
else
checkchangelog >/dev/null 2>&1
fi
if [ $? -ne 0 ]; then

# -- Note:
# checkchangelog() download the ChangeLog.txt and stores it
Expand Down

0 comments on commit 3f16140

Please sign in to comment.