mirror of
https://github.com/zuno/slackpkgplus
synced 2025-01-13 20:01:04 +01:00
Only reindent.
This commit is contained in:
parent
29722fe22e
commit
9eeb9fcbdd
1 changed files with 309 additions and 311 deletions
|
@ -30,9 +30,9 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
if echo $URLFILE | grep -q "^file://" ; then
|
if echo $URLFILE | grep -q "^file://" ; then
|
||||||
URLFILE=${URLFILE:6}
|
URLFILE=${URLFILE:6}
|
||||||
if [ -f $URLFILE ];then
|
if [ -f $URLFILE ];then
|
||||||
cp -v $URLFILE $2
|
cp -v $URLFILE $2
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
$DOWNLOADER $2 $URLFILE
|
$DOWNLOADER $2 $URLFILE
|
||||||
|
@ -40,79 +40,79 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
|
|
||||||
if [ $(basename $1) = "MANIFEST.bz2" ];then
|
if [ $(basename $1) = "MANIFEST.bz2" ];then
|
||||||
if [ ! -s $2 ];then
|
if [ ! -s $2 ];then
|
||||||
echo -n|bzip2 -c >$2
|
echo -n|bzip2 -c >$2
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $(basename $1) = "CHECKSUMS.md5.asc" ];then
|
if [ $(basename $1) = "CHECKSUMS.md5.asc" ];then
|
||||||
if [ "$CHECKGPG" = "on" ];then
|
if [ "$CHECKGPG" = "on" ];then
|
||||||
for PREPO in $REPOPLUS;do
|
for PREPO in $REPOPLUS;do
|
||||||
URLFILE=${MIRRORPLUS[${PREPO/SLACKPKGPLUS_}]}CHECKSUMS.md5.asc
|
URLFILE=${MIRRORPLUS[${PREPO/SLACKPKGPLUS_}]}CHECKSUMS.md5.asc
|
||||||
if echo $URLFILE | grep -q "^file://" ; then
|
if echo $URLFILE | grep -q "^file://" ; then
|
||||||
URLFILE=${URLFILE:6}
|
URLFILE=${URLFILE:6}
|
||||||
cp -v $URLFILE ${TMPDIR}/CHECKSUMS.md5-$PREPO.asc
|
cp -v $URLFILE ${TMPDIR}/CHECKSUMS.md5-$PREPO.asc
|
||||||
else
|
else
|
||||||
$DOWNLOADER ${TMPDIR}/CHECKSUMS.md5-$PREPO.asc $URLFILE
|
$DOWNLOADER ${TMPDIR}/CHECKSUMS.md5-$PREPO.asc $URLFILE
|
||||||
fi
|
fi
|
||||||
if [ $? -eq 0 ];then
|
if [ $? -eq 0 ];then
|
||||||
if [ $(checkgpg ${TMPDIR}/CHECKSUMS.md5-$PREPO) -ne 1 ];then
|
if [ $(checkgpg ${TMPDIR}/CHECKSUMS.md5-$PREPO) -ne 1 ];then
|
||||||
echo
|
echo
|
||||||
echo " !!! F A T A L !!!"
|
echo " !!! F A T A L !!!"
|
||||||
echo " Repository '$PREPO' FAILS to check CHECKSUMS.md5 signature"
|
echo " Repository '$PREPO' FAILS to check CHECKSUMS.md5 signature"
|
||||||
echo " The file may be corrupted or the gpg key may be not valid."
|
echo " The file may be corrupted or the gpg key may be not valid."
|
||||||
echo " Remember to import keys launching 'slackpkg update gpg'."
|
echo " Remember to import keys launching 'slackpkg update gpg'."
|
||||||
echo
|
echo
|
||||||
sleep 5
|
sleep 5
|
||||||
echo > ${TMPDIR}/CHECKSUMS.md5
|
echo > ${TMPDIR}/CHECKSUMS.md5
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo
|
echo
|
||||||
echo " !!! W A R N I N G !!!"
|
echo " !!! W A R N I N G !!!"
|
||||||
echo " Repository '$PREPO' does NOT support signature checking"
|
echo " Repository '$PREPO' does NOT support signature checking"
|
||||||
echo " You SHOULD disable GPG check by setting 'CHECKGPG=off'"
|
echo " You SHOULD disable GPG check by setting 'CHECKGPG=off'"
|
||||||
echo " in /etc/slackpkg/slackpkg.conf"
|
echo " in /etc/slackpkg/slackpkg.conf"
|
||||||
echo
|
echo
|
||||||
sleep 5
|
sleep 5
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
checkgpg ${TMPDIR}/CHECKSUMS.md5 >/dev/null
|
checkgpg ${TMPDIR}/CHECKSUMS.md5 >/dev/null
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ $(basename $1) = "ChangeLog.txt" ];then
|
if [ $(basename $1) = "ChangeLog.txt" ];then
|
||||||
for PREPO in $REPOPLUS;do
|
for PREPO in $REPOPLUS;do
|
||||||
# Not all repositories have the ChangeLog.txt, so I use md5 of CHECKSUMS.md5 instead
|
# Not all repositories have the ChangeLog.txt, so I use md5 of CHECKSUMS.md5 instead
|
||||||
URLFILE=${MIRRORPLUS[${PREPO/SLACKPKGPLUS_}]}CHECKSUMS.md5
|
URLFILE=${MIRRORPLUS[${PREPO/SLACKPKGPLUS_}]}CHECKSUMS.md5
|
||||||
if echo $URLFILE | grep -q "^file://" ; then
|
if echo $URLFILE | grep -q "^file://" ; then
|
||||||
URLFILE=${URLFILE:6}
|
URLFILE=${URLFILE:6}
|
||||||
cp -v $URLFILE ${TMPDIR}/CHECKSUMS.md5-$PREPO
|
cp -v $URLFILE ${TMPDIR}/CHECKSUMS.md5-$PREPO
|
||||||
else
|
else
|
||||||
$DOWNLOADER ${TMPDIR}/CHECKSUMS.md5-$PREPO ${MIRRORPLUS[${PREPO/SLACKPKGPLUS_}]}CHECKSUMS.md5
|
$DOWNLOADER ${TMPDIR}/CHECKSUMS.md5-$PREPO ${MIRRORPLUS[${PREPO/SLACKPKGPLUS_}]}CHECKSUMS.md5
|
||||||
fi
|
fi
|
||||||
echo $PREPO $(md5sum ${TMPDIR}/CHECKSUMS.md5-$PREPO|awk '{print $1}') >>$2
|
echo $PREPO $(md5sum ${TMPDIR}/CHECKSUMS.md5-$PREPO|awk '{print $1}') >>$2
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
if [ $(basename $1) = "GPG-KEY" ];then
|
if [ $(basename $1) = "GPG-KEY" ];then
|
||||||
for PREPO in $REPOPLUS;do
|
for PREPO in $REPOPLUS;do
|
||||||
URLFILE=${MIRRORPLUS[${PREPO/SLACKPKGPLUS_}]}GPG-KEY
|
URLFILE=${MIRRORPLUS[${PREPO/SLACKPKGPLUS_}]}GPG-KEY
|
||||||
if echo $URLFILE | grep -q "^file://" ; then
|
if echo $URLFILE | grep -q "^file://" ; then
|
||||||
URLFILE=${URLFILE:6}
|
URLFILE=${URLFILE:6}
|
||||||
cp -v $URLFILE $2-tmp
|
cp -v $URLFILE $2-tmp
|
||||||
else
|
else
|
||||||
$DOWNLOADER $2-tmp ${MIRRORPLUS[${PREPO/SLACKPKGPLUS_}]}GPG-KEY
|
$DOWNLOADER $2-tmp ${MIRRORPLUS[${PREPO/SLACKPKGPLUS_}]}GPG-KEY
|
||||||
fi
|
fi
|
||||||
if [ $? -eq 0 ];then
|
if [ $? -eq 0 ];then
|
||||||
gpg --import $2-tmp
|
gpg --import $2-tmp
|
||||||
else
|
else
|
||||||
echo
|
echo
|
||||||
echo " !!! W A R N I N G !!!"
|
echo " !!! W A R N I N G !!!"
|
||||||
echo " Repository '$PREPO' does NOT contain the GPG-KEY"
|
echo " Repository '$PREPO' does NOT contain the GPG-KEY"
|
||||||
echo " You SHOULD disable GPG check by setting 'CHECKGPG=off'"
|
echo " You SHOULD disable GPG check by setting 'CHECKGPG=off'"
|
||||||
echo " in /etc/slackpkg/slackpkg.conf"
|
echo " in /etc/slackpkg/slackpkg.conf"
|
||||||
echo
|
echo
|
||||||
sleep 5
|
sleep 5
|
||||||
fi
|
fi
|
||||||
rm $2-tmp
|
rm $2-tmp
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -124,34 +124,32 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
if [ "$(basename $1)" == "CHECKSUMS.md5" ];then
|
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*|head -1 2>/dev/null)
|
||||||
for PREPO in $REPOPLUS;do
|
for PREPO in $REPOPLUS;do
|
||||||
if [ ! -z "$X86_64" ];then
|
if [ ! -z "$X86_64" ];then
|
||||||
egrep -e ^[a-f0-9]{32} ${TMPDIR}/CHECKSUMS.md5-$PREPO|egrep -- "-(x86_64|noarch)-" |sed -r "s# \./# ./SLACKPKGPLUS_$PREPO/#" >> ${TMPDIR}/CHECKSUMS.md5
|
egrep -e ^[a-f0-9]{32} ${TMPDIR}/CHECKSUMS.md5-$PREPO|egrep -- "-(x86_64|noarch)-" |sed -r "s# \./# ./SLACKPKGPLUS_$PREPO/#" >> ${TMPDIR}/CHECKSUMS.md5
|
||||||
else
|
else
|
||||||
egrep -e ^[a-f0-9]{32} ${TMPDIR}/CHECKSUMS.md5-$PREPO|egrep -v -- "-(x86_64|arm)-" |sed -r "s# \./# ./SLACKPKGPLUS_$PREPO/#" >> ${TMPDIR}/CHECKSUMS.md5
|
egrep -e ^[a-f0-9]{32} ${TMPDIR}/CHECKSUMS.md5-$PREPO|egrep -v -- "-(x86_64|arm)-" |sed -r "s# \./# ./SLACKPKGPLUS_$PREPO/#" >> ${TMPDIR}/CHECKSUMS.md5
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# override slackpkg checkmd5()
|
# override slackpkg checkmd5()
|
||||||
# Verify if the package was corrupted by checking md5sum
|
# Verify if the package was corrupted by checking md5sum
|
||||||
function checkmd5() {
|
function checkmd5() {
|
||||||
local MD5ORIGINAL
|
local MD5ORIGINAL
|
||||||
local MD5DOWNLOAD
|
local MD5DOWNLOAD
|
||||||
local PREPO
|
local PREPO
|
||||||
|
|
||||||
PREPO=$(echo $1 | rev | cut -f3 -d/ | rev)
|
PREPO=$(echo $1 | rev | cut -f3 -d/ | rev)
|
||||||
|
|
||||||
MD5ORIGINAL=$( grep -v "/source/" ${CHECKSUMSFILE} |\
|
MD5ORIGINAL=$(grep -v "/source/" ${CHECKSUMSFILE} | grep -w $PREPO | grep -m1 "/$(basename $1)$" | cut -f1 -d \ )
|
||||||
grep -w $PREPO |\
|
MD5DOWNLOAD=$(md5sum ${1} | cut -f1 -d \ )
|
||||||
grep -m1 "/$(basename $1)$" | cut -f1 -d \ )
|
if [ "$MD5ORIGINAL" = "$MD5DOWNLOAD" ]; then
|
||||||
MD5DOWNLOAD=$(md5sum ${1} | cut -f1 -d \ )
|
echo 1
|
||||||
if [ "$MD5ORIGINAL" = "$MD5DOWNLOAD" ]; then
|
else
|
||||||
echo 1
|
echo 0
|
||||||
else
|
fi
|
||||||
echo 0
|
}
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Found packages in repository.
|
# Found packages in repository.
|
||||||
# This function selects the package from the higher priority
|
# This function selects the package from the higher priority
|
||||||
|
@ -179,40 +177,40 @@ function checkmd5() {
|
||||||
[ "$PKGDATA" ] && break
|
[ "$PKGDATA" ] && break
|
||||||
|
|
||||||
if echo "$CPRIORITY " | grep -q "[a-zA-Z0-9]\+[:]" ; then
|
if echo "$CPRIORITY " | grep -q "[a-zA-Z0-9]\+[:]" ; then
|
||||||
DIR=$(echo "$CPRIORITY" | cut -f1 -d":")
|
DIR=$(echo "$CPRIORITY" | cut -f1 -d":")
|
||||||
PAT=$(echo "$CPRIORITY" | cut -f2- -d":")
|
PAT=$(echo "$CPRIORITY" | cut -f2- -d":")
|
||||||
|
|
||||||
# ARGUMENT is always a basename. But PAT can be:
|
# ARGUMENT is always a basename. But PAT can be:
|
||||||
# 1. a regular expression (ie .*)
|
# 1. a regular expression (ie .*)
|
||||||
# 2. a basename (openjdk)
|
# 2. a basename (openjdk)
|
||||||
# 3. a partial (or complete) package name (vlc-2.0.6, ).
|
# 3. a partial (or complete) package name (vlc-2.0.6, ).
|
||||||
#
|
#
|
||||||
# The current "enhanced priority rule" is applied :
|
# The current "enhanced priority rule" is applied :
|
||||||
# + In case (1) and (2) when ARGUMENT contains the pattern PAT
|
# + In case (1) and (2) when ARGUMENT contains the pattern PAT
|
||||||
# + In the case (3) when ARGUMENT starts the pattern PAT.
|
# + In the case (3) when ARGUMENT starts the pattern PAT.
|
||||||
#
|
#
|
||||||
if echo "$ARGUMENT" | grep -q "$PAT" || echo "$PAT" | grep "^$ARGUMENT" ; then
|
if echo "$ARGUMENT" | grep -q "$PAT" || echo "$PAT" | grep "^$ARGUMENT" ; then
|
||||||
PKGDATA=""
|
PKGDATA=""
|
||||||
PKGINFOS=$(grep -n -m 1 "^${DIR} ${ARGUMENT} " ${TMPDIR}/pkglist)
|
PKGINFOS=$(grep -n -m 1 "^${DIR} ${ARGUMENT} " ${TMPDIR}/pkglist)
|
||||||
|
|
||||||
if [ ! -z "$PKGINFOS" ] ; then
|
if [ ! -z "$PKGINFOS" ] ; then
|
||||||
LINEIDX=$(echo "$PKGINFOS" | cut -f1 -d":")
|
LINEIDX=$(echo "$PKGINFOS" | cut -f1 -d":")
|
||||||
PKGDATA=( $(echo "$PKGINFOS" | cut -f2- -d":") )
|
PKGDATA=( $(echo "$PKGINFOS" | cut -f2- -d":") )
|
||||||
|
|
||||||
# -- move the line at #LINEIDX to #PRIORITYIDX and
|
# -- move the line at #LINEIDX to #PRIORITYIDX and
|
||||||
# increment PRIORITYIDX
|
# increment PRIORITYIDX
|
||||||
#
|
#
|
||||||
sed -i --expression "${LINEIDX}d" --expression "${PRIORITYIDX}i${PKGDATA[*]}" ${TMPDIR}/pkglist
|
sed -i --expression "${LINEIDX}d" --expression "${PRIORITYIDX}i${PKGDATA[*]}" ${TMPDIR}/pkglist
|
||||||
(( PRIORITYIDX++ ))
|
(( PRIORITYIDX++ ))
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
PKGDATA=( $(grep "^${CPRIORITY} ${ARGUMENT} " ${TMPDIR}/pkglist) )
|
PKGDATA=( $(grep "^${CPRIORITY} ${ARGUMENT} " ${TMPDIR}/pkglist) )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$PKGDATA" ]; then
|
if [ "$PKGDATA" ]; then
|
||||||
NAME=${PKGDATA[1]}
|
NAME=${PKGDATA[1]}
|
||||||
FULLNAME=$(echo "${PKGDATA[5]}.${PKGDATA[7]}")
|
FULLNAME=$(echo "${PKGDATA[5]}.${PKGDATA[7]}")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -224,9 +222,9 @@ function checkmd5() {
|
||||||
|
|
||||||
grep -vE "(^#|^[[:blank:]]*$)" ${CONF}/blacklist > ${TMPDIR}/blacklist
|
grep -vE "(^#|^[[:blank:]]*$)" ${CONF}/blacklist > ${TMPDIR}/blacklist
|
||||||
if echo $CMD | grep -q install ; then
|
if echo $CMD | grep -q install ; then
|
||||||
ls -1 /var/log/packages/* | awk -f /usr/libexec/slackpkg/pkglist.awk > ${TMPDIR}/tmplist
|
ls -1 /var/log/packages/* | awk -f /usr/libexec/slackpkg/pkglist.awk > ${TMPDIR}/tmplist
|
||||||
else
|
else
|
||||||
ls -1 /var/log/packages/* | awk -f /usr/libexec/slackpkg/pkglist.awk | applyblacklist > ${TMPDIR}/tmplist
|
ls -1 /var/log/packages/* | awk -f /usr/libexec/slackpkg/pkglist.awk | applyblacklist > ${TMPDIR}/tmplist
|
||||||
fi
|
fi
|
||||||
cat ${WORKDIR}/pkglist | applyblacklist > ${TMPDIR}/pkglist
|
cat ${WORKDIR}/pkglist | applyblacklist > ${TMPDIR}/pkglist
|
||||||
|
|
||||||
|
@ -243,46 +241,46 @@ function checkmd5() {
|
||||||
for i in ${PRIORITY[@]}; do
|
for i in ${PRIORITY[@]}; do
|
||||||
DIR="$i"
|
DIR="$i"
|
||||||
if echo "$DIR" | grep -q "[a-zA-Z0-9]\+[:]" ; then
|
if echo "$DIR" | grep -q "[a-zA-Z0-9]\+[:]" ; then
|
||||||
DIR=$(echo "$i" | cut -f2- -d":")
|
DIR=$(echo "$i" | cut -f2- -d":")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$CMD" == "file-search" ] ; then
|
if [ "$CMD" == "file-search" ] ; then
|
||||||
[ ! -e "${WORKDIR}/${DIR}-filelist.gz" ] && continue
|
[ ! -e "${WORKDIR}/${DIR}-filelist.gz" ] && continue
|
||||||
|
|
||||||
# NOTE:
|
# NOTE:
|
||||||
# The awk below produces an output formatted like
|
# The awk below produces an output formatted like
|
||||||
# in file TMPDIR/pkglist, but without true values
|
# in file TMPDIR/pkglist, but without true values
|
||||||
# for the fields: version(3) arch(4) build(5), path(7),
|
# for the fields: version(3) arch(4) build(5), path(7),
|
||||||
# extension(8)
|
# extension(8)
|
||||||
#
|
#
|
||||||
zegrep -w "${INPUTLIST}" ${WORKDIR}/${DIR}-filelist.gz | \
|
zegrep -w "${INPUTLIST}" ${WORKDIR}/${DIR}-filelist.gz | \
|
||||||
cut -d" " -f 1 | rev | cut -f2- -d"." | cut -f1 -d"/" | rev |\
|
cut -d" " -f 1 | rev | cut -f2- -d"." | cut -f1 -d"/" | rev |\
|
||||||
awk '{
|
awk '{
|
||||||
l_pname=$0
|
l_pname=$0
|
||||||
l_count=split($0,l_parts,"-");
|
l_count=split($0,l_parts,"-");
|
||||||
l_basename=l_parts[1];
|
l_basename=l_parts[1];
|
||||||
for (i=2;i<=l_count-3;i++) {
|
for (i=2;i<=l_count-3;i++) {
|
||||||
l_basename=l_basename"-"l_parts[i];
|
l_basename=l_basename"-"l_parts[i];
|
||||||
}
|
}
|
||||||
print l_dir" "l_basename" ------- ---- ----- "l_pname" ---- ---------"
|
print l_dir" "l_basename" ------- ---- ----- "l_pname" ---- ---------"
|
||||||
}' l_dir=${DIR} > $PKGINFOS
|
}' l_dir=${DIR} > $PKGINFOS
|
||||||
|
|
||||||
else # -- CMD==search
|
else # -- CMD==search
|
||||||
grep "^${DIR}.*${PATTERN}" "${TMPDIR}/pkglist" > $PKGINFOS
|
grep "^${DIR}.*${PATTERN}" "${TMPDIR}/pkglist" > $PKGINFOS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while read PKG ; do
|
while read PKG ; do
|
||||||
PKGDIR=$(echo "$PKG" | cut -f1 -d" ")
|
PKGDIR=$(echo "$PKG" | cut -f1 -d" ")
|
||||||
PKGBASENAME=$(echo "$PKG" | cut -f2 -d" ")
|
PKGBASENAME=$(echo "$PKG" | cut -f2 -d" ")
|
||||||
PKGFULLNAME=$(echo "$PKG" | cut -f6 -d" ")
|
PKGFULLNAME=$(echo "$PKG" | cut -f6 -d" ")
|
||||||
|
|
||||||
if echo "$PKGDIR" | grep -q "SLACKPKGPLUS_" ; then
|
if echo "$PKGDIR" | grep -q "SLACKPKGPLUS_" ; then
|
||||||
grep -q "^repository:${PKGDIR}:basename:${PKGBASENAME}:" $PKGLIST && continue
|
grep -q "^repository:${PKGDIR}:basename:${PKGBASENAME}:" $PKGLIST && continue
|
||||||
else
|
else
|
||||||
grep -q ":basename:${PKGBASENAME}:" $PKGLIST && continue
|
grep -q ":basename:${PKGBASENAME}:" $PKGLIST && continue
|
||||||
fi
|
fi
|
||||||
LIST="$LIST ${PKGDIR}:${PKGFULLNAME}"
|
LIST="$LIST ${PKGDIR}:${PKGFULLNAME}"
|
||||||
echo "repository:${PKGDIR}:basename:${PKGBASENAME}:" >> $PKGLIST
|
echo "repository:${PKGDIR}:basename:${PKGBASENAME}:" >> $PKGLIST
|
||||||
done < $PKGINFOS
|
done < $PKGINFOS
|
||||||
done
|
done
|
||||||
rm -f $PKGLIST $PKGINFOS
|
rm -f $PKGLIST $PKGINFOS
|
||||||
|
@ -309,13 +307,13 @@ function checkmd5() {
|
||||||
PNAME=$(echo "$i" | cut -f2- -d":")
|
PNAME=$(echo "$i" | cut -f2- -d":")
|
||||||
|
|
||||||
if echo "$REPO" | grep -q "SLACKPKGPLUS_" ; then
|
if echo "$REPO" | grep -q "SLACKPKGPLUS_" ; then
|
||||||
REPO=$(echo "$REPO" | cut -f2- -d"_")
|
REPO=$(echo "$REPO" | cut -f2- -d"_")
|
||||||
else
|
else
|
||||||
REPO=""
|
REPO=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$REPO" ] && [ "$BASENAME" = "$(cutpkg ${PNAME})" ]; then
|
if [ -z "$REPO" ] && [ "$BASENAME" = "$(cutpkg ${PNAME})" ]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# BASENAME is base package name
|
# BASENAME is base package name
|
||||||
|
@ -336,26 +334,26 @@ function checkmd5() {
|
||||||
# INSTPKG is local version
|
# INSTPKG is local version
|
||||||
if [ ! "${INSTPKG}" = "" ]; then
|
if [ ! "${INSTPKG}" = "" ]; then
|
||||||
|
|
||||||
# INSTPKG can contains more than one package. But only those
|
# INSTPKG can contains more than one package. But only those
|
||||||
# that match the basename ${BASENAME} must be handled
|
# that match the basename ${BASENAME} must be handled
|
||||||
|
|
||||||
for CINSTPKG in ${INSTPKG} ; do
|
for CINSTPKG in ${INSTPKG} ; do
|
||||||
CBASENAME=$(echo "${CINSTPKG}" | rev | cut -f4- -d- | rev)
|
CBASENAME=$(echo "${CINSTPKG}" | rev | cut -f4- -d- | rev)
|
||||||
|
|
||||||
if [ "${CBASENAME}" == "${BASENAME}" ] ; then
|
if [ "${CBASENAME}" == "${BASENAME}" ] ; then
|
||||||
|
|
||||||
# If installed is it uptodate?
|
# If installed is it uptodate?
|
||||||
if [ "${CINSTPKG}" = "${RAWNAME}" ]; then
|
if [ "${CINSTPKG}" = "${RAWNAME}" ]; then
|
||||||
STATUS=" installed "
|
STATUS=" installed "
|
||||||
printf " %-16s %-24s %-40s \n" "$STATUS" "$REPO" "$CINSTPKG"
|
printf " %-16s %-24s %-40s \n" "$STATUS" "$REPO" "$CINSTPKG"
|
||||||
else
|
else
|
||||||
STATUS="upgrade"
|
STATUS="upgrade"
|
||||||
printf " %-16s %-24s %-40s \n" "$STATUS" "$REPO" "$CINSTPKG --> ${RAWNAME}"
|
printf " %-16s %-24s %-40s \n" "$STATUS" "$REPO" "$CINSTPKG --> ${RAWNAME}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
printf " %-16s %-24s %-40s \n" "$STATUS" "$REPO" "${RAWNAME}"
|
printf " %-16s %-24s %-40s \n" "$STATUS" "$REPO" "${RAWNAME}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -392,53 +390,53 @@ function checkmd5() {
|
||||||
package=$(echo "$pp" | cut -f2- -d":")
|
package=$(echo "$pp" | cut -f2- -d":")
|
||||||
|
|
||||||
if [ ! -z "$repository" ] && [ ! -z "$package" ] ; then
|
if [ ! -z "$repository" ] && [ ! -z "$package" ] ; then
|
||||||
if [ -z "$PREFIX" ] ; then
|
if [ -z "$PREFIX" ] ; then
|
||||||
PREFIX=( SLACKPKGPLUS_${repository}:$package )
|
PREFIX=( SLACKPKGPLUS_${repository}:$package )
|
||||||
else
|
else
|
||||||
PREFIX=( ${PREFIX[*]} SLACKPKGPLUS_${repository}:$package )
|
PREFIX=( ${PREFIX[*]} SLACKPKGPLUS_${repository}:$package )
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
[ ! -z "$PREFIX" ] && PRIORITY=( ${PREFIX[*]} ${PRIORITY[*]} )
|
[ ! -z "$PREFIX" ] && PRIORITY=( ${PREFIX[*]} ${PRIORITY[*]} )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# -- This flag is set when running slackpkg to manage the multilib :
|
# -- This flag is set when running slackpkg to manage the multilib :
|
||||||
#
|
#
|
||||||
# slackpkg install|upgrade|reinstall|remove <multilib_repository_name>
|
# slackpkg install|upgrade|reinstall|remove <multilib_repository_name>
|
||||||
#
|
#
|
||||||
# This is used by applyblacklist() to prevent silent exclusion of
|
# This is used by applyblacklist() to prevent silent exclusion of
|
||||||
# multilib package aaa_elflibs-compat32 when /etc/slackpkg/blacklist
|
# multilib package aaa_elflibs-compat32 when /etc/slackpkg/blacklist
|
||||||
# contains the pattern aaa_elflibs.
|
# contains the pattern aaa_elflibs.
|
||||||
#
|
#
|
||||||
MLREPO_SELELECTED=false
|
MLREPO_SELELECTED=false
|
||||||
|
|
||||||
# -- Ensures the internal blacklist is empty
|
# -- Ensures the internal blacklist is empty
|
||||||
#
|
#
|
||||||
echo -n "" > ${TMPDIR}/blacklist.slackpkgplus
|
echo -n "" > ${TMPDIR}/blacklist.slackpkgplus
|
||||||
|
|
||||||
# Adds the pattern given by $(1) into the internal blacklist
|
# Adds the pattern given by $(1) into the internal blacklist
|
||||||
# ${TMPDIR}/blacklist.slackpkgplus
|
# ${TMPDIR}/blacklist.slackpkgplus
|
||||||
#
|
#
|
||||||
# ($1) The pattern to add.
|
# ($1) The pattern to add.
|
||||||
#
|
#
|
||||||
function internal_blacklist() {
|
function internal_blacklist() {
|
||||||
echo "$1" >> ${TMPDIR}/blacklist.slackpkgplus
|
echo "$1" >> ${TMPDIR}/blacklist.slackpkgplus
|
||||||
}
|
}
|
||||||
|
|
||||||
# Override original applyblackist() so that internal blacklist will
|
# Override original applyblackist() so that internal blacklist will
|
||||||
# be applied too.
|
# be applied too.
|
||||||
#
|
#
|
||||||
function applyblacklist() {
|
function applyblacklist() {
|
||||||
# -- This is to prevent silent exclusion of multilib package
|
# -- This is to prevent silent exclusion of multilib package
|
||||||
# aaa_elflibs-compat32 when /etc/slackpkg/blacklist contains the
|
# aaa_elflibs-compat32 when /etc/slackpkg/blacklist contains the
|
||||||
# pattern aaa_elflibs.
|
# pattern aaa_elflibs.
|
||||||
if $MLREPO_SELELECTED && grep -q "^aaa_elflibs$" ${TMPDIR}/blacklist && ! grep -q "^aaa_elflibs-compat32$" ${TMPDIR}/blacklist ; then
|
if $MLREPO_SELELECTED && grep -q "^aaa_elflibs$" ${TMPDIR}/blacklist && ! grep -q "^aaa_elflibs-compat32$" ${TMPDIR}/blacklist ; then
|
||||||
sed -i --expression "s/^aaa_elflibs/#aaa_elflibs/" ${TMPDIR}/blacklist
|
sed -i --expression "s/^aaa_elflibs/#aaa_elflibs/" ${TMPDIR}/blacklist
|
||||||
grep -vEw -f ${TMPDIR}/blacklist -f ${TMPDIR}/blacklist.slackpkgplus | grep -v "[ ]aaa_elflibs[ ]"
|
grep -vEw -f ${TMPDIR}/blacklist -f ${TMPDIR}/blacklist.slackpkgplus | grep -v "[ ]aaa_elflibs[ ]"
|
||||||
else
|
else
|
||||||
grep -vEw -f ${TMPDIR}/blacklist -f ${TMPDIR}/blacklist.slackpkgplus
|
grep -vEw -f ${TMPDIR}/blacklist -f ${TMPDIR}/blacklist.slackpkgplus
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -466,69 +464,69 @@ function checkmd5() {
|
||||||
for pref in $INPUTLIST ; do
|
for pref in $INPUTLIST ; do
|
||||||
if echo "$pref" | grep -q "[a-zA-Z0-9]\+[:][a-zA-Z0-9]\+" ; then
|
if echo "$pref" | grep -q "[a-zA-Z0-9]\+[:][a-zA-Z0-9]\+" ; then
|
||||||
|
|
||||||
if [ "$CMD" == "install" ] || [ "$CMD" == "upgrade" ] ; then
|
if [ "$CMD" == "install" ] || [ "$CMD" == "upgrade" ] ; then
|
||||||
repository=$(echo "$pref" | cut -f1 -d":")
|
repository=$(echo "$pref" | cut -f1 -d":")
|
||||||
package=$(echo "$pref" | cut -f2- -d":")
|
package=$(echo "$pref" | cut -f2- -d":")
|
||||||
|
|
||||||
PRIORITYLIST=( ${PRIORITYLIST[*]} SLACKPKGPLUS_${repository}:$package )
|
PRIORITYLIST=( ${PRIORITYLIST[*]} SLACKPKGPLUS_${repository}:$package )
|
||||||
fi
|
fi
|
||||||
elif grep -q "^SLACKPKGPLUS_${pref}[ ]" ${WORKDIR}/pkglist ; then
|
elif grep -q "^SLACKPKGPLUS_${pref}[ ]" ${WORKDIR}/pkglist ; then
|
||||||
|
|
||||||
echo "$pref" | grep -qi "multilib" && MLREPO_SELELECTED=true
|
echo "$pref" | grep -qi "multilib" && MLREPO_SELELECTED=true
|
||||||
|
|
||||||
if $MLREPO_SELELECTED && [ "$CMD" == "remove" ] ; then
|
if $MLREPO_SELELECTED && [ "$CMD" == "remove" ] ; then
|
||||||
internal_blacklist "glibc"
|
internal_blacklist "glibc"
|
||||||
internal_blacklist "gcc"
|
internal_blacklist "gcc"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
package="SLACKPKGPLUS_${pref}"
|
package="SLACKPKGPLUS_${pref}"
|
||||||
PRIORITYLIST=( ${PRIORITYLIST[*]} SLACKPKGPLUS_${pref}:.* )
|
PRIORITYLIST=( ${PRIORITYLIST[*]} SLACKPKGPLUS_${pref}:.* )
|
||||||
elif grep -q "^${pref}[ ]" ${WORKDIR}/pkglist ; then
|
elif grep -q "^${pref}[ ]" ${WORKDIR}/pkglist ; then
|
||||||
|
|
||||||
# -- ${pref} relates to one of the standard directories (ie
|
# -- ${pref} relates to one of the standard directories (ie
|
||||||
# slackware,slackware64,testing,extra,...). In this case,
|
# slackware,slackware64,testing,extra,...). In this case,
|
||||||
# packages is set to "^${pref}" to avoid packages outside
|
# packages is set to "^${pref}" to avoid packages outside
|
||||||
# the given "directories" to be selected. For instance,
|
# the given "directories" to be selected. For instance,
|
||||||
# without this, if slackpkg+ is configured with the
|
# without this, if slackpkg+ is configured with the
|
||||||
# repositories "multilib" and "microlinux", running
|
# repositories "multilib" and "microlinux", running
|
||||||
# "slackpkg install slackware64" leads to install packages
|
# "slackpkg install slackware64" leads to install packages
|
||||||
# from slackware64 directory, but also packages from
|
# from slackware64 directory, but also packages from
|
||||||
# "multilib" and "microlinux" repositories, because packages
|
# "multilib" and "microlinux" repositories, because packages
|
||||||
# from these repositories are stored in directories whose
|
# from these repositories are stored in directories whose
|
||||||
# names include the word "slackware64".
|
# names include the word "slackware64".
|
||||||
#
|
#
|
||||||
package="^${pref}"
|
package="^${pref}"
|
||||||
else
|
else
|
||||||
package=$pref
|
package=$pref
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# -- only insert "package" if not in NEWINPUTLIST
|
# -- only insert "package" if not in NEWINPUTLIST
|
||||||
echo "$NEWINPUTLIST" | grep -qw "${package}" || NEWINPUTLIST="$NEWINPUTLIST $package"
|
echo "$NEWINPUTLIST" | grep -qw "${package}" || NEWINPUTLIST="$NEWINPUTLIST $package"
|
||||||
done
|
done
|
||||||
|
|
||||||
INPUTLIST=$NEWINPUTLIST
|
INPUTLIST=$NEWINPUTLIST
|
||||||
|
|
||||||
if [ ! -z "$PRIORITYLIST" ] ; then
|
if [ ! -z "$PRIORITYLIST" ] ; then
|
||||||
NEWPRIORITY=( ${PRIORITYLIST[*]} ${PRIORITY[*]} )
|
NEWPRIORITY=( ${PRIORITYLIST[*]} ${PRIORITY[*]} )
|
||||||
unset PRIORITY
|
unset PRIORITY
|
||||||
|
|
||||||
# -- This is to avoid duplicated priority rules in the variable
|
# -- This is to avoid duplicated priority rules in the variable
|
||||||
# PRIORITY
|
# PRIORITY
|
||||||
#
|
#
|
||||||
for np in ${NEWPRIORITY[*]} ; do
|
for np in ${NEWPRIORITY[*]} ; do
|
||||||
ADD_PRIORITY=true
|
ADD_PRIORITY=true
|
||||||
for cp in ${PRIORITY[*]} ; do
|
for cp in ${PRIORITY[*]} ; do
|
||||||
if [ "$np" == "$cp" ] ; then
|
if [ "$np" == "$cp" ] ; then
|
||||||
ADD_PRIORITY=false
|
ADD_PRIORITY=false
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if $ADD_PRIORITY ; then
|
if $ADD_PRIORITY ; then
|
||||||
PRIORITY=( ${PRIORITY[*]} $np )
|
PRIORITY=( ${PRIORITY[*]} $np )
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -538,23 +536,23 @@ function checkmd5() {
|
||||||
|
|
||||||
case $CMD in
|
case $CMD in
|
||||||
search)
|
search)
|
||||||
if [ "$LIST" = "" ]; then
|
if [ "$LIST" = "" ]; then
|
||||||
echo -e "No package name matches the pattern."
|
echo -e "No package name matches the pattern."
|
||||||
else
|
else
|
||||||
echo -e "The list below shows all packages with name matching \"$PATTERN\".\n"
|
echo -e "The list below shows all packages with name matching \"$PATTERN\".\n"
|
||||||
searchlistEX "$LIST"
|
searchlistEX "$LIST"
|
||||||
echo -e "\nYou can search specific files using \"slackpkg file-search file\".\n"
|
echo -e "\nYou can search specific files using \"slackpkg file-search file\".\n"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
file-search)
|
file-search)
|
||||||
if [ "$LIST" = "" ]; then
|
if [ "$LIST" = "" ]; then
|
||||||
echo -e "No packages contains \"$PATTERN\" file."
|
echo -e "No packages contains \"$PATTERN\" file."
|
||||||
else
|
else
|
||||||
echo -e "The list below shows the packages that contains \"$PATTERN\" file.\n"
|
echo -e "The list below shows the packages that contains \"$PATTERN\" file.\n"
|
||||||
searchlistEX "$LIST"
|
searchlistEX "$LIST"
|
||||||
echo -e "\nYou can search specific packages using \"slackpkg search package\".\n"
|
echo -e "\nYou can search specific packages using \"slackpkg search package\".\n"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue