Date: Sat, 19 May 2018 16:21:14 +0000 (UTC) From: Martin Wilke <miwi@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r470416 - in head/ports-mgmt/pkg-rmleaf: . files Message-ID: <201805191621.w4JGLEtK097031@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: miwi Date: Sat May 19 16:21:14 2018 New Revision: 470416 URL: https://svnweb.freebsd.org/changeset/ports/470416 Log: - Update to 0.4 PR: 227828 Submitted by: maintainer Sponsored by: iXsystems Inc. Modified: head/ports-mgmt/pkg-rmleaf/Makefile head/ports-mgmt/pkg-rmleaf/files/pkg-rmleaf head/ports-mgmt/pkg-rmleaf/pkg-descr Modified: head/ports-mgmt/pkg-rmleaf/Makefile ============================================================================== --- head/ports-mgmt/pkg-rmleaf/Makefile Sat May 19 15:53:04 2018 (r470415) +++ head/ports-mgmt/pkg-rmleaf/Makefile Sat May 19 16:21:14 2018 (r470416) @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= pkg-rmleaf -PORTVERSION= 0.3 +PORTVERSION= 0.4 CATEGORIES= ports-mgmt MASTER_SITES= # none DISTFILES= # none Modified: head/ports-mgmt/pkg-rmleaf/files/pkg-rmleaf ============================================================================== --- head/ports-mgmt/pkg-rmleaf/files/pkg-rmleaf Sat May 19 15:53:04 2018 (r470415) +++ head/ports-mgmt/pkg-rmleaf/files/pkg-rmleaf Sat May 19 16:21:14 2018 (r470416) @@ -1,8 +1,8 @@ #!/bin/sh -# version 0.3 +# Version: 0.4 -# Copyright (c) 2014 Yanhui Shen, shen.elf@gmail.c0m +# Copyright (c) 2013-2018 Yanhui Shen # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -29,12 +29,11 @@ cols=$((`stty size | cut -w -f2` - 6)) rows=$((`stty size | cut -w -f1` - 4)) height=$(($rows - 7)) -sep="#" -PkgQuery="pkg query -e \"%#r=0\" \"%o$sep%c\" | sort" +PkgQuery="pkg query -e \"%#r=0\" \"%o %n-%v %c\" | sort -k 1" PkgDelete="pkg delete -y" FmtDialog="dialog --checklist \"Leaf Packages: %s\" $rows $cols $height %s" -KeptLeaves="" +KnownLeaves="" while true; do #==== refresh leaves ==== echo "Querying..." @@ -48,43 +47,41 @@ while true; do IFS=" " for line in $AllLeaves; do - case $line in - (*"$sep"*) - port=${line%%"$sep"*} - desc=${line#*"$sep"} - ;; - (*) - echo "Bad line: " $line - exit - ;; - esac + origin=`echo "$line" | cut -d' ' -f 1` + category=`echo "$origin" | cut -d'/' -f 1` + name=`echo "$line" | cut -d' ' -f 2` + desc=`echo "$line" | cut -d' ' -f 3-` + port="$category:$name" - ret=`echo "$KeptLeaves" | grep "$port"` + ret=`echo "$KnownLeaves" | grep "$name"` if [ -z "$ret" ]; then - NewLeaves="$NewLeaves $port \"$desc\" off" + NewLeaves="$NewLeaves \"$port\" \"$desc\" off" nNewLeaves=$(($nNewLeaves + 1)) fi done #==== show dialog ==== if [ -z "$NewLeaves" ]; then - echo "Nothing to do!" + echo "No more new leaves." exit fi cmd=`printf $FmtDialog "$nNewLeaves" "$NewLeaves"` - selections=`eval "$cmd 3>&2 2>&1 1>&3"` + selected=`eval "$cmd 3>&2 2>&1 1>&3"` if [ $? -ne 0 ]; then echo "Canceled." exit fi - #==== record old leaves ==== - KeptLeaves="$AllLeaves" + #==== save current leaves ==== + KnownLeaves="$AllLeaves" - #==== deinstall selected ==== - if [ -z $selections ]; then - echo "No selection, quit." + #==== extract names ==== + names=`echo $selected | sed 's/[[:alnum:]_-]\{1,\}://g'` + if [ -z $names ]; then + echo "No packages." exit fi - eval "$PkgDelete $selections" + + #==== uninstall selected ==== + eval "$PkgDelete $names" done Modified: head/ports-mgmt/pkg-rmleaf/pkg-descr ============================================================================== --- head/ports-mgmt/pkg-rmleaf/pkg-descr Sat May 19 15:53:04 2018 (r470415) +++ head/ports-mgmt/pkg-rmleaf/pkg-descr Sat May 19 16:21:14 2018 (r470416) @@ -1 +1,3 @@ -A little script for removing leaf packages (requires pkgng). +A little script for removing leaf packages (requires pkg). + +WWW: https://github.com/bsdelf/pkg-rmleaf
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805191621.w4JGLEtK097031>