Version 0.9test1 - 26/Apr/2013

- added a priority system for repository and single packages
  - added gpg support
  - added explicit support for alienbob multilibs

Thanks to AlienBob and phenixia2003 (on LQ) for contributing
This commit is contained in:
Matteo Rossini 2013-04-26 09:30:00 +02:00
parent fd323deeea
commit c6f6704ee9
5 changed files with 209 additions and 21 deletions

View file

@ -1,3 +1,8 @@
Version 0.9test1 - 26/Apr/2013
- added a priority system for repository and single packages
- added gpg support
- added explicit support for alienbob multilibs
Version 0.3beta - 10/Oct/2012 Version 0.3beta - 10/Oct/2012
- Added slackware 14.0 in default configuration - Added slackware 14.0 in default configuration

1
THANKS Normal file
View file

@ -0,0 +1 @@
Thanks to AlienBob and phenixia2003 (on LQ) for contributing

View file

@ -7,15 +7,12 @@ Slackpkg+ is a plugin for slackpkg
You can add multiple repository to your list You can add multiple repository to your list
To install it copy: edit slackpkgplus.conf
uncomment one or more mirrors
slackpkg+.conf in /etc/slackpkg optionally set PKGS_PRIORITY to give priority order for packages presents in multiple repositories
slackpkg+.sh in /usr/libexec/slackpkg/functions.d/
edit slackpkg+.conf
uncomment one or more mirrors and add it in PRIORITYPLUS order
then launch then launch
slackpkg update gpg
slackpkg update slackpkg update

View file

@ -1,19 +1,40 @@
# Enable (on) / Disable (off) slackpkg+ # Enable (on) / Disable (off) slackpkg+
SLACKPKGPLUS=on SLACKPKGPLUS=on
# Define package search order # If two or more repositories contains some same packages, you can specify
PRIORITYPLUS=( zerouno slacky ) # from which repository you prefer to search it.
# The syntax is "<repository_name>:<package_name>"
# Accepts regular expressions. To give order to an entire repository use "<repository_name>:.*"
# Examples:
#PKGS_PRIORITY=( slacky:apache-ant alienbob:openjdk )
#
# If you want a multilib system, uncomment the multilib repository and set:
#PKGS_PRIORITY=( multilib:.* )
# Define mirrors # Define mirrors (uncomment one or more mirror)
# Note: You MUST disable gpg check if you select the 'salixext' or 'zerouno' !!!
#
MIRRORPLUS['alienbob']=http://connie.slackware.com/~alien/slackbuilds/ # Slackware 14.0 - x86_64
MIRRORPLUS['multilib']=http://taper.alienbase.nl/mirrors/people/alien/multilib/14.0/
MIRRORPLUS['alienbob']=http://taper.alienbase.nl/mirrors/people/alien/sbrepos/14.0/x86_64/
MIRRORPLUS['slacky']=http://repository.slacky.eu/slackware64-14.0/
MIRRORPLUS['salixos']=http://download.salixos.org/x86_64/14.0/
MIRRORPLUS['salixext']=http://people.salixos.org/ralvex/packages/x86_64/14.0/
MIRRORPLUS['zerouno']=http://www.z01.eu/repo-slack/slackware64-current/ # Slackware 14.0 - i386
#MIRRORPLUS['alienbob']=http://taper.alienbase.nl/mirrors/people/alien/sbrepos/14.0/x86/
#MIRRORPLUS['slacky']=http://repository.slacky.eu/slackware-14.0/
#MIRRORPLUS['salixos']=http://download.salixos.org/i486/14.0/
#MIRRORPLUS['salixext']=http://people.salixos.org/ralvex/packages/i486/14.0/
#MIRRORPLUS['slacky']=http://darkstar.ist.utl.pt/slackware/addon/slacky/slackware-13.37/ # Slackware current - x86_64
MIRRORPLUS['slacky']=http://darkstar.ist.utl.pt/slackware/addon/slacky/slackware64-14.0/ #MIRRORPLUS['multilib']=http://taper.alienbase.nl/mirrors/people/alien/multilib/current/
#MIRRORPLUS['slacky']=http://darkstar.ist.utl.pt/slackware/addon/slacky/slackware-13.37/ #MIRRORPLUS['zerouno']=http://www.z01.eu/repo-slack/slackware64-current/
#MIRRORPLUS['slacky']=http://darkstar.ist.utl.pt/slackware/addon/slacky/slackware64-13.37/ #MIRRORPLUS['slackel']=http://www.slackel.gr/repo/x86_64/current/
# Slackware current - i386
#MIRRORPLUS['slackel']=http://www.slackel.gr/repo/i486/current/

View file

@ -1,17 +1,50 @@
# Thanks to AlienBob and phenixia2003 (on LQ) for contributing
declare -A MIRRORPLUS declare -A MIRRORPLUS
if [ -e /etc/slackpkg/slackpkgplus.conf ];then if [ -e /etc/slackpkg/slackpkgplus.conf ];then
. /etc/slackpkg/slackpkgplus.conf . /etc/slackpkg/slackpkgplus.conf
fi fi
if [ "$SLACKPKGPLUS" = "on" ];then if [ "$SLACKPKGPLUS" = "on" ];then
# If CHECKGPG is "on", the system will FAIL the GPG signature of extra repository # If CHECKGPG is "on", the system will FAIL the GPG signature of extra repository
# Use MD5 check instead # Use MD5 check instead
CHECKGPG=off # CHECKGPG=off
REPOPLUS=${!MIRRORPLUS[*]} REPOPLUS=${!MIRRORPLUS[*]}
PRIORITY=( ${PRIORITY[*]} slackpkgplus_$(echo $REPOPLUS|sed 's/ / slackpkgplus_/g') ) PRIORITY=( ${PRIORITY[*]} slackpkgplus_$(echo $REPOPLUS|sed 's/ / slackpkgplus_/g') )
X86_64=$(ls /var/log/packages/aaa_base*x86_64*|head -1 2>/dev/null) # -- merge priorities from PKGS_PRIORITY with PRIORITY, as needed ...
if [ ! -z "$PKGS_PRIORITY" ] ; then
PREFIX=""
for pp in ${PKGS_PRIORITY[*]} ; do
repository=$(echo "$pp" | cut -f1 -d":")
package=$(echo "$pp" | cut -f2- -d":")
if [ ! -z "$repository" ] && [ ! -z "$package" ] ; then
if [ -z "$PREFIX" ] ; then
PREFIX=( slackpkgplus_${repository}:$package )
else
PREFIX=( ${PREFIX[*]} slackpkgplus_${repository}:$package )
fi
fi
done
[ ! -z "$PREFIX" ] && PRIORITY=( ${PREFIX[*]} ${PRIORITY[*]} )
fi
function checkgpg() {
gpg --verify ${1}.asc ${1} 2>/dev/null && echo "1" || echo "0"
if [ "$(basename $1)" == "CHECKSUMS.md5" ];then
for PREPO in $REPOPLUS;do
egrep -e ^[a-f0-9]{32} ${TMPDIR}/CHECKSUMS.md5-$PREPO|sed -r "s# \./# ./slackpkgplus_$PREPO/#" >> ${TMPDIR}/CHECKSUMS.md5
done
fi
}
function getfile(){ function getfile(){
local URLFILE local URLFILE
URLFILE=$1 URLFILE=$1
@ -22,20 +55,151 @@ if [ "$SLACKPKGPLUS" = "on" ];then
fi fi
$DOWNLOADER $2 $URLFILE $DOWNLOADER $2 $URLFILE
if [ $(basename $1) = "MANIFEST.bz2" ];then
if [ ! -s $2 ];then
echo -n|bzip2 -c >$2
fi
fi
if [ $(basename $1) = "CHECKSUMS.md5" ];then if [ $(basename $1) = "CHECKSUMS.md5" ];then
for PREPO in $REPOPLUS;do for PREPO in $REPOPLUS;do
$DOWNLOADER $2-tmp ${MIRRORPLUS[${PREPO/slackpkgplus_}]}CHECKSUMS.md5 $DOWNLOADER $2-$PREPO ${MIRRORPLUS[${PREPO/slackpkgplus_}]}CHECKSUMS.md5
egrep -e ^[a-f0-9]{32} $2-tmp|sed -r "s# \./# ./slackpkgplus_$PREPO/#" >> $2 done
fi
if [ $(basename $1) = "CHECKSUMS.md5.asc" ];then
for PREPO in $REPOPLUS;do
$DOWNLOADER ${TMPDIR}/CHECKSUMS.md5-$PREPO.asc ${MIRRORPLUS[${PREPO/slackpkgplus_}]}CHECKSUMS.md5.asc
if [ $? -eq 0 ];then
if [ $(checkgpg ${TMPDIR}/CHECKSUMS.md5-$PREPO) -ne 1 ];then
echo
echo " !!! F A T A L !!!"
echo " Repository '$PREPO' FAILS to check CHECKSUMS.md5 signature"
echo " The file may be corrupted or the gpg key may be not valid."
echo " Remember to import keys by launching 'slackpkg update gpg'."
echo
sleep 5
echo > ${TMPDIR}/CHECKSUMS.md5
fi
else
echo
echo " !!! W A R N I N G !!!"
echo " Repository '$PREPO' does NOT supports signature checking"
echo " You SHOULD to disable GPG check by setting 'CHECKGPG=off'"
echo " in /etc/slackpkg/slackpkg.conf"
echo
sleep 5
fi
done done
fi fi
if [ $(basename $1) = "ChangeLog.txt" ];then if [ $(basename $1) = "ChangeLog.txt" ];then
for PREPO in $REPOPLUS;do for PREPO in $REPOPLUS;do
$DOWNLOADER $2-tmp ${MIRRORPLUS[${PREPO/slackpkgplus_}]}ChangeLog.txt $DOWNLOADER $2-tmp ${MIRRORPLUS[${PREPO/slackpkgplus_}]}PACKAGES.TXT
echo $PREPO $(md5sum $2-tmp|awk '{print $1}') >>$2 echo $PREPO $(md5sum $2-tmp|awk '{print $1}') >>$2
rm $2-tmp rm $2-tmp
done done
fi fi
if [ $(basename $1) = "GPG-KEY" ];then
for PREPO in $REPOPLUS;do
$DOWNLOADER $2-tmp ${MIRRORPLUS[${PREPO/slackpkgplus_}]}GPG-KEY
if [ $? -eq 0 ];then
gpg --import $2-tmp
else
echo
echo " !!! W A R N I N G !!!"
echo " Repository '$PREPO' does NOT contains the GPG-KEY"
echo " You SHOULD to disable GPG check by setting 'CHECKGPG=off'"
echo " in /etc/slackpkg/slackpkg.conf"
echo
sleep 5
fi
rm $2-tmp
done
fi
} }
# Found packages in repository.
# This function selects the package from the higher priority
# repository directories.
#
# This Modified version supports enhanced priority rule (priority
# given to package(s) from a given repository). This kind of priority
# uses the following syntax :
#
# repository_name:pattern
#
#
function givepriority {
local DIR
local ARGUMENT=$1
local PKGDATA
local CPRIORITY
local DIR
local PKG
unset NAME
unset FULLNAME
unset PKGDATA
for CPRIORITY in ${PRIORITY[@]} ; do
[ "$PKGDATA" ] && break
if echo "$CPRIORITY " | grep -q "[a-zA-Z0-9]\+[:]" ; then
DIR=$(echo "$CPRIORITY" | cut -f1 -d":")
PAT=$(echo "$CPRIORITY" | cut -f2- -d":")
if echo "$ARGUMENT" | grep -q "$PAT" ; then
PKGDATA=( $(grep "^${DIR} ${ARGUMENT} " ${TMPDIR}/pkglist) )
fi
else
PKGDATA=( $(grep "^${CPRIORITY} ${ARGUMENT} " ${TMPDIR}/pkglist) )
fi
if [ "$PKGDATA" ]; then
NAME=${PKGDATA[1]}
FULLNAME=$(echo "${PKGDATA[5]}.${PKGDATA[7]}")
fi
done
}
if [ "$CMD" == "install" ] || [ "$CMD" == "upgrade" ] ; then
NEWINPUTLIST=""
for pref in $INPUTLIST ; do
if echo "$pref" | grep -q "[a-zA-Z0-9]\+[:][a-zA-Z0-9]\+" ; then
repository=$(echo "$pref" | cut -f1 -d":")
package=$(echo "$pref" | cut -f2- -d":")
PRIORITY=( slackpkgplus_${repository}:$package ${PRIORITY[*]} )
else
package=$pref
fi
NEWINPUTLIST="$NEWINPUTLIST $package"
done
INPUTLIST=$NEWINPUTLIST
fi
if [ "$CMD" == "install-new" ] ; then
ls -1 /var/log/packages/*compat32 2>/dev/null | rev | cut -f1 -d/ | cut -f4- -d- | rev | sort > $TMPDIR/installed-compat32-packages.lst
grep "[[:digit:]]\+compat32[ ]" $WORKDIR/pkglist | cut -f2 -d" " | sort > $TMPDIR/available-compat32-packages.lst
NEWCOMPAT32PKGS=$(comm -3 $TMPDIR/installed-compat32-packages.lst $TMPDIR/available-compat32-packages.lst)
if [ ! -z "$NEWCOMPAT32PKGS" ] ; then
LIST=""
for pkg in $NEWCOMPAT32PKGS ; do
LIST="$LIST $(grep " ${pkg} " $WORKDIR/pkglist | cut -f6,8 -d" " --output-delimiter=".")"
done
fi
fi
fi fi