From b0f1bdb4852f588e7b5f69c4083848ee02032241 Mon Sep 17 00:00:00 2001 From: Robby Workman Date: Tue, 2 Feb 2021 22:13:45 -0600 Subject: Do not allow adding blacklist packages from slackpkg exec As of slackpkg shipped with Slackware 15.0, it is no longer supported to add packages to /etc/slackpkg/blacklist using the slackpkg executable; this should only be done with an editor pointing at /etc/slackpkg/blacklist --- files/ChangeLog | 1 + files/core-functions.sh | 28 +++++++--------------------- files/slackpkg | 22 +++++----------------- 3 files changed, 13 insertions(+), 38 deletions(-) (limited to 'files') diff --git a/files/ChangeLog b/files/ChangeLog index 1467af6..93f3b98 100644 --- a/files/ChangeLog +++ b/files/ChangeLog @@ -3,6 +3,7 @@ - add aaa_glibc-solibs and aaa_libraries to the early routine - add 'download' to options in usage() ; remove dupes from manpage (Peter Hyman) + - do not allow adding blacklist packages from slackpkg exec Tue Jan 19 00:29:32 UTC 2021 --------------- diff --git a/files/core-functions.sh b/files/core-functions.sh index 8974008..dcbceae 100644 --- a/files/core-functions.sh +++ b/files/core-functions.sh @@ -425,7 +425,7 @@ function usage() { slackpkg - version $VERSION\n\ \nUsage:\n\ \tslackpkg [OPTIONS] {install|remove|search|file-search| -\t\t\t download|upgrade|reinstall|blacklist} {PATTERN|FILE} +\t\t\t download|upgrade|reinstall} {PATTERN|FILE} \tslackpkg [OPTIONS] {generate-template|install-template|remove-template} \t\t\t TEMPLATENAME \tslackpkg [OPTIONS] info PACKAGE @@ -463,9 +463,6 @@ slackpkg - version $VERSION\n\ \t\t\t\t\tthe official Slackware package set. \t\t\t\t\tRun this if you are upgrading to another \t\t\t\t\tSlackware version or using "current". -\tslackpkg blacklist\t\tBlacklist a package. Blacklisted -\t\t\t\t\tpackages cannot be upgraded, installed, -\t\t\t\t\tor reinstalled by slackpkg \tslackpkg download\t\tOnly download (do not install) a package \tslackpkg info package\t\tShow package information \t\t\t\t\t(works with only ONE package) @@ -647,12 +644,7 @@ function makelist() { done ;; blacklist) - for ARGUMENT in $(echo $INPUTLIST); do - for i in $(cat ${TMPDIR}/pkglist ${TMPDIR}/tmplist | \ - grep -w -- "${ARGUMENT}" | cut -f2 -d\ | sort -u); do - grep -qx "${i}" ${CONF}/blacklist || LIST="$LIST $i" - done - done + /bin/false ;; install|upgrade|reinstall) for ARGUMENT in $(echo $INPUTLIST); do @@ -1248,15 +1240,11 @@ better list:\n" egrep -i -- "^${i}-[^-]+-(${ARCH}|fw|noarch)-" done echo -ne "\n\ -You can (B)lacklist, (R)emove, or (I)gnore these packages.\n\ -Select your action (B/R/I): " +You can (R)emove, or (I)gnore these packages.\n\ +Select your action (R/I): " read ANSWER echo case "$ANSWER" in - B|b) - showlist "$DOUBLEFILES" blacklist - blacklist_pkg - ;; R|r) for i in $DOUBLEFILES ; do FILE=$(ls -1 $ROOT/var/log/packages/ |\ @@ -1268,7 +1256,7 @@ Select your action (B/R/I): " ;; *) echo -e "\n\ -Okay - slackpkg won't do anything now, but please, do something to fix it.\n" +Remove or blacklist the affected packages in order for slackpkg to work properly.\n" cleanup ;; esac @@ -1276,10 +1264,8 @@ Okay - slackpkg won't do anything now, but please, do something to fix it.\n" } function blacklist_pkg() { - echo $SHOWLIST | tr ' ' "\n" >> ${ROOT}/${CONF}/blacklist - - echo -e "\nPackages added to your blacklist.\n\ -If you want to remove those packages, edit ${CONF}/blacklist.\n" + echo -e "\nThis function no longer adds packages to your blacklist.\n\ +As of slackpkg 15.0, you will need to edit ${CONF}/blacklist instead.\n" } function remove_pkg() { diff --git a/files/slackpkg b/files/slackpkg index a4ee4b8..49a1237 100644 --- a/files/slackpkg +++ b/files/slackpkg @@ -214,7 +214,7 @@ while [ -n "$1" ] ; do SOURCE=$(echo $1 | cut -f2 -d=) shift ;; - install|reinstall|upgrade|remove|blacklist|download) + install|reinstall|upgrade|remove|download) CMD=$1 shift if [ -n "$1" ]; then @@ -480,20 +480,8 @@ case "$CMD" in grep -e "^\([a-z]\)" $CONF/blacklist | $MORECMD cleanup fi - - makelist ${INPUTLIST} - for i in $LIST; do - BASENAME=$(cutpkg $i) - BLACKLIST="$BLACKLIST $BASENAME" - done - BLACKLIST=$(echo $BLACKLIST | tr ' ' "\n") - if [ "$BLACKLIST" = "" ]; then - echo -e "No packages match the pattern." - cleanup - else - showlist "$BLACKLIST" $CMD - fi - + + # As of 15.0, this function just runs /bin/false and exits with a comment blacklist_pkg ;; file-search) @@ -605,11 +593,11 @@ esac # # Executes the post-install. This is the default # Before runs post-install, check if the slackpkg option is -# remove, search, update, blacklist, info or clean-system. +# remove, search, update, info or clean-system. # That options don't change configurations files and, if # someone remove the kernel, i hope he knows what is doing. # -for i in check-updates remove search file-search update blacklist info \ +for i in check-updates remove search file-search update info \ clean-system download generate-template remove-template; do if [ "$CMD" = "$i" ]; then POSTINST=off -- cgit v1.2.3