Merged with master 1.3.1

Merge branch 'master' into devel

Conflicts:
	ChangeLog.txt
	src/ChangeLog.txt
	src/slackpkgplus.sh
This commit is contained in:
Matteo Rossini 2014-04-15 16:56:05 +02:00
commit 99cf2bb70e
10 changed files with 233 additions and 42 deletions

View file

@ -1,5 +1,13 @@
Version 20131209.1 - 9/Dec/2013
- Forked from 1.2.0
Version 20140415.1 - 15/Apr/2014
- Forked from 1.3.1
Version 1.3.1 - 7/Mar/2014
- Improved check-updates function (thanks to phenixia2003)
- Improved debug-mode
Version 1.3.0 - 1/Jan/2014
- Added a debug-mode download verbosity
- On upgrade, the status bar show available packages from every repository
Version 1.2.0 - 9/Dec/2013
- Now ALLOW32BIT also auto-greylist the 32bit packages

View file

@ -1,5 +1,13 @@
Version 20131209.1 - 9/Dec/2013
- Forked from 1.2.0
Version 20140415.1 - 15/Apr/2014
- Forked from 1.3.1
Version 1.3.1 - 7/Mar/2014
- Improved check-updates function (thanks to phenixia2003)
- Improved debug-mode
Version 1.3.0 - 1/Jan/2014
- Added a debug-mode download verbosity
- On upgrade, the status bar show available packages from every repository
Version 1.2.0 - 9/Dec/2013
- Now ALLOW32BIT also auto-greylist the 32bit packages

View file

@ -381,6 +381,13 @@ Note that you can edit manually to modify or add informations.
At every slackpkg install/upgrade/remove invocation, a new log will be added.
At every slackpkg update invocation, a fast list rebuild will be done.
-----
CHECK-UPDATE IMPROVEMENT
the command "slackpkg check-updates" reports the repositories which have been changed since
the last update. For more details and some suggests how to use it in crontab see:
http://www.linuxquestions.org/questions/showthread.php?p=5146591
-----

View file

@ -10,10 +10,10 @@ config() {
# Otherwise, we leave the .new copy for the admin to consider...
}
remove() {
renam() {
FILE="$1"
if [ -r $FILE ]; then
rm $FILE
mv $FILE $FILE.tmp
fi
}
@ -38,10 +38,8 @@ copy_config_file
config etc/slackpkg/slackpkgplus.conf.new
config etc/slackpkg/greylist.new
config etc/slackpkg/notifymsg.conf.new
remove var/lib/slackpkg/ChangeLog.txt
remove var/lib/slackpkg/pkglist
( . usr/libexec/slackpkg/makeinstlog.sh >/dev/null )
renam var/lib/slackpkg/ChangeLog.txt
renam var/lib/slackpkg/pkglist
echo
echo

View file

@ -2,17 +2,20 @@
WORKDIR=/var/lib/slackpkg
. /etc/slackpkg/slackpkg.conf
if [ -e $WORKDIR/pkglist ];then
cp $WORKDIR/pkglist $WORKDIR/pkglist.tmp
fi
(
(
cd /var/log/removed_packages
( ls -l --full-time|tail +2|cut -c11-|sed -r -e 's/\.[0-9]{9}//' -e 's,-,/,' -e 's,-,/,'|awk '{print $8,$5,$6}'
grep -m1 'PACKAGE LOCATION:' *|sed -r 's/:PACKAGE LOCATION:.*(\.t.z)/ \1/'
grep -m1 'PACKAGE LOCATION:' * 2>/dev/null|sed -r 's/:PACKAGE LOCATION:.*(\.t.z)/ \1/'
)|sort|awk '{if(x=!x){printf("%s ", $2)}else{print $2,$3,$1}}' \
|sed -e 's/$/ removed/' -e 's/-upgraded-.*/ upgraded/'|awk '{print $2,$3,$4,$1,$5}'
cd /var/log/packages
( ls -l --full-time|tail +2|cut -c11-|sed -r -e 's/\.[0-9]{9}//' -e 's,-,/,' -e 's,-,/,'|awk '{print $8,$5,$6}'
grep -m1 'PACKAGE LOCATION:' *|sed -r 's/:PACKAGE LOCATION:.*(\.t.z)/ \1/'
grep -m1 'PACKAGE LOCATION:' * 2>/dev/null|sed -r 's/:PACKAGE LOCATION:.*(\.t.z)/ \1/'
)|sort|awk '{if(x=!x){printf("%s ", $2)}else{print $2,$3,$1}}' \
|sed -e 's/$/ installed/'|awk '{print $2,$3,$4,$1,$5}'
)| sed -r -e 's/^([^ ]+) ([^ ]+) (.*)-([^-]+)-([^-]+)-([^ ]+) (\.t.z) (.*)/\1 \2 \3 \3-\4-\5-\6 \7 \8/'|sort|awk '{
@ -24,24 +27,27 @@ WORKDIR=/var/lib/slackpkg
cat $WORKDIR/install.log 2>/dev/null|grep -v '\[\]'
)|sort -r|awk '{if(!a[$1$2$3$4]++)print}'|tac >$WORKDIR/install.log.new
)|sort -r|awk '{if(!a[$1$2$3$4]++)print}'|tac >$WORKDIR/install.log.tmp
if [ "$1" == "-t" ];then
if [ ! -e $WORKDIR/pkglist ];then
echo "pkglist does not exists; unable to try repository detect"
echo "An install log was created in $WORKDIR/install.log.new ; review it and rename in install.log"
else
cat $WORKDIR/install.log.new |while read a;do
if [ ! -e $WORKDIR/pkglist.tmp ];then
if [ -e $WORKDIR/pkglist ];then
cp $WORKDIR/pkglist $WORKDIR/pkglist.tmp
fi
fi
if [ ! -e $WORKDIR/pkglist.tmp ];then
echo "pkglist does not exists; unable to try repository detect"
mv $WORKDIR/install.log.tmp $WORKDIR/install.log.new
else
cat $WORKDIR/install.log.tmp |while read a;do
P=$(echo $a|awk '{print $4}')
R=$(grep -m1 \
"$(echo $P|awk -f /usr/libexec/slackpkg/pkglist.awk | awk '{print " "$1" .* "$3" "$4"$"}'| sed -r 's/ [0-9]+([^\$]*)\$/ [0-9]\\+\1 /')" \
/var/lib/slackpkg/pkglist|awk '{print $1}'|sed 's/SLACKPKGPLUS_//'
$WORKDIR/pkglist.tmp|awk '{print $1}'|sed 's/SLACKPKGPLUS_//'
)
echo "$a"|sed "s/\[\]/[$R]/"
done > $WORKDIR/install.log.tmp
echo "An install log was created in $WORKDIR/install.log.tmp ; review it and rename in install.log"
fi
else
mv $WORKDIR/install.log.new $WORKDIR/install.log
echo "An install log was created in $WORKDIR/install.log"
done > $WORKDIR/install.log.new
rm $WORKDIR/install.log.tmp
rm $WORKDIR/pkglist.tmp
fi
mv $WORKDIR/install.log.new $WORKDIR/install.log
echo "An install log was created in $WORKDIR/install.log"

View file

@ -7,13 +7,12 @@ Supported Repositories:
> ktown: http://taper.alienbase.nl/mirrors/alien-kde/{13.37,14.0,14.1,current}/latest/{x86,x86_64}/
> restricted: http://taper.alienbase.nl/mirrors/people/alien/restricted_sbrepos/{13.37,14.0,14.1,current}/{x86,x86_64}/
> slacky: http://repository.slacky.eu/slackware{,64}-{13.37,14.0,14.1}/
> zerouno: http://www.z01.eu/repo-slack/slackware64-current/
> mled: http://www.microlinux.fr/slackware/MLED-{14.0,14.1}-{32,64}bit/
> mles: http://www.microlinux.fr/slackware/MLES-{14.0,14.1}-{32,64}bit/
> mlws: http://www.microlinux.fr/slackware/MLWS-{14.0,14.1}-{32,64}bit/
> msb: http://slackware.org.uk/msb/{14.0,14.1}/1.6/{x86,x86_64}/
> slackers: http://www.slackers.it/repository/
> slacke17: http://ngc891.blogdns.net/pub/slacke17/slackware{,64,arm}-{14.0,14.1}/
> studioware: http://studioware.org/files/packages/slackware{,64}-{13.37,14.0,14.1}/
>
> Does NOT support GPG
> salixos(*): http://download.salixos.org/{i486,x86_64}/{13.37,14.0,14.1}/

View file

@ -1,7 +1,6 @@
# Thanks to AlienBob and phenixia2003 (on LQ) for contributing
# A special thanks to all packagers that make slackpkg+ useful
declare -A MIRRORPLUS
declare -A NOTIFYMSG
@ -34,21 +33,68 @@ fi
if [ "$SLACKPKGPLUS" = "on" ];then
SPKGPLUS_VERSION="20131209.1"
SPKGPLUS_VERSION="20140415.1"
VERSION="$VERSION / slackpkg+ $SPKGPLUS_VERSION"
if [ ! -e "$WORKDIR" ];then
mkdir -p "$WORKDIR"
fi
if [ "$CMD" == "update" ];then
if [ "$VERBOSE" == "2" ];then
echo "Updating $WORKDIR/install.log"
touch $TMPDIR/info.log
if [ $VERBOSE -gt 1 ];then
/usr/libexec/slackpkg/makeinstlog.sh -t >> $TMPDIR/info.log &
else
/usr/libexec/slackpkg/makeinstlog.sh >/dev/null &
fi
/usr/libexec/slackpkg/makeinstlog.sh >/dev/null
PIDINSTLOG=$!
fi
function cleanup(){
[ "$SPINNING" = "off" ] || tput cnorm
if [ "$CMD" == "update" ];then
if [ $VERBOSE -gt 2 ];then
echo "Updating $WORKDIR/install.log..."
else
echo "Updating install.log"
fi
echo
fi
if [ "$DELALL" = "on" ] && [ "$NAMEPKG" != "" ]; then
rm $CACHEPATH/$NAMEPKG &>/dev/null
fi
wait
if [ $VERBOSE -gt 2 ];then
echo "The temp directory $TMPDIR will NOT be removed!" >>$TMPDIR/info.log
echo
fi
if [ -s $TMPDIR/error.log -o -s $TMPDIR/info.log ];then
echo -e "\n\n=============================================================================="
fi
if [ -e $TMPDIR/error.log ]; then
echo " WARNING! One or more errors occurred while slackpkg was running"
echo "------------------------------------------------------------------------------"
cat $TMPDIR/error.log
if [ -s $TMPDIR/info.log ];then
echo "------------------------------------------------------------------------------"
fi
fi
if [ -s $TMPDIR/info.log ]; then
echo " INFO! Debug informations"
echo "------------------------------------------------------------------------------"
cat $TMPDIR/info.log
echo "=============================================================================="
fi
echo
rm -f /var/lock/slackpkg.$$
if [ $VERBOSE -lt 3 ];then
rm -rf $TMPDIR
fi
exit
}
# Override the slackpkg getfile().
# The new getfile() download all file needed from all defined repositories
# then merge all in a format slackpkg-compatible
@ -90,9 +136,9 @@ if [ "$SLACKPKGPLUS" = "on" ];then
$DOWNLOADER $2 $URLFILE
fi
if [ $? -ne 0 ];then
if echo $2|grep -q ^SLACKPKGPLUS;then
if echo $2|grep -q SLACKPKGPLUS;then
if [ "`basename $URLFILE`" != "MANIFEST.bz2" ];then
echo -e "$URLFILE:\tdownload error" >> $TMPDIR/error.log
echo -e "\n$URLFILE:\tdownload error" >> $TMPDIR/error.log
if echo $2|grep -q .asc$;then
echo " Retry using 'slackpkg -checkgpg=off $CMD ...'" >> $TMPDIR/error.log
fi
@ -195,7 +241,9 @@ if [ "$SLACKPKGPLUS" = "on" ];then
sleep 5
echo -e "$PREPO: Invalid repository (fails to download CHECKSUMS.md5)" >> $TMPDIR/error.log
fi
echo $PREPO $(md5sum ${TMPDIR}/CHECKSUMS.md5-$PREPO|awk '{print $1}') >>$2
echo "SLACKPKGPLUS_$PREPO[MD5]" $(md5sum ${TMPDIR}/CHECKSUMS.md5-$PREPO|awk '{print $1}') >>$2
done
fi
if [ $(basename $1) = "GPG-KEY" ];then
@ -242,7 +290,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
echo 1
fi
if [ "$(basename $1)" == "CHECKSUMS.md5" ];then
X86_64=$(ls /var/log/packages/aaa_base*x86_64*|head -1 2>/dev/null)
X86_64=$(ls /var/log/packages/aaa_base*x86_64* 2>/dev/null|head -1)
for PREPO in $REPOPLUS;do
if [ ! -z "$X86_64" ];then
if [ "$ALLOW32BIT" == "on" ];then
@ -718,12 +766,51 @@ if [ "$SLACKPKGPLUS" = "on" ];then
handle_event "install"
}
function wgetdebug(){
local SRCURL
local DSTFILE
SRCURL=$2
DSTFILE=$(echo $SRCURL|sed 's|/|,|g')
if [ ${SRCURL:0:5} == "https" ];then
WGETOPTSL="--no-check-certificate"
fi
if [ ${SRCURL:0:3} == "ftp" ];then
WGETOPTSL="--passive-ftp"
fi
DOWNTIME=$(date +%s)
wget $WGETOPTS $WGETOPTSL -O $TMPDIR/$DSTFILE $SRCURL 2>&1|tee $TMPDIR/$DSTFILE.log
WGETERR=${PIPESTATUS[0]}
cp $TMPDIR/$DSTFILE $1
echo "exit code: $WGETERR" >>$TMPDIR/$DSTFILE.log
DOWNTIME=$[$(date +%s)-$DOWNTIME]
if [ $WGETERR -ne 0 ];then
echo >> $TMPDIR/error.log
echo "$SRCURL --> BAD" >> $TMPDIR/error.log
echo "wget $WGETOPTS $WGETOPTSL -O $DSTFILE $SRCURL" >> $TMPDIR/error.log
echo "exit code: $WGETERR" >> $TMPDIR/error.log
echo "download time: $DOWNTIME secs" >> $TMPDIR/error.log
echo "details:" >> $TMPDIR/error.log
cat $TMPDIR/$DSTFILE.log >> $TMPDIR/error.log
ls -l $DSTFILE >> $TMPDIR/error.log 2>&1
md5sum $DSTFILE >> $TMPDIR/error.log 2>&1
echo >> $TMPDIR/error.log
else
echo "$SRCURL --> OK" >> $TMPDIR/info.log
fi
return $WGETERR
}
DOWNLOADER="wget $WGETOPTS --no-check-certificate --passive-ftp -O"
if [ "$VERBOSE" = "0" ];then
DOWNLOADER="wget $WGETOPTS --no-check-certificate -nv --passive-ftp -O"
elif [ "$VERBOSE" = "2" ];then
DOWNLOADER="wget $WGETOPTS --no-check-certificate --passive-ftp -O"
elif [ "$VERBOSE" = "3" ];then
DOWNLOADER="wgetdebug"
elif [ "$CMD" = "update" ];then
DOWNLOADER="wget $WGETOPTS --no-check-certificate -nv --passive-ftp -O"
fi
@ -929,5 +1016,79 @@ if [ "$SLACKPKGPLUS" = "on" ];then
cleanup
fi
if [ "$CMD" == "check-updates" ] ; then
[ ! -e ~/.slackpkg ] && mkdir ~/.slackpkg
echo -n "" > ~/.slackpkg/updated-repos.txt
UPDATES=false
if ! checkchangelog 1>/dev/null 2>/dev/null; then
# -- Note:
# checkchangelog() download the ChangeLog.txt and stores it
# in ${TMPDIR}
# extract the slackpkgplus repositories md5 from the ChangeLog.txt
# files (in ${WORKDIR} and ${TMPDIR} to identify updates in Slackware
# repository.
#
grep -v "^SLACKPKGPLUS_.*\[MD5\] " ${WORKDIR}/ChangeLog.txt > ${TMPDIR}/ChangeLog.old
grep -v "^SLACKPKGPLUS_.*\[MD5\] " ${TMPDIR}/ChangeLog.txt > ${TMPDIR}/ChangeLog.new
if [ "$(md5sum ${TMPDIR}/ChangeLog.old | cut -f1 -d' ')" != "$(md5sum ${TMPDIR}/ChangeLog.new | cut -f1 -d' ')" ] ; then
echo "slackware" > ${TMPDIR}/updated-repos.txt
fi
# -- get the list of the repositories configured before this call to check-updates
#
grep "^SLACKPKGPLUS_.*\[MD5\] " ${WORKDIR}/ChangeLog.txt | sed 's/^SLACKPKGPLUS_//; s/\[MD5\]//' | cut -f1 -d" "> ${TMPDIR}/selected.3pr
# create pseudo changelogs for the selected 3rd party repositories
#
grep "^SLACKPKGPLUS_.*\[MD5\] " ${WORKDIR}/ChangeLog.txt | sort > "${TMPDIR}/3rp-ChangeLog.old"
grep "^SLACKPKGPLUS_.*\[MD5\] " ${TMPDIR}/ChangeLog.txt | sort > "${TMPDIR}/3rp-ChangeLog.new"
# from the pseudo changelogs, find the updated 3rd party repositories and add them
# to the updates report file
#
comm -1 -3 "${TMPDIR}/3rp-ChangeLog.old" \
"${TMPDIR}/3rp-ChangeLog.new" \
| sed -e "s/^SLACKPKGPLUS_//" -e "s/\[MD5\]//" \
| cut -f1 -d" " | grep -f ${TMPDIR}/selected.3pr >> "${TMPDIR}/updated-repos.txt"
# when TMPDIR/updated-repos.txt is not empty , it contains the
# names of the updated repositories.
#
# NOTE:
# at this point, updated-repos.txt can be empty when user
# has added a repository in REPOPLUS and run "slackpkg check-updates"
# instead (or prior to) "slackpkg update"
[ -s "${TMPDIR}/updated-repos.txt" ] && UPDATES=true
fi
if $UPDATES ; then
echo "News on ChangeLog.txt"
printf "\n [ %-24s ] [ %-20s ]\n" "Repository" "Status"
for REPO in slackware $REPOPLUS; do
if grep -q "^${REPO}$" ${TMPDIR}/updated-repos.txt ; then
printf " %-24s %-20s \n" "$REPO" "AVAILABLE UPDATES"
else
printf " %-24s %-20s \n" "$REPO" " Up to date "
fi
done
# save ${TMPDIR}/updates-repos.txt in ~/.slackpkg/updated-repos.txt
#
cat ${TMPDIR}/updated-repos.txt > ~/.slackpkg/updated-repos.txt
else
echo "No news is good news"
fi
cleanup
fi
fi

View file

@ -4,7 +4,8 @@ SLACKPKGPLUS=on
# set to '0' to never show the download progress bar
# set to '1' to show the bar only in download packages (default)
# set to '2' to show always show the download bar
# set to '2' to always show the download bar
# set to '3' for a debug mode
VERBOSE=1
# Enable (1) / Disable (0) the official slackpkg blacklist. May be useful to temporarily skip

View file

@ -4,7 +4,8 @@ SLACKPKGPLUS=on
# set to '0' to never show the download progress bar
# set to '1' to show the bar only in download packages (default)
# set to '2' to show always show the download bar
# set to '2' to always show the download bar
# set to '3' for a debug mode
VERBOSE=1
# By default slackpkg+ deny to install 32bit packages.

View file

@ -31,11 +31,13 @@ if [ "$SLACKPKGPLUS" = "on" ];then
for i in $1; do
TMPONOFF=$ONOFF
BASENAME=$(cutpkg $i)
PKGFOUND=$(grep -m1 -e "^${BASENAME}-[^-]\+-\(noarch\|fw\|${ARCH}\)" $TMPDIR/tmplist)
PKGFOUND=$(grep -m1 -e "^${BASENAME}-[^-]\+-[^-]\+-[^-]\+$" $TMPDIR/tmplist)
REPOPOS=$(grep -m1 " $(echo $i|sed 's/\.t.z//') " $TMPDIR/pkglist|awk '{print $1}'|sed 's/SLACKPKGPLUS_//')
PKGVER=$(echo $i|rev|cut -f3 -d-|rev)
ALLFOUND=$(echo $(grep " ${BASENAME} " $TMPDIR/pkglist|sed -r -e 's/SLACKPKGPLUS_//' -e 's/^([^ ]*) [^ ]* ([^ ]*) [^ ]* ([^ ]*) .*/\2-\3(\1) ,/')|sed 's/,$//')
grep -q "^$(echo $i|rev|cut -f4- -d-|rev)$" $TMPDIR/unchecklist && TMPONOFF="off"
echo "$i \"$REPOPOS\" $TMPONOFF \"currently installed: $PKGFOUND\"" >>$TMPDIR/dialog.tmp
echo "$i \"$REPOPOS\" $TMPONOFF \"installed: $PKGFOUND --> available: $ALLFOUND\"" >>$TMPDIR/dialog.tmp
done
HINT="--item-help"
else