diff options
author | B. Watson <yalhcru@gmail.com> | 2018-07-06 22:51:04 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2018-07-07 06:54:18 +0700 |
commit | a274538685d16c0f4e6a6e05121a2600f010bc11 (patch) | |
tree | db9d6dd017c59eae6824f92cb83a43cee9b926c7 /system/snapscreenshot | |
parent | a2dcdb585af8af69ff73c3e11de684a8906badb9 (diff) |
system/snapscreenshot: Added (screenshot program for text consoles).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/snapscreenshot')
-rw-r--r-- | system/snapscreenshot/NOTES.txt | 29 | ||||
-rw-r--r-- | system/snapscreenshot/README | 15 | ||||
-rw-r--r-- | system/snapscreenshot/errors_to_stderr.diff | 42 | ||||
-rw-r--r-- | system/snapscreenshot/manpage.diff | 18 | ||||
-rw-r--r-- | system/snapscreenshot/slack-desc | 19 | ||||
-rw-r--r-- | system/snapscreenshot/snapscreenshot.SlackBuild | 87 | ||||
-rw-r--r-- | system/snapscreenshot/snapscreenshot.cur | 22 | ||||
-rw-r--r-- | system/snapscreenshot/snapscreenshot.info | 10 |
8 files changed, 242 insertions, 0 deletions
diff --git a/system/snapscreenshot/NOTES.txt b/system/snapscreenshot/NOTES.txt new file mode 100644 index 000000000000..3acfd2a9b994 --- /dev/null +++ b/system/snapscreenshot/NOTES.txt @@ -0,0 +1,29 @@ +Notes: + +snapscreenshot is *fast*, when compared to fbdump and fbcat. However, +the reason it's so fast is that it doesn't read the graphic content of +the framebuffer. Instead, the text content of the screen is read (from +the /dev/vcs* devices) and rendered in the current console font... which +is the current font of the console you executed snapscreenshot from, +*not* the font in the console you're taking a snapshot of! + +Also, custom fonts just don't work well with snapscreenshot. Depending +on the font, you may get an error (GIO_FONTX), a segmentation fault, +or else the resulting screenshot is garbled. + +Because /dev/vcs* is used, snapscreenshot does NOT work for taking +screenshots of software that actually uses the framebuffer for graphics, +e.g. fbpdf, feh, "mplayer -vo fbdev", "links -g -driver fb". For these, +use fbcat or fbdump instead. + +By default, the text on all the consoles ends up in the output image. To +take a shot of only one console, use a command like: + +# snapscreenshot --firstwin 1 -c1 -x1 > shot.tga + +...or use this: + +# snapscreenshot.cur > shot.tgz + +The snapscreenshot.cur script was written by the SlackBuild author, +and is not part of snapscreenshot itself. diff --git a/system/snapscreenshot/README b/system/snapscreenshot/README new file mode 100644 index 000000000000..efa597e5a066 --- /dev/null +++ b/system/snapscreenshot/README @@ -0,0 +1,15 @@ +snapscreenshot (screenshot program for text consoles) + +snapscreenshot creates a .tga (Targa) image file from the text contents +of the Linux framebuffer consoles (by default, all of the consoles, +tiled in a single image). + +This probably doesn't work for non-framebuffer consoles (not tested). + +By default, snapscreenshot is installed setuid root and executable by +users in the 'video' group. Normally on Slackware, users logged in at +the console are in the 'video' group by default. If you don't like this, +export SETUID=no in the script's environment. This will require root +access (e.g. su or sudo) for snapscreenshot to work. + +See NOTES.txt for more information. diff --git a/system/snapscreenshot/errors_to_stderr.diff b/system/snapscreenshot/errors_to_stderr.diff new file mode 100644 index 000000000000..d769e262bd42 --- /dev/null +++ b/system/snapscreenshot/errors_to_stderr.diff @@ -0,0 +1,42 @@ +diff -Naur snapscreenshot-1.0.14.3/argh.c snapscreenshot-1.0.14.3.patched/argh.c +--- snapscreenshot-1.0.14.3/argh.c 2009-08-31 07:23:26.000000000 -0400 ++++ snapscreenshot-1.0.14.3.patched/argh.c 2018-07-04 17:48:36.194652959 -0400 +@@ -13,7 +13,7 @@ + long tmp = strtol(*s, (char **)s, 10); + if(tmp<min || tmp>max) + { +- printf("%s: parameter (--%s) value out of range `%ld'\n", ProgName, LastParm, tmp); ++ fprintf(stderr, "%s: parameter (--%s) value out of range `%ld'\n", ProgName, LastParm, tmp); + exit(EXIT_FAILURE); + } + return tmp; +@@ -21,14 +21,14 @@ + + void SuggestHelp(void) + { +- printf("\nTry `%s --help' for more information.\n", ProgName); ++ fprintf(stderr, "\nTry `%s --help' for more information.\n", ProgName); + } + void ArgError(int a, const char *b) + { + switch(a) + { + case 0: +- printf("%s: illegal option -- %c", ProgName, *b); ++ fprintf(stderr, "%s: illegal option -- %c", ProgName, *b); + for(a=0; Options[a].c; a++) + if(*b == Options[a].c) + { +@@ -37,10 +37,10 @@ + } + break; + case 1: +- printf("%s: unrecognized option `--%s'", ProgName, b); ++ fprintf(stderr, "%s: unrecognized option `--%s'", ProgName, b); + break; + default: +- printf("%s: invalid parameter: `%s'\n", ProgName, b); ++ fprintf(stderr, "%s: invalid parameter: `%s'\n", ProgName, b); + } + SuggestHelp(); + exit(EXIT_FAILURE); diff --git a/system/snapscreenshot/manpage.diff b/system/snapscreenshot/manpage.diff new file mode 100644 index 000000000000..73146a362f3e --- /dev/null +++ b/system/snapscreenshot/manpage.diff @@ -0,0 +1,18 @@ +diff -Naur snapscreenshot-1.0.14.3/snapscreenshot.1 snapscreenshot-1.0.14.3.patched/snapscreenshot.1 +--- snapscreenshot-1.0.14.3/snapscreenshot.1 2009-08-31 07:23:26.000000000 -0400 ++++ snapscreenshot-1.0.14.3.patched/snapscreenshot.1 2018-07-04 17:55:43.011642115 -0400 +@@ -14,8 +14,12 @@ + console(s) and outputs a Targa file. + You can use convert(1) to convert the resulting image to various formats. + .SH OPTIONS +-This program follows the usual GNU command line syntax, with long +-options starting with two dashes (`-'). ++This program follows vaguely GNU-like command line syntax, with long ++options starting with two dashes (`\-'). Long options that take an ++argument require a space before the argument (an `=' is not accepted), ++and short options that take an argument do NOT allow a space (use ++\fB\-c1\fR, NOT \fB\-c 1\fR). ++.PP + A summary of options is included below. + .TP + .B \-h, \-\-help diff --git a/system/snapscreenshot/slack-desc b/system/snapscreenshot/slack-desc new file mode 100644 index 000000000000..f0c1dafe4653 --- /dev/null +++ b/system/snapscreenshot/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +snapscreenshot: snapscreenshot (screenshot program for text consoles) +snapscreenshot: +snapscreenshot: snapscreenshot creates a .tga (Targa) image file from the text +snapscreenshot: contents of the Linux framebuffer console (by default, all of the +snapscreenshot: consoles, tiled in a single image). +snapscreenshot: +snapscreenshot: +snapscreenshot: +snapscreenshot: +snapscreenshot: +snapscreenshot: diff --git a/system/snapscreenshot/snapscreenshot.SlackBuild b/system/snapscreenshot/snapscreenshot.SlackBuild new file mode 100644 index 000000000000..5c6d716405d1 --- /dev/null +++ b/system/snapscreenshot/snapscreenshot.SlackBuild @@ -0,0 +1,87 @@ +#!/bin/sh + +# Slackware build script for snapscreenshot + +# Written by B. Watson (yalhcru@gmail.com) + +# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. + +PRGNAM=snapscreenshot +VERSION=${VERSION:-1.0.14.3} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2 +cd $PRGNAM-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \+ -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+ + +# It's really annoying to have errors sent to stdout, when the main +# way to use the program is to redirect stdout to a file... +patch -p1 < $CWD/errors_to_stderr.diff + +# It's also annoying that -c1 is accepted, but -c 1 isn't. Likewise +# --firstwin 1, but not --firstwin=1. Not going to fix the code, but at +# least the man page can document it. +patch -p1 < $CWD/manpage.diff + +make CFLAGS="$SLKCFLAGS" CXXFLAGS="$SLKCFLAGS" +mkdir -p $PKG/usr/bin $PKG/usr/man/man1 +install -s -m0755 $PRGNAM $PKG/usr/bin +gzip -9c < $PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz + +# Include this script, because pretty much everyone who ever uses this +# will either write their own version, or wish they knew how... +install -m0755 -oroot -groot $CWD/$PRGNAM.cur $PKG/usr/bin + +if [ "${SETUID:-yes}" = "yes" ]; then + chown root:video $PKG/usr/bin/$PRGNAM + chmod 4750 $PKG/usr/bin/$PRGNAM +fi + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a README* COPYING $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/snapscreenshot/snapscreenshot.cur b/system/snapscreenshot/snapscreenshot.cur new file mode 100644 index 000000000000..b674c0a8e0e4 --- /dev/null +++ b/system/snapscreenshot/snapscreenshot.cur @@ -0,0 +1,22 @@ +#!/bin/sh + +# 20180704 bkw: wrapper for snapscreenshot, determines the current tty +# and takes a screenshot of it by calling snapscreenshot with the +# appropriate arguments. + +# I tried to make this work under X. You can find out which tty X is using +# with: xprop -root | grep ^XFree86_VT | cut -d' ' -f3 +# However snapscreenshot itself fails because that console will be in +# graphics mode (no text to read from /dev/vcs$TTY, so it'd give a +# blank image). + +TTY="$( tty )" +case "$TTY" in + /dev/tty?) TTY="$( echo $TTY | cut -dy -f2 )" + ;; + *) echo "You must run this from a console login session, not e.g. X or ssh" 1>&2 + exit 1 + ;; +esac + +exec snapscreenshot --firstwin "$TTY" -c1 -x1 "$@" diff --git a/system/snapscreenshot/snapscreenshot.info b/system/snapscreenshot/snapscreenshot.info new file mode 100644 index 000000000000..e6d21eb10395 --- /dev/null +++ b/system/snapscreenshot/snapscreenshot.info @@ -0,0 +1,10 @@ +PRGNAM="snapscreenshot" +VERSION="1.0.14.3" +HOMEPAGE="https://bisqwit.iki.fi/source/snapscreenshot.html" +DOWNLOAD="http://www.pc-freak.net/files/snapscreenshot-1.0.14.3.tar.bz2" +MD5SUM="6332e26ed7b6bbddf1a3c3d11f82c39a" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="B. Watson" +EMAIL="yalhcru@gmail.com" |