diff options
author | Martin Wilke <miwi@FreeBSD.org> | 2018-05-19 16:21:14 +0000 |
---|---|---|
committer | Martin Wilke <miwi@FreeBSD.org> | 2018-05-19 16:21:14 +0000 |
commit | a92e14465cf4e5156c5287bd1421420d348a090a (patch) | |
tree | bc0302a0815f23d142679fe7a20403af34680ca2 /ports-mgmt/pkg-rmleaf | |
parent | 88bfda5084730c997693e1ecfcfb71f301a8c174 (diff) | |
download | ports-a92e14465cf4e5156c5287bd1421420d348a090a.tar.gz ports-a92e14465cf4e5156c5287bd1421420d348a090a.zip |
Notes
Diffstat (limited to 'ports-mgmt/pkg-rmleaf')
-rw-r--r-- | ports-mgmt/pkg-rmleaf/Makefile | 2 | ||||
-rw-r--r-- | ports-mgmt/pkg-rmleaf/files/pkg-rmleaf | 47 | ||||
-rw-r--r-- | ports-mgmt/pkg-rmleaf/pkg-descr | 4 |
3 files changed, 26 insertions, 27 deletions
diff --git a/ports-mgmt/pkg-rmleaf/Makefile b/ports-mgmt/pkg-rmleaf/Makefile index 294c7709c1ed..858d8525f6d6 100644 --- a/ports-mgmt/pkg-rmleaf/Makefile +++ b/ports-mgmt/pkg-rmleaf/Makefile @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= pkg-rmleaf -PORTVERSION= 0.3 +PORTVERSION= 0.4 CATEGORIES= ports-mgmt MASTER_SITES= # none DISTFILES= # none diff --git a/ports-mgmt/pkg-rmleaf/files/pkg-rmleaf b/ports-mgmt/pkg-rmleaf/files/pkg-rmleaf index c1bd18b94e8b..70880d421365 100644 --- a/ports-mgmt/pkg-rmleaf/files/pkg-rmleaf +++ b/ports-mgmt/pkg-rmleaf/files/pkg-rmleaf @@ -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 diff --git a/ports-mgmt/pkg-rmleaf/pkg-descr b/ports-mgmt/pkg-rmleaf/pkg-descr index 62593e03f400..d9254a49f491 100644 --- a/ports-mgmt/pkg-rmleaf/pkg-descr +++ b/ports-mgmt/pkg-rmleaf/pkg-descr @@ -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 |