mirror of
https://github.com/zuno/slackpkgplus
synced 2025-01-13 20:01:04 +01:00
Version 1.6.0 - 19/Dec/2015
- Added CACHEUPDATE. You can now speedup the slackpkg update by caching metadata files.
This commit is contained in:
parent
8d2885df9d
commit
29ee081622
6 changed files with 110 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Version 1.6.0 - 19/Dec/2015
|
||||||
|
- Added CACHEUPDATE. You can now speedup the slackpkg update by caching
|
||||||
|
metadata files.
|
||||||
|
|
||||||
Version 1.5.2 - 18/Dec/2015
|
Version 1.5.2 - 18/Dec/2015
|
||||||
- Fixed a missed $ROOT
|
- Fixed a missed $ROOT
|
||||||
- Added SHOWORDER option. It's a way to sort packages in dialog box to help
|
- Added SHOWORDER option. It's a way to sort packages in dialog box to help
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
Version 1.6.0 - 19/Dec/2015
|
||||||
|
- Added CACHEUPDATE. You can now speedup the slackpkg update by caching
|
||||||
|
metadata files.
|
||||||
|
|
||||||
Version 1.5.2 - 18/Dec/2015
|
Version 1.5.2 - 18/Dec/2015
|
||||||
- Fixed a missed $ROOT
|
- Fixed a missed $ROOT
|
||||||
- Added SHOWORDER option. It's a way to sort packages in dialog box to help
|
- Added SHOWORDER option. It's a way to sort packages in dialog box to help
|
||||||
|
|
20
src/README
20
src/README
|
@ -406,6 +406,23 @@ DOWNLOADCMD="aria2c -x 16 -s 16 --auto-file-renaming=false --allow-overwrite=tru
|
||||||
if you have proxy add
|
if you have proxy add
|
||||||
DOWNLOADCMD="aria2c --all-proxy=someproxy:8080 -x 16 -s 16 --auto-file-renaming=false --allow-overwrite=true -d / -o"
|
DOWNLOADCMD="aria2c --all-proxy=someproxy:8080 -x 16 -s 16 --auto-file-renaming=false --allow-overwrite=true -d / -o"
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
CACHEUPDATE Option
|
||||||
|
|
||||||
|
By default 'slackpkg update' download all metadata files (CHECKSUMS.md5, PACKAGES.TXT,
|
||||||
|
MANIFEST.bz2). When you use many and or large repositories, this may take a lot of
|
||||||
|
time and in most cases there are no news or news just in only one repository.
|
||||||
|
|
||||||
|
Enabling CACHEUPDATE slackpkg+ put a cache of metadatas in /var/lib/slackpkg/cache,
|
||||||
|
so everytime it just must to verify if there is a new version, otherwise it can use
|
||||||
|
the cached file.
|
||||||
|
|
||||||
|
Note that it works only with http repositories and does not work with proxies.
|
||||||
|
It uses 'curl' to download file headers to check if there is a new version of
|
||||||
|
the file.
|
||||||
|
|
||||||
|
Set CACHEUPDATE=on to enable it. Default is 'off'
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
@ -455,6 +472,9 @@ SENSITIVE_SEARCH=off slackpkg search mplayer
|
||||||
Note tha 'slackpkg install' still remains case sensitive, so you must use
|
Note tha 'slackpkg install' still remains case sensitive, so you must use
|
||||||
slackpkg install MPlayer
|
slackpkg install MPlayer
|
||||||
|
|
||||||
|
WARNING: do NOT run 'slackpkg search slackpkg' with SENSITIVE_SEARCH=on. It
|
||||||
|
may take a very lot of time!
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
SHOWORDER
|
SHOWORDER
|
||||||
|
|
|
@ -21,6 +21,7 @@ if [ -e $CONF/slackpkgplus.conf ];then
|
||||||
EXTDOWNLOADCMD=$DOWNLOADCMD
|
EXTDOWNLOADCMD=$DOWNLOADCMD
|
||||||
EXTTAG_PRIORITY=$TAG_PRIORITY
|
EXTTAG_PRIORITY=$TAG_PRIORITY
|
||||||
EXTSENSITIVE_SEARCH=$SENSITIVE_SEARCH
|
EXTSENSITIVE_SEARCH=$SENSITIVE_SEARCH
|
||||||
|
EXTCACHEUPDATE=$CACHEUPDATE
|
||||||
|
|
||||||
. $CONF/slackpkgplus.conf
|
. $CONF/slackpkgplus.conf
|
||||||
|
|
||||||
|
@ -33,6 +34,7 @@ if [ -e $CONF/slackpkgplus.conf ];then
|
||||||
DOWNLOADCMD=${EXTDOWNLOADCMD:-$DOWNLOADCMD}
|
DOWNLOADCMD=${EXTDOWNLOADCMD:-$DOWNLOADCMD}
|
||||||
TAG_PRIORITY=${EXTTAG_PRIORITY:-$TAG_PRIORITY}
|
TAG_PRIORITY=${EXTTAG_PRIORITY:-$TAG_PRIORITY}
|
||||||
SENSITIVE_SEARCH=${EXTSENSITIVE_SEARCH:-$SENSITIVE_SEARCH}
|
SENSITIVE_SEARCH=${EXTSENSITIVE_SEARCH:-$SENSITIVE_SEARCH}
|
||||||
|
CACHEUPDATE=${EXTCACHEUPDATE:-$CACHEUPDATE}
|
||||||
|
|
||||||
USEBLACKLIST=true
|
USEBLACKLIST=true
|
||||||
if [ "$USEBL" == "0" ];then
|
if [ "$USEBL" == "0" ];then
|
||||||
|
@ -51,7 +53,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SPKGPLUS_VERSION="1.5.2"
|
SPKGPLUS_VERSION="1.6.0"
|
||||||
VERSION="$VERSION / slackpkg+ $SPKGPLUS_VERSION"
|
VERSION="$VERSION / slackpkg+ $SPKGPLUS_VERSION"
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,7 +65,16 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
touch $WORKDIR/install.log
|
touch $WORKDIR/install.log
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$CMD" == "update" ];then
|
||||||
|
ANSWER="Y"
|
||||||
|
fi
|
||||||
|
|
||||||
function cleanup(){
|
function cleanup(){
|
||||||
|
if [ "$CMD" == "update" ];then
|
||||||
|
if [ "$ANSWER" != "Y" ] && [ "$ANSWER" != "y" ]; then
|
||||||
|
touch $WORKDIR/pkglist
|
||||||
|
fi
|
||||||
|
fi
|
||||||
[ "$SPINNING" = "off" ] || tput cnorm
|
[ "$SPINNING" = "off" ] || tput cnorm
|
||||||
if [ "$DELALL" = "on" ] && [ "$NAMEPKG" != "" ]; then
|
if [ "$DELALL" = "on" ] && [ "$NAMEPKG" != "" ]; then
|
||||||
rm $CACHEPATH/$NAMEPKG &>/dev/null
|
rm $CACHEPATH/$NAMEPKG &>/dev/null
|
||||||
|
@ -960,6 +971,59 @@ function showlist() {
|
||||||
|
|
||||||
|
|
||||||
} # END wgetdebug()
|
} # END wgetdebug()
|
||||||
|
function cached_downloader(){
|
||||||
|
local SRCURL
|
||||||
|
local CACHEFILE
|
||||||
|
local SRCBASE
|
||||||
|
SRCURL=$2
|
||||||
|
SRCBASE=$(basename $SRCURL)
|
||||||
|
CACHEFILE=$(echo $SRCURL|md5sum|awk '{print $1}')
|
||||||
|
|
||||||
|
case $SRCBASE in
|
||||||
|
CHECKSUMS.md5) TOCACHE=1 ;;
|
||||||
|
MANIFEST.bz2) TOCACHE=1 ;;
|
||||||
|
PACKAGES.TXT) TOCACHE=1 ;;
|
||||||
|
*) TOCACHE=0 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ $TOCACHE -eq 1 ];then
|
||||||
|
echo
|
||||||
|
echo "=== check cache: $SRCURL ==="
|
||||||
|
echo -n "headers.. "
|
||||||
|
curl --location --head $SRCURL 2>/dev/null|grep -v ^Date:|sed 's/
//' > $TMPDIR/cache.head
|
||||||
|
echo "Url: $SRCURL" >> $TMPDIR/cache.head
|
||||||
|
grep -q "200 OK" $TMPDIR/cache.head || echo "Header or Url Invalid!!! (`date`)"
|
||||||
|
[ $VERBOSE -eq 3 ]&&cat $TMPDIR/cache.head|sed 's/^/ /'
|
||||||
|
if [ -e $CACHEDIR/$CACHEFILE -a -e $CACHEDIR/$CACHEFILE.head ];then
|
||||||
|
echo "Is cached.. "
|
||||||
|
[ $VERBOSE -eq 3 ]&&cat $CACHEDIR/$CACHEFILE.head|sed 's/^/ /'
|
||||||
|
if diff $CACHEDIR/$CACHEFILE.head $TMPDIR/cache.head >/dev/null;then
|
||||||
|
echo "Cache valid! If not please remove manually $CACHEDIR/$CACHEFILE !"
|
||||||
|
cp $CACHEDIR/$CACHEFILE $1
|
||||||
|
return $?
|
||||||
|
fi
|
||||||
|
echo -n "Invalid.. "
|
||||||
|
rm -f $CACHEDIR/$CACHEFILE $CACHEDIR/$CACHEFILE.head
|
||||||
|
fi
|
||||||
|
echo "Download file.. "
|
||||||
|
$CACHEDOWNLOADER $1 $SRCURL
|
||||||
|
ERR=$?
|
||||||
|
if [ "$(ls -l $1 2>/dev/null|awk '{print $5}')" == "$(grep Content-Length: $TMPDIR/cache.head|awk '{print $2}')" ];then
|
||||||
|
echo "Caching it!"
|
||||||
|
cp $1 $CACHEDIR/$CACHEFILE
|
||||||
|
cp $TMPDIR/cache.head $CACHEDIR/$CACHEFILE.head
|
||||||
|
else
|
||||||
|
echo "NOT cacheable!"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo "=== no caching for $SRCURL ==="
|
||||||
|
$CACHEDOWNLOADER $1 $SRCURL
|
||||||
|
ERR=$?
|
||||||
|
fi
|
||||||
|
return $ERR
|
||||||
|
|
||||||
|
} # END cached_downloader()
|
||||||
|
|
||||||
if [ ! -z "$DOWNLOADCMD" ];then
|
if [ ! -z "$DOWNLOADCMD" ];then
|
||||||
DOWNLOADER="$DOWNLOADCMD"
|
DOWNLOADER="$DOWNLOADCMD"
|
||||||
|
@ -976,6 +1040,15 @@ function showlist() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$CMD" == "update" -a "$CACHEUPDATE" == "on" ];then
|
||||||
|
CACHEDOWNLOADER=$DOWNLOADER
|
||||||
|
CACHEDIR=$WORKDIR/cache
|
||||||
|
mkdir -p $CACHEDIR
|
||||||
|
find $CACHEDIR -mtime +30 -exec rm -f {} \;
|
||||||
|
DOWNLOADER="cached_downloader"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Global variable required by givepriority()
|
# Global variable required by givepriority()
|
||||||
#
|
#
|
||||||
PRIORITYIDX=1
|
PRIORITYIDX=1
|
||||||
|
|
|
@ -22,6 +22,10 @@ WGETOPTS="--timeout=20 --tries=2"
|
||||||
# at /usr/doc/slackpkg+-*/README
|
# at /usr/doc/slackpkg+-*/README
|
||||||
#DOWNLOADCMD="wget -O"
|
#DOWNLOADCMD="wget -O"
|
||||||
|
|
||||||
|
# Use the cache for metadata files (CHECKSUMS.md5,...). Enable it (on) to speedup the slackpkg update
|
||||||
|
# process by downloading just new files (see README). Disabled by default (off)
|
||||||
|
CACHEUPDATE=off
|
||||||
|
|
||||||
# Enable (on) / Disable (off) notification events (see notifymsg.conf)
|
# Enable (on) / Disable (off) notification events (see notifymsg.conf)
|
||||||
#ENABLENOTIFY=off
|
#ENABLENOTIFY=off
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,10 @@ WGETOPTS="--timeout=20 --tries=2"
|
||||||
# at /usr/doc/slackpkg+-*/README
|
# at /usr/doc/slackpkg+-*/README
|
||||||
#DOWNLOADCMD="wget -O"
|
#DOWNLOADCMD="wget -O"
|
||||||
|
|
||||||
|
# Use the cache for metadata files (CHECKSUMS.md5,...). Enable it (on) to speedup the slackpkg update
|
||||||
|
# process by downloading just new files (see README). Disabled by default (off)
|
||||||
|
CACHEUPDATE=off
|
||||||
|
|
||||||
# Enable (on) / Disable (off) notification events (see notifymsg.conf)
|
# Enable (on) / Disable (off) notification events (see notifymsg.conf)
|
||||||
#ENABLENOTIFY=off
|
#ENABLENOTIFY=off
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue