ports/153398: [update] x11/printscreen update
Alex Kozlov
spam at rm-rf.kiev.ua
Thu Dec 23 08:21:02 UTC 2010
>Number: 153398
>Category: ports
>Synopsis: [update] x11/printscreen update
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: maintainer-update
>Submitter-Id: current-users
>Arrival-Date: Thu Dec 23 08:21:00 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: Alex Kozlov
>Release: RELENG_8
>Organization:
private
>Environment:
>Description:
Update to 1.4
- fix work with custom LOCALBASE/PREFIX
- cleanup
>How-To-Repeat:
>Fix:
Patch attached with submission follows:
Index: x11/printscreen/files/printscreen.in
@@ -1,7 +1,5 @@
#!/bin/sh
-PATH=/bin:/usr/bin:/usr/local/bin
-
xwdcommon='-nobdrs'
xwdroot='-root'
@@ -10,9 +8,14 @@
STOREDIR="${HOME}/.screenshots"
SHOTDATE="$(date +%Y.%m.%d-%H.%M.%S)"
+have()
+{
+ type $1 >/dev/null 2>&1 && return 0
+}
+
parse_options()
{
- local OPT OPTARG OPTIND fmt fmtlist i
+ local OPT OPTARG OPTIND fmt fmtlist prefix
while getopts d:f:bhlqs OPT; do
# escape meta
@@ -26,26 +29,28 @@
unset INFMT
for fmt in pnm pbm pgm ppm; do
- if [ -x /usr/local/bin/${fmt}to${OUTFMT} ]; then
- INFMT=${fmt}
- break
- fi
+ have "${fmt}to${OUTFMT}" && { INFMT=${fmt}; break; }
done
[ -z "${INFMT}" ] && usage
;;
l)
- for i in /usr/local/bin/p[nbgp]mto*; do
- fmtlist="${fmtlist} $(echo ${i} | \
- sed -Ee's:/usr/local/bin/(pnm|pbm|pgm|ppm)to::')"
- done
+ prefix=$(type ppmtoppm 2>/dev/null | \
+ sed 's:ppmtoppm is \(.*\)ppmtoppm:\1:')
+ if [ -z "${prefix}" ]; then
+ echo 'Cannot find image converters. Make sure that netpbm are installed'
+ exit 1
+ fi
+
+ fmtlist=$(echo ${prefix}/p[nbgp]mto* | tr ' ' '\n' | \
+ sed -E 's:^.*/(pnm|pbm|pgm|ppm)to::g')
echo Supported output formats:
echo ${fmtlist}
exit 0
;;
q) xwdcommon="${xwdcommon} -silent";;
s) unset xwdroot ;;
- h|*) usage ;;
+ *) usage ;;
esac
done
@@ -63,7 +68,7 @@
echo ' -q be silent'
echo ' -s interactively choose a window'
echo
- echo "Screenshots stored in ${HOME}/.screenshots"
+ echo "By default screenshots stored in ${STOREDIR}"
echo
exit 1
}
Index: x11/printscreen/Makefile
@@ -6,8 +6,7 @@
#
PORTNAME= printscreen
-PORTVERSION= 1.3
-PORTREVISION= 2
+PORTVERSION= 1.4
CATEGORIES= x11
DISTFILES=
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list