mirror of
https://github.com/zuno/slackpkgplus
synced 2024-12-27 09:58:34 +01:00
Small code cleaning
This commit is contained in:
parent
18ec21c844
commit
5c3a9f01c1
1 changed files with 17 additions and 20 deletions
|
@ -761,24 +761,24 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
)| grep -f - -n -m 1 ${TMPDIR}/pkglist
|
)| grep -f - -n -m 1 ${TMPDIR}/pkglist
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
if [ ! -z "$PKGINFOS" ] ; then
|
if [ ! -z "$PKGINFOS" ] ; then
|
||||||
LINEIDX=${PKGINFOS/:*/} #LINEIDX=$(echo "$PKGINFOS" | cut -f1 -d":")
|
LINEIDX=${PKGINFOS/:*/}
|
||||||
PKGDATA=( ${PKGINFOS/*:/} ) #PKGDATA=( $(echo "$PKGINFOS" | cut -f2- -d":") )
|
PKGDATA=( ${PKGINFOS/*:/} )
|
||||||
mv ${TMPDIR}/pkglist ${TMPDIR}/pkglist.old
|
mv ${TMPDIR}/pkglist ${TMPDIR}/pkglist.old
|
||||||
sed --expression "${LINEIDX}d" --expression "${PRIORITYIDX}i${PKGDATA[*]}" ${TMPDIR}/pkglist.old > ${TMPDIR}/pkglist
|
sed --expression "${LINEIDX}d" --expression "${PRIORITYIDX}i${PKGDATA[*]}" ${TMPDIR}/pkglist.old > ${TMPDIR}/pkglist
|
||||||
(( PRIORITYIDX++ ))
|
(( PRIORITYIDX++ ))
|
||||||
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
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
for CPRIORITY in ${PRIORITY[@]} ; do
|
for CPRIORITY in ${PRIORITY[@]} ; do
|
||||||
[ "$PKGDATA" ] && break
|
[ "$PKGDATA" ] && break
|
||||||
|
|
||||||
DIR=${CPRIORITY/:*/} #DIR=$(echo "$CPRIORITY" | cut -f1 -d":")
|
DIR=${CPRIORITY/:*/}
|
||||||
[[ "$CPRIORITY" =~ .*:.* ]] && PAT=${CPRIORITY/*:/} || PAT="" #PAT=$(echo "$CPRIORITY" | cut -s -f2- -d":")
|
[[ "$CPRIORITY" =~ .*:.* ]] && PAT=${CPRIORITY/*:/} || PAT=""
|
||||||
REPOSITORY=${DIR/SLACKPKGPLUS_/} #REPOSITORY=$(echo "${DIR}" | sed "s/SLACKPKGPLUS_//")
|
REPOSITORY=${DIR/SLACKPKGPLUS_/}
|
||||||
|
|
||||||
# pass to the next iteration when there are priority filters and the
|
# pass to the next iteration when there are priority filters and the
|
||||||
# current repository is not accepted by the defined filter rules ...
|
# current repository is not accepted by the defined filter rules ...
|
||||||
|
@ -787,7 +787,6 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#if echo "$CPRIORITY " | grep -q "^[-_[:alnum:]]\+[:]" ; then
|
|
||||||
if [[ "$CPRIORITY" =~ ^[-_[:alnum:]]+[:] ]] ; then
|
if [[ "$CPRIORITY" =~ ^[-_[:alnum:]]+[:] ]] ; then
|
||||||
|
|
||||||
# [Reminder] ARGUMENT is always a basename, but PAT can be :
|
# [Reminder] ARGUMENT is always a basename, but PAT can be :
|
||||||
|
@ -797,13 +796,11 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
#
|
#
|
||||||
PKGDATA=""
|
PKGDATA=""
|
||||||
LINEIDX=""
|
LINEIDX=""
|
||||||
#grep -n "^${DIR} " ${TMPDIR}/pkglist | grep -w "${PAT}" > ${TMPDIR}/packages.matches
|
|
||||||
#PKGINFOS=$(grep -m 1 "^[[:digit:]]\+:${DIR} ${ARGUMENT} " ${TMPDIR}/packages.matches)
|
|
||||||
PKGINFOS=$(grep -n "^${DIR} " ${TMPDIR}/pkglist | grep 2>/dev/null -w "${PAT}" | grep -m 1 "^[[:digit:]]\+:${DIR} ${ARGUMENT} ")
|
PKGINFOS=$(grep -n "^${DIR} " ${TMPDIR}/pkglist | grep 2>/dev/null -w "${PAT}" | grep -m 1 "^[[:digit:]]\+:${DIR} ${ARGUMENT} ")
|
||||||
|
|
||||||
if [ ! -z "$PKGINFOS" ] ; then
|
if [ ! -z "$PKGINFOS" ] ; then
|
||||||
LINEIDX=${PKGINFOS/:*/} #LINEIDX=$(echo "$PKGINFOS" | cut -f1 -d":")
|
LINEIDX=${PKGINFOS/:*/}
|
||||||
PKGDATA=( ${PKGINFOS/*:/} ) #PKGDATA=( $(echo "$PKGINFOS" | cut -f2- -d":") )
|
PKGDATA=( ${PKGINFOS/*:/} )
|
||||||
fi
|
fi
|
||||||
elif [[ "$CPRIORITY" =~ ^[.][*][:] ]] ; then
|
elif [[ "$CPRIORITY" =~ ^[.][*][:] ]] ; then
|
||||||
PKGDATA=""
|
PKGDATA=""
|
||||||
|
@ -811,8 +808,8 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
PKGINFOS=$(grep 2>/dev/null -n -w "${PAT}" ${TMPDIR}/pkglist | grep -m 1 " ${ARGUMENT} ")
|
PKGINFOS=$(grep 2>/dev/null -n -w "${PAT}" ${TMPDIR}/pkglist | grep -m 1 " ${ARGUMENT} ")
|
||||||
|
|
||||||
if [ ! -z "$PKGINFOS" ] ; then
|
if [ ! -z "$PKGINFOS" ] ; then
|
||||||
LINEIDX=${PKGINFOS/:*/} #LINEIDX=$(echo "$PKGINFOS" | cut -f1 -d":")
|
LINEIDX=${PKGINFOS/:*/}
|
||||||
PKGDATA=( ${PKGINFOS/*:/} ) #PKGDATA=( $(echo "$PKGINFOS" | cut -f2- -d":") )
|
PKGDATA=( ${PKGINFOS/*:/} )
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# $CPRIORITY is of kind "repository" (ie. slackware, extra, patches,...)
|
# $CPRIORITY is of kind "repository" (ie. slackware, extra, patches,...)
|
||||||
|
|
Loading…
Reference in a new issue