Merge branch 'test'

This commit is contained in:
Matteo Rossini 2021-01-24 20:38:42 +01:00
commit 336a519d06

View file

@ -94,6 +94,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
# function install_pkg() # function install_pkg()
# function wgetdebug() # function wgetdebug()
# function cached_downloader() # function cached_downloader()
# function getpkg()
# function getfile() # function getfile()
# function checkgpg() # function checkgpg()
# function checkmd5() # function checkmd5()
@ -315,30 +316,21 @@ if [ "$SLACKPKGPLUS" = "on" ];then
# Overrides original upgrade_pkg(). Required by the notification mechanism. # Overrides original upgrade_pkg(). Required by the notification mechanism.
function upgrade_pkg() { function upgrade_pkg() {
local i local i
local q
local c
q=$(echo $SHOWLIST|wc -w)
if [ "$DOWNLOAD_ALL" = "on" ]; then if [ "$DOWNLOAD_ALL" = "on" ]; then
OLDDEL="$DELALL" OLDDEL="$DELALL"
DELALL="off" DELALL="off"
c=1
for i in $SHOWLIST; do for i in $SHOWLIST; do
echo -n "[$c/$q]"
let c++
getpkg $i true getpkg $i true
done done
DELALL="$OLDDEL" DELALL="$OLDDEL"
fi fi
ls -1 $ROOT/var/log/packages/ > $TMPDIR/tmplist ls -1 $ROOT/var/log/packages/ > $TMPDIR/tmplist
c=1
for i in $SHOWLIST; do for i in $SHOWLIST; do
PKGFOUND=$(grep -m1 -e "^$(echo $i|rev|cut -f4- -d-|rev)-[^-]\+-[^-]\+-[^-]\+$" $TMPDIR/tmplist) PKGFOUND=$(grep -m1 -e "^$(echo $i|rev|cut -f4- -d-|rev)-[^-]\+-[^-]\+-[^-]\+$" $TMPDIR/tmplist)
REPOPOS=$(grep -m1 " $(echo $i|sed 's/\.t.z//') " $TMPDIR/pkglist|awk '{print $1}'|sed 's/SLACKPKGPLUS_//') REPOPOS=$(grep -m1 " $(echo $i|sed 's/\.t.z//') " $TMPDIR/pkglist|awk '{print $1}'|sed 's/SLACKPKGPLUS_//')
echo -n "[$c/$q]" getpkg $i upgradepkg Upgrading $REPOPOS $PKGFOUND
let c++
getpkg $i upgradepkg Upgrading
if [ "$DOWNLOADONLY" != "on" ];then if [ "$DOWNLOADONLY" != "on" ];then
if [ -e "$ROOT/var/log/packages/$(echo $i|sed 's/\.t.z//')" ];then if [ -e "$ROOT/var/log/packages/$(echo $i|sed 's/\.t.z//')" ];then
FDATE=$(ls -l --full-time $ROOT/var/log/packages/$(echo $i|sed 's/\.t.z//') |awk '{print $6" "$7}'|sed -r -e 's/\.[0-9]{9}//' -e 's,-,/,' -e 's,-,/,') FDATE=$(ls -l --full-time $ROOT/var/log/packages/$(echo $i|sed 's/\.t.z//') |awk '{print $6" "$7}'|sed -r -e 's/\.[0-9]{9}//' -e 's,-,/,' -e 's,-,/,')
@ -354,31 +346,22 @@ if [ "$SLACKPKGPLUS" = "on" ];then
# Overrides original install_pkg(). Required by the notification mechanism. # Overrides original install_pkg(). Required by the notification mechanism.
function install_pkg() { function install_pkg() {
local i local i
local q
local c
q=$(echo $SHOWLIST|wc -w)
if [ "$DOWNLOAD_ALL" = "on" ]; then if [ "$DOWNLOAD_ALL" = "on" ]; then
OLDDEL="$DELALL" OLDDEL="$DELALL"
DELALL="off" DELALL="off"
c=1
for i in $SHOWLIST; do for i in $SHOWLIST; do
echo -n "[$c/$q]"
let c++
getpkg $i true getpkg $i true
done done
DELALL="$OLDDEL" DELALL="$OLDDEL"
fi fi
c=1
for i in $SHOWLIST; do for i in $SHOWLIST; do
INSTALL_T='installed: ' INSTALL_T='installed: '
if [ -e $ROOT/var/log/packages/$(echo $i|sed 's/\.t.z//') ];then if [ -e $ROOT/var/log/packages/$(echo $i|sed 's/\.t.z//') ];then
INSTALL_T='reinstalled:' INSTALL_T='reinstalled:'
fi fi
REPOPOS=$(grep -m1 " $(echo $i|sed 's/\.t.z//') " $TMPDIR/pkglist|awk '{print $1}'|sed 's/SLACKPKGPLUS_//') REPOPOS=$(grep -m1 " $(echo $i|sed 's/\.t.z//') " $TMPDIR/pkglist|awk '{print $1}'|sed 's/SLACKPKGPLUS_//')
echo -n "[$c/$q]" getpkg $i installpkg Installing $REPOPOS
let c++
getpkg $i installpkg Installing
if [ "$DOWNLOADONLY" != "on" ];then if [ "$DOWNLOADONLY" != "on" ];then
if [ -e "$ROOT/var/log/packages/$(echo $i|sed 's/\.t.z//')" ];then if [ -e "$ROOT/var/log/packages/$(echo $i|sed 's/\.t.z//')" ];then
FDATE=$(ls -l --full-time $ROOT/var/log/packages/$(echo $i|sed 's/\.t.z//') |awk '{print $6" "$7}'|sed -r -e 's/\.[0-9]{9}//' -e 's,-,/,' -e 's,-,/,') FDATE=$(ls -l --full-time $ROOT/var/log/packages/$(echo $i|sed 's/\.t.z//') |awk '{print $6" "$7}'|sed -r -e 's/\.[0-9]{9}//' -e 's,-,/,' -e 's,-,/,')
@ -508,6 +491,18 @@ if [ "$SLACKPKGPLUS" = "on" ];then
##### ====== CORE FUNCTION ====== ###### ##### ====== CORE FUNCTION ====== ######
# Extends getpkg() original function
# (rename getpkg -> getpkg_old, then redefine getpkg to call it)
eval "$(type getpkg | sed -e $'1d;2c\\\ngetpkg_old()\n' -e 's/Upgrading /Upgrading $5 => [$4]:/' -e 's/Installing /Installing [$4]:/')"
function getpkg(){
local c
local q
q=$(echo $SHOWLIST|wc -w)
c=$(echo $SHOWLIST|sed 's/ /\n/g'|grep -n $1|cut -f1 -d:)
echo -n "[$c/$q]"
getpkg_old "$@"
return $?
} # END function getpkg()
# Override the slackpkg getfile(). # Override the slackpkg getfile().
# The new getfile() download all file needed from all defined repositories # The new getfile() download all file needed from all defined repositories
@ -960,7 +955,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
case "$CMD" in case "$CMD" in
upgrade-all) TOPROCESS=$(comm -1 -2 ${TMPDIR}/lpkg ${TMPDIR}/dpkg | comm -1 -2 - ${TMPDIR}/spkg|wc -l);; upgrade-all) TOPROCESS=$(comm -1 -2 ${TMPDIR}/lpkg ${TMPDIR}/dpkg | comm -1 -2 - ${TMPDIR}/spkg|wc -l);;
install-new) TOPROCESS=$[$(awk -f /usr/libexec/slackpkg/install-new.awk ${ROOT}/${WORKDIR}/ChangeLog.txt|sort -u|wc -l)+7];; install-new) TOPROCESS=$[$(awk -f /usr/libexec/slackpkg/install-new.awk ${ROOT}/${WORKDIR}/ChangeLog.txt|sort -u|wc -l)+7];;
install|upgrade|reinstall) install|upgrade|reinstall|download)
TOPROCESS=0 TOPROCESS=0
for TMPARGUMENT in $(echo $INPUTLIST); do for TMPARGUMENT in $(echo $INPUTLIST); do
TOPROCESS=$[$TOPROCESS+$(grep -w -- "${TMPARGUMENT}" ${TMPDIR}/pkglist | cut -f2 -d\ | sort -u|wc -l)] TOPROCESS=$[$TOPROCESS+$(grep -w -- "${TMPARGUMENT}" ${TMPDIR}/pkglist | cut -f2 -d\ | sort -u|wc -l)]