diff --git a/ChangeLog.txt b/ChangeLog.txt index cba9f80..73d0343 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,9 @@ +Version 0.9beta2 - 27/Apr/2013 + - fixed a 'package' bug that override slackpkgplus.conf (instead .new) + - added doinst.sh that auto-select a configuration file depending $ARCH + - fixed priority system bug when two repositories have package with the same + full name + Version 0.9beta1 - 26/Apr/2013 - added repositories in conf file - added a priority system for repository only diff --git a/src/README b/src/README index be44286..737897b 100644 --- a/src/README +++ b/src/README @@ -6,9 +6,12 @@ Slackpkg+ is a plugin for slackpkg It add support for third-party repositories. You can add multiple repository to your list +Thanks to alienbob and phenixia2003 for contributing. + + edit slackpkgplus.conf -uncomment one or more mirrors +uncomment one or more mirrors and add it in REPOPLUS list optionally set PKGS_PRIORITY to give priority order for packages presents in multiple repositories then launch @@ -16,17 +19,55 @@ slackpkg update gpg slackpkg update -If do you add some repository that does not support MANIFEST.bz2 -you may obtain a warning in slackpkg update. -Don't warry.. it's no a problem. - - This is a beta version. -KNOWN BUGS: -when used with multiple repositories and two repositories have the same package, slackpkg show only the first (in the order specified in PRIORITY & PRIORITYPLUS configuration). -when one repository contains multiple packages with same name (some repository contains both 32 and 64 bit architectures and/or multiple slackware version, 14.0, 13.37, 13.1 ...), slackpkg show only one package, in a unknown order!! An example is the AlienBob repository. -slackpkg+ try to detect the best package for your installed slackware, but it may fails! - +Usage: + +see 'man slackpkg' :D + + +When a package is present in more than a repository the package will found in that order: + +1) as listed in PKGS_PRIORITY +2) as listed in Official Slackware Repository (as configured in slackpkg.conf) +3) as listed in REPOPLUS + + +PKGS_PRIORITY Syntax: + +: + +example +alienbob:openjdk + + accepts regular expression, so +multilib:.* mean 'all packages in repository multilib' + + +Supported repository are (for now): + +multilib: http://taper.alienbase.nl/mirrors/people/alien/multilib/ +alienbob: http://taper.alienbase.nl/mirrors/people/alien/sbrepos/ +alien restricted: http://taper.alienbase.nl/mirrors/people/alien/restricted_sbrepos/ +slacky: http://repository.slacky.eu/ +salixos: http://download.salixos.org/ +salixext: http://people.salixos.org/ralvex/packages/ +rlworkman: http://rlworkman.net/pkgs/ +slackel: http://www.slackel.gr/repo/ +zerouno: http://www.z01.eu/repo-slack/ +slackers: http://www.slackers.it/repository/ + +but you can add other yourself. + +Currently only the alien repositories (multilib, alienbob and restricted) and the slacky repositories does supports GPG. +If configure the other repositories, you may need to set "CHECKGPG=off" in slackpkg.conf + + + + +For questions, suggests or contributes, you can email me to zerouno@slacky.it or use the linuxquestions forum: +http://www.linuxquestions.org/questions/showthread.php?p=4940074 + + diff --git a/src/doinst.sh b/src/doinst.sh new file mode 100644 index 0000000..5967317 --- /dev/null +++ b/src/doinst.sh @@ -0,0 +1,39 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +remove() { + FILE="$1" + if [ -r $FILE ]; then + rm $FILE + fi +} + +copy_config_file() { + ARCH=$(uname -m) + case $ARCH in + i386|i486|i586|i686) + SRCMIRROR=slackpkgplus.x86.sample + ;; + x86-64|x86_64|X86-64|X86_64) + SRCMIRROR=slackpkgplus.x86_64.sample + ;; + *) + SRCMIRROR=slackpkgplus.x86.sample + ;; + esac + cp usr/doc/slackpkg+-0.9beta2/$SRCMIRROR etc/slackpkg/slackpkgplus.conf.new +} + +copy_config_file +config etc/slackpkg/slackpkgplus.conf.new +remove var/lib/slackpkg/ChangeLog.txt +remove var/lib/slackpkg/pkglist diff --git a/src/slack-desc b/src/slack-desc new file mode 100644 index 0000000..6d4906a --- /dev/null +++ b/src/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-handy-ruler------------------------------------------------------| +slackpkg+: slackpkg+ plugin for third-party repositories +slackpkg+: +slackpkg+: Slackpkg is a package manager for Slackware. +slackpkg+: +slackpkg+: Slackpkg+ is a plugin for slackpkg +slackpkg+: It add support for third-party repositories. +slackpkg+: You can add multiple repository to your list +slackpkg+: +slackpkg+: +slackpkg+: +slackpkg+: diff --git a/src/slackpkg+.SlackBuild b/src/slackpkg+.SlackBuild new file mode 100644 index 0000000..8c99c78 --- /dev/null +++ b/src/slackpkg+.SlackBuild @@ -0,0 +1,31 @@ +#!/bin/bash + +VERSION=0.9beta2 + +CWD=`pwd` +PKG=$CWD/../slackpkg+-$VERSION + +rm -rf $PKG +mkdir -p $PKG + +cd $PKG +mkdir -p etc/slackpkg/ +mkdir -p usr/libexec/slackpkg/functions.d/ +mkdir -p usr/doc/slackpkg+-$VERSION/ +mkdir -p install/ + +cp $CWD/slackpkgplus.sh usr/libexec/slackpkg/functions.d/ +cp $CWD/slackpkgplus.conf etc/slackpkg/slackpkgplus.conf.new +cp $CWD/README usr/doc/slackpkg+-$VERSION/ +cp $CWD/slackpkg+.SlackBuild usr/doc/slackpkg+-$VERSION/ +cp $CWD/slackpkgplus.*.sample usr/doc/slackpkg+-$VERSION/ +cp $CWD/slack-desc install/ +cat $CWD/doinst.sh|sed "s/SLPVERSION/$VERSION/" > install/doinst.sh + +chmod +x usr/libexec/slackpkg/functions.d/slackpkgplus.sh + + +makepkg -l y -c y ../slackpkg+-$VERSION-noarch-1mt.txz + + + diff --git a/src/slackpkgplus.sh b/src/slackpkgplus.sh index 7cfbb3f..b6ffa67 100755 --- a/src/slackpkgplus.sh +++ b/src/slackpkgplus.sh @@ -153,7 +153,10 @@ if [ "$SLACKPKGPLUS" = "on" ];then } - + # Global variable required by givepriority() + # + PRIORITYIDX=1 + # Found packages in repository. # This function selects the package from the higher priority # repository directories. @@ -183,11 +186,30 @@ if [ "$SLACKPKGPLUS" = "on" ];then 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) ) - + + # ARGUMENT is always a basename. But PAT can be: + # 1. a regular expression (ie .*) + # 2. a basename (openjdk) + # 3. a partial (or complete) package name (vlc-2.0.6, ). + # + # The current "enhanced priority rule" is applied : + # + In case (1) and (2) when ARGUMENT contains the pattern PAT + # + In the case (3) when ARGUMENT starts the pattern PAT. + # + if echo "$ARGUMENT" | grep -q "$PAT" || echo "$PAT" | grep "^$ARGUMENT" ; then + PKGDATA="" + PKGINFOS=$(grep -n -m 1 "^${DIR} ${ARGUMENT} " ${TMPDIR}/pkglist) + + if [ ! -z "$PKGINFOS" ] ; then + LINEIDX=$(echo "$PKGINFOS" | cut -f1 -d":") + PKGDATA=( $(echo "$PKGINFOS" | cut -f2- -d":") ) + + # -- move the line at #LINEIDX to #PRIORITYIDX and + # increment PRIORITYIDX + # + sed -i --expression "${LINEIDX}d" --expression "${PRIORITYIDX}i${PKGDATA[*]}" ${TMPDIR}/pkglist + (( PRIORITYIDX++ )) + fi fi else PKGDATA=( $(grep "^${CPRIORITY} ${ARGUMENT} " ${TMPDIR}/pkglist) ) diff --git a/src/slackpkgplus.x86.sample b/src/slackpkgplus.x86.sample new file mode 100644 index 0000000..899dccf --- /dev/null +++ b/src/slackpkgplus.x86.sample @@ -0,0 +1,50 @@ + +# Enable (on) / Disable (off) slackpkg+ +SLACKPKGPLUS=on + +# If two or more repositories contains some same packages, you can specify +# from which repository you prefer to search it. +# The syntax is ":" +# Accepts regular expressions. To give order to an entire repository use ":.*" + +# Examples: +#PKGS_PRIORITY=( alienbob:openjdk ) +# +# If you want a multilib system, uncomment the multilib repository and set: +#PKGS_PRIORITY=( multilib:.* ) +# + +# List repository you want to use (defined below) +REPOPLUS=( alienbob restricted slacky ) + + +# Define mirrors (uncomment one or more mirror) +# Note: only multilib,alienbob,restricted,slacky repositories does supports GPG. If you add other +# you may need to disable gpg check in slackpkg.conf + +# 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['restricted']=http://taper.alienbase.nl/mirrors/people/alien/restricted_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['rlworkman']=http://rlworkman.net/pkgs/14.0/ + +# Slackware 14.0 - i386 +MIRRORPLUS['alienbob']=http://taper.alienbase.nl/mirrors/people/alien/sbrepos/14.0/x86/ +MIRRORPLUS['restricted']=http://taper.alienbase.nl/mirrors/people/alien/restricted_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['rlworkman']=http://rlworkman.net/pkgs/14.0/ + +# Slackware current - x86_64 +#MIRRORPLUS['multilib']=http://taper.alienbase.nl/mirrors/people/alien/multilib/current/ +#MIRRORPLUS['slackel']=http://www.slackel.gr/repo/x86_64/current/ +#MIRRORPLUS['zerouno']=http://www.z01.eu/repo-slack/slackware64-current/ +#MIRRORPLUS['slackers']=http://www.slackers.it/repository/ + +# Slackware current - i386 +#MIRRORPLUS['slackel']=http://www.slackel.gr/repo/i486/current/ + diff --git a/src/slackpkgplus.conf b/src/slackpkgplus.x86_64.sample similarity index 73% rename from src/slackpkgplus.conf rename to src/slackpkgplus.x86_64.sample index 79d5d7c..84d1a1f 100644 --- a/src/slackpkgplus.conf +++ b/src/slackpkgplus.x86_64.sample @@ -15,21 +15,21 @@ SLACKPKGPLUS=on # # List repository you want to use (defined below) -REPOPLUS=( slacky zerouno restricted alienbob salixos salixext rlworkman slackel slackers ) +REPOPLUS=( alienbob restricted slacky ) # Define mirrors (uncomment one or more mirror) -# Note: You MUST disable gpg check if you select the 'salixext' or 'zerouno' !!! -# +# Note: only multilib,alienbob,restricted,slacky repositories does supports GPG. If you add other +# you may need to disable gpg check in slackpkg.conf # 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['restricted']=http://taper.alienbase.nl/mirrors/people/alien/restricted_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['rlworkman']=http://rlworkman.net/pkgs/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['rlworkman']=http://rlworkman.net/pkgs/14.0/ # Slackware 14.0 - i386 #MIRRORPLUS['alienbob']=http://taper.alienbase.nl/mirrors/people/alien/sbrepos/14.0/x86/ @@ -41,9 +41,9 @@ MIRRORPLUS['rlworkman']=http://rlworkman.net/pkgs/14.0/ # Slackware current - x86_64 #MIRRORPLUS['multilib']=http://taper.alienbase.nl/mirrors/people/alien/multilib/current/ -MIRRORPLUS['slackel']=http://www.slackel.gr/repo/x86_64/current/ -MIRRORPLUS['zerouno']=http://www.z01.eu/repo-slack/slackware64-current/ -MIRRORPLUS['slackers']=http://www.slackers.it/repository/ +#MIRRORPLUS['slackel']=http://www.slackel.gr/repo/x86_64/current/ +#MIRRORPLUS['zerouno']=http://www.z01.eu/repo-slack/slackware64-current/ +#MIRRORPLUS['slackers']=http://www.slackers.it/repository/ # Slackware current - i386 #MIRRORPLUS['slackel']=http://www.slackel.gr/repo/i486/current/