diff options
author | rakuco <rakuco@FreeBSD.org> | 2014-07-09 18:02:58 +0000 |
---|---|---|
committer | rakuco <rakuco@FreeBSD.org> | 2014-07-09 18:02:58 +0000 |
commit | 2eaf11901dacca165bb27d56cf4abfa4ab821dff (patch) | |
tree | ce2d92d2325a0d729292cbb8ef8cf73dd8d275be | |
parent | dd93881302aa06516c3c2c18dfdfe4ded2092b7a (diff) | |
download | FreeBSD-ports-2eaf11901dacca165bb27d56cf4abfa4ab821dff.zip FreeBSD-ports-2eaf11901dacca165bb27d56cf4abfa4ab821dff.tar.gz |
Update to 0.3.
PR: 191577
Submitted by: shen.elf@gmail.com (maintainer)
-rw-r--r-- | ports-mgmt/pkg-rmleaf/Makefile | 2 | ||||
-rw-r--r-- | ports-mgmt/pkg-rmleaf/files/pkg-rmleaf | 43 |
2 files changed, 29 insertions, 16 deletions
diff --git a/ports-mgmt/pkg-rmleaf/Makefile b/ports-mgmt/pkg-rmleaf/Makefile index aeb9675..7bda8a0 100644 --- a/ports-mgmt/pkg-rmleaf/Makefile +++ b/ports-mgmt/pkg-rmleaf/Makefile @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= pkg-rmleaf -PORTVERSION= 0.2 +PORTVERSION= 0.3 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 381827d..c1bd18b 100644 --- a/ports-mgmt/pkg-rmleaf/files/pkg-rmleaf +++ b/ports-mgmt/pkg-rmleaf/files/pkg-rmleaf @@ -1,6 +1,8 @@ #!/bin/sh -# Copyright (c) 2013 Yanhui Shen, shen.elf@gmail.c0m +# version 0.3 + +# Copyright (c) 2014 Yanhui Shen, shen.elf@gmail.c0m # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -24,28 +26,39 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. -#Twiddle="echo '|/-\\' | cut -c" -PkgQuery="pkg query -e \"%#r=0\" \"%o#%c\" | sort" +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" PkgDelete="pkg delete -y" -DialogList="dialog --stdout --checklist \"leaf packages (%s)\" 30 90 30" +FmtDialog="dialog --checklist \"Leaf Packages: %s\" $rows $cols $height %s" KeptLeaves="" while true; do #==== refresh leaves ==== - echo "Calculating..." + echo "Querying..." AllLeaves=`eval $PkgQuery` NewLeaves="" nNewLeaves="0" - #n="0" - IFS=$'\n' + + #IFS=$'\n' + # see http://svnweb.freebsd.org/base?view=revision&revision=221513 + # for compatibility, use the following trick instead + IFS=" +" for line in $AllLeaves; do - # print twiddle will be a little slower - #n=$(($n % 4 + 1)) - #ch=`eval "$Twiddle $n"` - #printf "Calculating...%s\r" "$ch" + case $line in + (*"$sep"*) + port=${line%%"$sep"*} + desc=${line#*"$sep"} + ;; + (*) + echo "Bad line: " $line + exit + ;; + esac - port=`echo "$line" | cut -d'#' -f1` - desc=`echo "$line" | cut -d'#' -f2 | sed -e 's/\"/\\\"/g'` ret=`echo "$KeptLeaves" | grep "$port"` if [ -z "$ret" ]; then NewLeaves="$NewLeaves $port \"$desc\" off" @@ -58,8 +71,8 @@ while true; do echo "Nothing to do!" exit fi - cmd=`printf $DialogList "$nNewLeaves"` - selections=`eval "$cmd $NewLeaves"` + cmd=`printf $FmtDialog "$nNewLeaves" "$NewLeaves"` + selections=`eval "$cmd 3>&2 2>&1 1>&3"` if [ $? -ne 0 ]; then echo "Canceled." exit |