From 4475726ac1437afeafa6b212688ff913683a9872 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Mon, 9 Nov 2009 21:30:29 +0100 Subject: mass add Signed-off-by: Florian Pritz --- clusterssh/PKGBUILD | 19 + foo2zjs/.directory | 2 + foo2zjs/foo2zjs-20091017-Makefile.patch | 180 ++++++ foo2zjs/foo2zjs-20091017-udevfwld.patch | 236 +++++++ mbuffer/PKGBUILD | 20 + mktorrent-borg/PKGBUILD | 23 + mktorrent/PKGBUILD | 26 + savage2/PKGBUILD | 59 ++ savage2/s2editor.desktop | 11 + savage2/s2mviewer.desktop | 11 + savage2/savage2.desktop | 11 + savage2/savage2.install | 18 + savage2/savage2.launcher | 6 + vim-gnupg/PKGBUILD | 18 + vim-gnupg/vim-gnupg | 1063 +++++++++++++++++++++++++++++++ 15 files changed, 1703 insertions(+) create mode 100644 clusterssh/PKGBUILD create mode 100644 foo2zjs/.directory create mode 100644 foo2zjs/foo2zjs-20091017-Makefile.patch create mode 100644 foo2zjs/foo2zjs-20091017-udevfwld.patch create mode 100644 mbuffer/PKGBUILD create mode 100644 mktorrent-borg/PKGBUILD create mode 100644 mktorrent/PKGBUILD create mode 100644 savage2/PKGBUILD create mode 100644 savage2/s2editor.desktop create mode 100644 savage2/s2mviewer.desktop create mode 100644 savage2/savage2.desktop create mode 100644 savage2/savage2.install create mode 100644 savage2/savage2.launcher create mode 100644 vim-gnupg/PKGBUILD create mode 100644 vim-gnupg/vim-gnupg diff --git a/clusterssh/PKGBUILD b/clusterssh/PKGBUILD new file mode 100644 index 0000000..61ec8c0 --- /dev/null +++ b/clusterssh/PKGBUILD @@ -0,0 +1,19 @@ +# Contributor: Duncan Ferguson +# Maintainer: Macfly +pkgname=clusterssh +pkgver=3.27 +pkgrel=1 +pkgdesc="Cluster SSH opens terminal windows with connections to specified hosts and an administration console." +url="http://clusterssh.sourceforge.net/" +license="GPL" +depends=('xterm' 'perl-tk' 'perl-x11-protocol') +arch=('i686' 'x86_64') +source=(http://downloads.sourceforge.net/project/clusterssh/1.%20ClusterSSH%20Series%203/$pkgver/$pkgname-$pkgver.tar.gz) +md5sums=('47c2bf0a69cacdd279663bc75b3e2f63') + +build() { + cd $srcdir/$pkgname-$pkgver + ./configure --prefix=/usr + make || return 1 + make DESTDIR=$pkgdir install +} diff --git a/foo2zjs/.directory b/foo2zjs/.directory new file mode 100644 index 0000000..5342b22 --- /dev/null +++ b/foo2zjs/.directory @@ -0,0 +1,2 @@ +[Dolphin] +Timestamp=2009,10,19,13,12,43 diff --git a/foo2zjs/foo2zjs-20091017-Makefile.patch b/foo2zjs/foo2zjs-20091017-Makefile.patch new file mode 100644 index 0000000..f2e04de --- /dev/null +++ b/foo2zjs/foo2zjs-20091017-Makefile.patch @@ -0,0 +1,180 @@ +--- a/Makefile 2009-10-10 04:28:28.000000000 -0700 ++++ b/Makefile 2009-10-19 01:02:24.000000000 -0700 +@@ -17,7 +17,6 @@ + + # Installation prefix... + PREFIX=/usr/local +-PREFIX=/usr + PREFIX=$(DESTDIR)/usr + + # Pathnames for this package... +@@ -35,7 +34,7 @@ + INSTALL=install + + # Pathnames for referenced packages... +-FOODB=$(DESTDIR)/usr/share/foomatic/db/source ++FOODB=$(PREFIX)/share/foomatic/db/source + + # User ID's + LPuid=-oroot +@@ -255,7 +254,7 @@ + endif + + # Compiler flags +-CFLAGS += -O2 -Wall ++CFLAGS ?= -O2 -Wall + #CFLAGS += -g + + # +@@ -547,6 +546,8 @@ + UDEVBIN=$(DESTDIR)/bin/ + + install-prog: ++ [ -d $(BIN) ] || install -d -m 755 $(BIN)/ ++ [ -d $(DESTDIR)/bin/ ] || install -d -m 755 $(DESTDIR)/bin/ + # + # Install driver, wrapper, and development tools + # +@@ -554,7 +555,7 @@ + $(INSTALL) -c $(PROGS) $(SHELLS) $(BIN)/ + if [ "$(BINPROGS)" != "" ]; then \ + $(INSTALL) -d $(UDEVBIN); \ +- $(INSTALL) -c $(BINPROGS) $(UDEVBIN); \ ++ install -c $(BINPROGS) $(DESTDIR)/bin/; \ + fi + # + # Install gamma correction files. These are just templates, +@@ -588,6 +589,7 @@ + # + @if [ -d $(FOODB) ]; then \ + for dir in driver printer opt; do \ ++ [ -d $(FOODB)/$$dir/ ] || install -d -m 755 $(FOODB)/$$dir/; \ + echo install -m 644 foomatic-db/$$dir/*.xml $(FOODB)/$$dir/; \ + $(INSTALL) -c -m 644 foomatic-db/$$dir/*.xml $(FOODB)/$$dir/; \ + done \ +@@ -605,10 +607,10 @@ + # + # Clear foomatic cache and rebuild database if needed + # +- rm -rf /var/cache/foomatic/*/* +- rm -f /var/cache/foomatic/printconf.pickle +- if [ -d /var/cache/foomatic/compiled ]; then \ +- cd /var/cache/foomatic/compiled; \ ++ rm -rf $(DESTDIR)/var/cache/foomatic/*/* ++ rm -f $(DESTDIR)/var/cache/foomatic/printconf.pickle ++ if [ -d $(DESTDIR)/var/cache/foomatic/compiled ]; then \ ++ cd $(DESTDIR)/var/cache/foomatic/compiled; \ + foomatic-combo-xml -O >overview.xml; \ + fi + +@@ -722,9 +724,9 @@ + fi; \ + done + +-MODEL=$(DESTDIR)/usr/share/cups/model ++MODEL=$(PREFIX)/share/cups/model + LOCALMODEL=$(DESTDIR)/usr/local/share/cups/model +-PPD=$(DESTDIR)/usr/share/ppd ++PPD=$(PREFIX)/share/ppd + VARPPD=/var/lp/ppd + install-ppd: + # +@@ -740,13 +742,6 @@ + done; \ + ppdmgr -u; \ + elif [ -d $(PPD) ]; then \ +- find $(PPD) -name '*foo2zjs*' | xargs rm -rf; \ +- find $(PPD) -name '*foo2hp*' | xargs rm -rf; \ +- find $(PPD) -name '*foo2xqx*' | xargs rm -rf; \ +- find $(PPD) -name '*foo2lava*' | xargs rm -rf; \ +- find $(PPD) -name '*foo2qpdl*' | xargs rm -rf; \ +- find $(PPD) -name '*foo2slx*' | xargs rm -rf; \ +- find $(PPD) -name '*foo2hiperc*' | xargs rm -rf; \ + [ -d $(PPD)/foo2zjs ] || mkdir $(PPD)/foo2zjs; \ + cd PPD; \ + for ppd in *.ppd; do \ +@@ -767,9 +762,9 @@ + done; \ + fi + +-APPL=$(DESTDIR)/usr/share/applications +-OLDAPPL=$(DESTDIR)/usr/share/gnome/apps/System +-PIXMAPS=$(DESTDIR)/usr/share/pixmaps ++APPL=$(PREFIX)/share/applications ++OLDAPPL=$(PREFIX)/share/gnome/apps/System ++PIXMAPS=$(PREFIX)/share/pixmaps + + install-desktop: + # +@@ -793,10 +788,8 @@ + $(INSTALL) -c -m 755 hplj10xx_gui.tcl $(SHAREZJS) + + +-USBDIR=/etc/hotplug/usb +-UDEVDIR=/etc/udev/rules.d +-RULES=hplj10xx.rules +-install-hotplug: install-hotplug-test install-hotplug-prog ++USBDIR=$(DESTDIR)/etc/hotplug/usb ++install-hotplug: install-hotplug-test install-udev + + install-hotplug-test: + # +@@ -814,9 +807,6 @@ + # + + install-hotplug-prog: +- if [ -d $(UDEVDIR) ]; then \ +- $(INSTALL) -c -m 644 $(RULES) $(UDEVDIR)/11-$(RULES); \ +- fi + [ -d $(USBDIR) ] || $(INSTALL) -d -m 755 $(USBDIR)/ + $(INSTALL) -c -m 755 hplj1000 $(USBDIR)/ + ln -sf $(USBDIR)/hplj1000 $(USBDIR)/hplj1005 +@@ -827,17 +817,13 @@ + ln -sf $(USBDIR)/hplj1000 $(USBDIR)/hpljP1007 + ln -sf $(USBDIR)/hplj1000 $(USBDIR)/hpljP1008 + ln -sf $(USBDIR)/hplj1000 $(USBDIR)/hpljP1505 +- $(USBDIR)/hplj1000 install-usermap +- $(USBDIR)/hplj1005 install-usermap +- $(USBDIR)/hplj1018 install-usermap +- $(USBDIR)/hplj1020 install-usermap +- $(USBDIR)/hpljP1005 install-usermap +- $(USBDIR)/hpljP1006 install-usermap +- $(USBDIR)/hpljP1007 install-usermap +- $(USBDIR)/hpljP1008 install-usermap +- $(USBDIR)/hpljP1505 install-usermap +- # modprobe usblp +- $(USBDIR)/hplj1000 install-usblp ++ install -c -m 644 hplj.usermap $(USBDIR)/ ++ ++UDEVDIR=$(DESTDIR)/lib/udev/rules.d ++RULES=hplj10xx.rules ++install-udev: ++ [ -d $(UDEVDIR) ] || install -d -m 755 $(UDEVDIR)/ ++ install -c -m 644 $(RULES) $(UDEVDIR)/11-$(RULES) + + cups: FRC + if [ -x /etc/init.d/cups ]; then \ +@@ -1234,7 +1220,6 @@ + $(INSTALL) -c -m 644 README $(DOCDIR) + $(INSTALL) -c -m 644 ChangeLog $(DOCDIR) + +-GROFF=/usr/local/test/bin/groff + GROFF=groff + manual.pdf: $(MANPAGES) + -$(GROFF) -t -man $(MANPAGES) | ps2pdf - $@ +--- a/icc2ps/Makefile 2007-11-27 12:13:53.000000000 -0900 ++++ b/icc2ps/Makefile 2008-02-25 20:49:33.000000000 -0900 +@@ -1,11 +1,11 @@ + UNAME := $(shell uname) +-PREFIX= /usr ++PREFIX= $(DESTDIR)/usr + BIN= $(PREFIX)/bin + SRC= icc2ps.c xgetopt.c + LIB= cmscam97.c cmscnvrt.c cmserr.c cmsgamma.c cmsgmt.c cmsintrp.c cmsio1.c \ + cmslut.c cmsmatsh.c cmsmtrx.c cmsnamed.c cmspack.c cmspcs.c cmsps2.c \ + cmssamp.c cmswtpnt.c cmsxform.c cmsio0.c cmsvirt.c +-CFLAGS= -O3 ++CFLAGS?= -O3 + INSTALL=install + ifeq ($(UNAME),SunOS) + INSTALL=/usr/ucb/install diff --git a/foo2zjs/foo2zjs-20091017-udevfwld.patch b/foo2zjs/foo2zjs-20091017-udevfwld.patch new file mode 100644 index 0000000..70dcccc --- /dev/null +++ b/foo2zjs/foo2zjs-20091017-udevfwld.patch @@ -0,0 +1,236 @@ +--- a/Makefile 2009-10-19 01:15:01.000000000 -0700 ++++ b/Makefile 2009-10-19 01:21:11.000000000 -0700 +@@ -19,6 +19,10 @@ + PREFIX=/usr/local + PREFIX=$(DESTDIR)/usr + ++# USB_PRINTERID is also installed there because it is needed by the FWloader ++FWLOADERDIR=$(DESTDIR)/sbin ++FIRMWAREDIR=$(DESTDIR)/lib/firmware ++ + # Pathnames for this package... + BIN=$(PREFIX)/bin + SHAREZJS=$(PREFIX)/share/foo2zjs +@@ -664,21 +668,21 @@ + fi; \ + done + # foo2zjs Firmware files (if any) +- $(INSTALL) $(LPuid) $(LPgid) -m 775 -d $(SHAREZJS)/firmware/ ++ $(INSTALL) $(LPuid) $(LPgid) -m 755 -d $(FIRMWAREDIR)/ + for i in sihp1*.img; do \ + if [ -f $$i ]; then \ + base=`basename $$i .img`; \ + ./arm2hpdl $$i >$$base.dl; \ +- $(INSTALL) -c -m 644 $$base.dl $(SHAREZJS)/firmware/; \ ++ $(INSTALL) -c -m 644 $$base.dl $(FIRMWAREDIR)/; \ + fi; \ + done + # foo2xqx Firmware files (if any) +- $(INSTALL) $(LPuid) $(LPgid) -m 775 -d $(SHAREXQX)/firmware/ ++ $(INSTALL) $(LPuid) $(LPgid) -m 755 -d $(FIRMWAREDIR)/ + for i in sihpP*.img; do \ + if [ -f $$i ]; then \ + base=`basename $$i .img`; \ + ./arm2hpdl $$i >$$base.dl; \ +- $(INSTALL) -c -m 644 $$base.dl $(SHAREXQX)/firmware/; \ ++ $(INSTALL) -c -m 644 $$base.dl $(FIRMWAREDIR)/; \ + fi; \ + done + # foo2oak ICM files (if any) +@@ -822,6 +826,8 @@ + UDEVDIR=$(DESTDIR)/etc/udev/rules.d + RULES=hplj10xx.rules + install-udev: ++ [ -d $(FWLOADERDIR) ] || install -d -m 755 $(FWLOADERDIR)/ ++ install -c -m 755 foo2zjs-loadfw $(FWLOADERDIR)/ + [ -d $(UDEVDIR) ] || install -d -m 755 $(UDEVDIR)/ + install -c -m 644 $(RULES) $(UDEVDIR)/11-$(RULES) + +--- foo2zjs.orig/foo2zjs-loadfw 1969-12-31 14:00:00.000000000 -1000 ++++ foo2zjs/foo2zjs-loadfw 2008-02-25 20:09:13.000000000 -0900 +@@ -0,0 +1,127 @@ ++#!/bin/sh ++ ++# foo2zjs-loadfw: ++# ++# Hotplug script for HP1000/1005/1020 USB laser printers. The model number ++# that this script deals with is determined from the udev env. ++# ++# Used to download firmware automatically into the printer when it ++# is powered up or plugged into the USB port. ++# ++# The inspiration fo this script is from: ++# Oscar Santacreu. Alicante-Spain (2002) ++# Mike Morgan (2004) ++# Modified by Stefan Schweizer (2005) to work as a udev-RUN-script ++ ++# ++# Directory to find downloadable HP firmware files sihpMMMM.dl ++# ++FWDIR=/lib/firmware ++ ++# ++# Program used to determine USB id information ++# ++USBID=/bin/usb_printerid ++ ++# ++# Timeout to load firmware ++# ++TIMEOUT=6 ++ ++# ++# Figure out how to log our messages ++# ++if [ -t 1 ]; then ++ # Running from a tty... ++ log() { ++ echo "$0: $@" ++ } ++elif [ -x /usr/bin/logger ]; then ++ # Have logger... ++ log() { ++ logger -t "$0" -- "$@" ++ } ++else ++ # No logger... ++ log() { ++ echo "$0: $@" >> /var/log/messages ++ } ++fi ++ ++# ++# Figure out the model number from the name of this script ++# ++case "$1" in ++1000) ++ MODEL=1000 ++ MODELNAME="hp LaserJet $MODEL" ++ ;; ++1005) ++ MODEL=1005 ++ MODELNAME="hp LaserJet $MODEL" ++ ;; ++1018) ++ MODEL=1018 ++ MODELNAME="HP LaserJet $MODEL" ++ ;; ++1020) ++ MODEL=1020 ++ MODELNAME="HP LaserJet $MODEL" ++ ;; ++*) ++ log "Only HP LaserJet 1000, 1005, 1018 and 1020 are supported" ++ log "You need to supply one of these on the cmdline: $0 10**" ++ exit ++ ;; ++esac ++ ++if [ -n "$2" ]; then ++ DEVNAME=$2 ++elif [ -n "$DEVNAME" ]; then ++ log 'using $DEVNAME' ++else ++ log "You need to either have $DEVNAME set in the environment or supply it on the cmdline, like:" ++ log "$0 10** /dev/usb/lp0" ++ exit 1 ++fi ++ ++# ++# Procedure to load a single device with firmware ++# ++load1() { ++ fw="$FWDIR/sihp$MODEL.dl" ++ if [ ! -f "$fw" ]; then ++ log "Missing HP LaserJet $MODEL firmware file $fw" ++ log "...read foo2zjs installation instructions and run ./getweb $MODEL" ++ return 1 ++ fi ++ ++ log "loading HP LaserJet $MODEL firmware $fw to $DEVNAME ..." ++ if cat $fw > $DEVNAME; then ++ sleep $TIMEOUT ++ log "... download successful." ++ else ++ log "... download failed." ++ fi ++ return 0 ++} ++ ++# ++# OK, now download firmware to any printers that need it ++# ++if [ -x $USBID ]; then ++ if $USBID $DEVNAME | grep "$MODELNAME" 2> /dev/null; then ++ # This is a LaserJet 100x ++ if $USBID $DEVNAME | grep 'FWVER' 2> /dev/null; then ++ log "HP LaserJet $MODEL firmware already loaded into $DEVNAME" ++ else ++ # Firmware is not yet loaded ++ load1 "$DEVNAME" ++ fi ++ else ++ log "No supported printer found." ++ fi ++else ++ log "HP LaserJet $MODEL firmware was not downloaded..." ++ log "...couldn't find $USBID" ++fi +--- a/hplj1000 2009-09-08 09:08:29.000000000 -0700 ++++ b/hplj1000 2009-10-19 01:35:11.000000000 -0700 +@@ -35,7 +35,7 @@ + # + # Directory to find downloadable HP firmware files sihpMMMM.dl + # +-FWDIR=/usr/share/foo2zjs/firmware ++FWDIR=/lib/firmware + + # + # Program used to determine USB printer id information +--- a/hplj10xx.rules 2008-06-05 02:50:38.000000000 -0700 ++++ b/hplj10xx.rules 2009-10-19 01:47:21.000000000 -0700 +@@ -1,36 +1,8 @@ +-#Own udev rule for HP Laserjet 1000 +-KERNEL=="lp*", BUS=="usb", SYSFS{idVendor}=="03f0", \ +- SYSFS{product}=="hp LaserJet 1000", NAME="usb/%k", \ +- SYMLINK+="hplj1000-%n", MODE="0666", RUN+="/etc/hotplug/usb/hplj1000" +-#Own udev rule for HP Laserjet 1005 +-KERNEL=="lp*", BUS=="usb", SYSFS{idVendor}=="03f0", \ +- SYSFS{product}=="hp LaserJet 1005 series", NAME="usb/%k", \ +- SYMLINK+="hplj1005-%n", MODE="0666", RUN+="/etc/hotplug/usb/hplj1005" +-#Own udev rule for HP Laserjet 1018 +-KERNEL=="lp*", BUS=="usb", SYSFS{idVendor}=="03f0", \ +- SYSFS{product}=="HP LaserJet 1018", NAME="usb/%k", \ +- SYMLINK+="hplj1018-%n", MODE="0666", RUN+="/etc/hotplug/usb/hplj1018" +-#Own udev rule for HP Laserjet 1020 +-KERNEL=="lp*", BUS=="usb", SYSFS{idVendor}=="03f0", \ +- SYSFS{product}=="HP LaserJet 1020", NAME="usb/%k", \ +- SYMLINK+="hplj1020-%n", MODE="0666", RUN+="/etc/hotplug/usb/hplj1020" +-#Own udev rule for HP Laserjet P1005 +-KERNEL=="lp*", BUS=="usb", SYSFS{idVendor}=="03f0", \ +- SYSFS{product}=="HP LaserJet P1005", NAME="usb/%k", \ +- SYMLINK+="hpljP1005-%n", MODE="0666", RUN+="/etc/hotplug/usb/hpljP1005" +-#Own udev rule for HP Laserjet P1006 +-KERNEL=="lp*", BUS=="usb", SYSFS{idVendor}=="03f0", \ +- SYSFS{product}=="HP LaserJet P1006", NAME="usb/%k", \ +- SYMLINK+="hpljP1006-%n", MODE="0666", RUN+="/etc/hotplug/usb/hpljP1006" +-#Own udev rule for HP Laserjet P1007 +-KERNEL=="lp*", BUS=="usb", SYSFS{idVendor}=="03f0", \ +- SYSFS{product}=="HP LaserJet P1007", NAME="usb/%k", \ +- SYMLINK+="hpljP1007-%n", MODE="0666", RUN+="/etc/hotplug/usb/hpljP1007" +-#Own udev rule for HP Laserjet P1008 +-KERNEL=="lp*", BUS=="usb", SYSFS{idVendor}=="03f0", \ +- SYSFS{product}=="HP LaserJet P1008", NAME="usb/%k", \ +- SYMLINK+="hpljP1008-%n", MODE="0666", RUN+="/etc/hotplug/usb/hpljP1008" +-#Own udev rule for HP Laserjet P1505 +-KERNEL=="lp*", BUS=="usb", SYSFS{idVendor}=="03f0", \ +- SYSFS{product}=="HP LaserJet P1505", NAME="usb/%k", \ +- SYMLINK+="hpljP1505-%n", MODE="0666", RUN+="/etc/hotplug/usb/hpljP1505" ++ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \ ++ ATTRS{idProduct}=="0517", RUN+="/sbin/foo2zjs-loadfw 1000 $tempnode" ++ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \ ++ ATTRS{idProduct}=="1317", RUN+="/sbin/foo2zjs-loadfw 1005 $tempnode" ++ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \ ++ ATTRS{idProduct}=="4117", RUN+="/sbin/foo2zjs-loadfw 1018 $tempnode" ++ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \ ++ ATTRS{idProduct}=="2b17", RUN+="/sbin/foo2zjs-loadfw 1020 $tempnode" diff --git a/mbuffer/PKGBUILD b/mbuffer/PKGBUILD new file mode 100644 index 0000000..702bd1f --- /dev/null +++ b/mbuffer/PKGBUILD @@ -0,0 +1,20 @@ +# Maintainer: Florian "Bluewind" Pritz +# Contributor: Tim Karreman +pkgname=mbuffer +pkgver=20090628 +pkgrel=1 +pkgdesc="a tool for buffering data streams" +arch=(i686 x86_64) +url="http://www.maier-komor.de/mbuffer.html" +license=('GPL') +depends=(openssl) +source=(http://www.maier-komor.de/software/mbuffer/$pkgname-$pkgver.tgz) + +build() { + cd $startdir/src/$pkgname-$pkgver + ./configure --prefix=/usr + make || return 1 + make DESTDIR=$startdir/pkg install || return 1 +} +md5sums=('66a39f6e3289f2e181b4861e6a301b01') +sha1sums=('d0f62f672c98faf0f50ace6ba90c40594fb1321a') diff --git a/mktorrent-borg/PKGBUILD b/mktorrent-borg/PKGBUILD new file mode 100644 index 0000000..990196c --- /dev/null +++ b/mktorrent-borg/PKGBUILD @@ -0,0 +1,23 @@ +# Contributor: Grigorios Bouzakis +pkgname=mktorrent-borg +pkgver=0.9.9 +pkgrel=1 +pkgdesc="A handy tool for creating .torrent files for UNIX" +arch=('i686' 'x86_64') +url="http://borg.uu3.net/~borg/?mktorrent" +license=('BSD') +depends=('openssl') +source=(ftp://borg.uu3.net/pub/unix/mktorrent/mktorrent-${pkgver}.tgz) + +build() { + cd "$srcdir/mktorrent" + + make || return 1 + + install -D -m755 mktorrent $pkgdir/usr/bin/mktorrent-borg + install -D -m644 LICENSE $pkgdir/usr/share/licenses/mktorrent/LICENSE +} + +# vim:set ts=2 sw=2 et: +md5sums=('8bdfa36982446f3ccd8549fedefb7448') +sha1sums=('6e4334097ae1e1ae9a6d019c13640bd6355e2605') diff --git a/mktorrent/PKGBUILD b/mktorrent/PKGBUILD new file mode 100644 index 0000000..62c1e44 --- /dev/null +++ b/mktorrent/PKGBUILD @@ -0,0 +1,26 @@ +# Contributor: Emil Renner Berthing + +pkgname=mktorrent +pkgver=1.0 +pkgrel=1 +pkgdesc='Simple command line utility to create BitTorrent metainfo files' +arch=('i686' 'x86_64') +url='http://mktorrent.sourceforge.net/' +license='GPL' +depends=('openssl') +source=("http://downloads.sourceforge.net/mktorrent/mktorrent-${pkgver}.tar.gz") +md5sums=('0da00209da96a0dc39efbb6eb5b4d8ff') + +build() { + cd ${srcdir}/mktorrent-${pkgver} + + if [ "${CARCH}" = 'i686' ]; then + make DESTDIR=${pkgdir} PREFIX=/usr \ + USE_PTHREADS=1 USE_OPENSSL=1 USE_LONG_OPTIONS=1 USE_LARGE_FILES=1 \ + install + else + make DESTDIR=${pkgdir} PREFIX=/usr \ + USE_PTHREADS=1 USE_OPENSSL=1 USE_LONG_OPTIONS=1 \ + install + fi +} diff --git a/savage2/PKGBUILD b/savage2/PKGBUILD new file mode 100644 index 0000000..90ffa23 --- /dev/null +++ b/savage2/PKGBUILD @@ -0,0 +1,59 @@ +# Contributor: Slash +# Contributor: Ali H. Caliskan +# Contributor: Xavier + +pkgname=savage2 +pkgver=2.1.0.1 +pkgrel=1 +pkgdesc="Savage 2: A Tortured Soul is an fantasy themed online multiplayer team-based FPS/RTS/RPG hybrid. Completely free as of December 2008." +arch=('i686' 'x86_64') +url='http://savage2.com/' +license=('custom: "Savage 2"') +depends=('curl' 'mesa' 'libjpeg6' 'libpng' 'libxml2' 'speex') +makedepends=('unzip') +install=savage2.install +source=("http://dl.heroesofnewerth.com/Savage2Install-$pkgver-$CARCH.bin" \ +'savage2.launcher' 'savage2.desktop' 's2editor.desktop' 's2mviewer.desktop') +md5sums=('1ff815b9e864862d6d2cf6c635278b80' + 'fb03853628775f66689852a4125044e8' + 'a6957bb87da35d58df86d84a6dca1479' + 'b082a33fd1a580d3c70d80bbbfb0bffe' + '177155e2c2c4e1382ce9b1343e26b5c7') +[ "$CARCH" = "x86_64" ] && md5sums[0]='78a5df8adc008e2c7493bab9f66a3092' + +build() { + cd $srcdir + + # Create Destination Directory + install -d $pkgdir/opt/savage2 + + # Extract Game Data from Installer + unzip -o $srcdir/Savage2Install-$pkgver-$CARCH.bin + + # Install Savage 2 Data + cp -r $srcdir/data/* $pkgdir/opt/savage2 + + # Install Game Launcher + install -D -m 755 $srcdir/savage2.launcher \ + $pkgdir/usr/bin/savage2 + + # Install Desktop File (Game Client) + install -D -m 644 $srcdir/savage2.desktop \ + $pkgdir/usr/share/applications/savage2.desktop + + # Install Desktop File (Map Editor) + install -D -m 644 $srcdir/s2editor.desktop \ + $pkgdir/usr/share/applications/s2editor.desktop + + # Install Desktop File (Model Viewer) + install -D -m 644 $srcdir/s2mviewer.desktop \ + $pkgdir/usr/share/applications/s2mviewer.desktop + + # Install Icon + install -D -m 644 $srcdir/data/s2icon.png \ + $pkgdir/usr/share/pixmaps/savage2.png + + # Install License + install -D -m 644 $srcdir/data/license.txt \ + $pkgdir/usr/share/licenses/$pkgname/license.txt +} diff --git a/savage2/s2editor.desktop b/savage2/s2editor.desktop new file mode 100644 index 0000000..542b862 --- /dev/null +++ b/savage2/s2editor.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=Savage 2 Map Editor +GenericName=Savage 2 Map Editor +Comment=Map Editor for Savage 2: A Tortured Soul +Exec=/usr/bin/savage2 "PushMod editor; Set host_autoExec StartClient" +Icon=/usr/share/pixmaps/savage2.png +StartupNotify=true +Terminal=false +Type=Application +Categories=Application;Game diff --git a/savage2/s2mviewer.desktop b/savage2/s2mviewer.desktop new file mode 100644 index 0000000..fda6815 --- /dev/null +++ b/savage2/s2mviewer.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=Savage 2 Model Viewer +GenericName=Savage 2 Model Viewer +Comment=Model Viewer for Savage 2: A Tortured Soul +Exec=/usr/bin/savage2 "PushMod modelviewer; Set host_autoExec StartClient" +Icon=/usr/share/pixmaps/savage2.png +StartupNotify=true +Terminal=false +Type=Application +Categories=Application;Game diff --git a/savage2/savage2.desktop b/savage2/savage2.desktop new file mode 100644 index 0000000..e4e6094 --- /dev/null +++ b/savage2/savage2.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=Savage 2 +GenericName=Savage 2 +Comment=Savage 2: A Tortured Soul +Exec=/usr/bin/savage2 +Icon=/usr/share/pixmaps/savage2.png +StartupNotify=true +Terminal=false +Type=Application +Categories=Application;Game diff --git a/savage2/savage2.install b/savage2/savage2.install new file mode 100644 index 0000000..5182e85 --- /dev/null +++ b/savage2/savage2.install @@ -0,0 +1,18 @@ +post_install() { + # Update runpath + cd /opt/savage2 + ./savage2_update.bin --update-runpath +} + +post_upgrade() { + post_install $1 +} + +post_remove() { + echo "==> To completely remove Savage 2, you will need to manually remove" + echo "==> /opt/savage2/ as root" +} + +op=$1 +shift +$op $* diff --git a/savage2/savage2.launcher b/savage2/savage2.launcher new file mode 100644 index 0000000..2e09363 --- /dev/null +++ b/savage2/savage2.launcher @@ -0,0 +1,6 @@ +#!/bin/bash + +cd "/opt/savage2" +./savage2.bin $* +exit $? + diff --git a/vim-gnupg/PKGBUILD b/vim-gnupg/PKGBUILD new file mode 100644 index 0000000..29ca365 --- /dev/null +++ b/vim-gnupg/PKGBUILD @@ -0,0 +1,18 @@ +# Maintainer: Laszlo Papp +pkgname=vim-gnupg +pkgver=2782 +_scriptid=10833 +pkgrel=3 +pkgdesc="Plugin for transparent editing of gpg encrypted files" +arch=('i686' 'x86_64') +url="http://www.vim.org/scripts/script.php?script_id=661" +license=('GPL') +groups=('vim-plugins') +depends=('vim') +source=(${pkgname}::http://www.vim.org/scripts/download_script.php?src_id=${_scriptid}) +md5sums=('0ad10ba6924bb49f3d80eb4d560de0a5') + +build() { + install -Dm644 ${srcdir}/${pkgname} ${pkgdir}/usr/share/vim/vimfiles/plugin/gnupg.vim || return 1 +} + diff --git a/vim-gnupg/vim-gnupg b/vim-gnupg/vim-gnupg new file mode 100644 index 0000000..fdcac93 --- /dev/null +++ b/vim-gnupg/vim-gnupg @@ -0,0 +1,1063 @@ +" Name: gnupg.vim +" Version: $Id: gnupg.vim 2782 2009-06-08 12:32:13Z mbr $ +" Author: Markus Braun +" Summary: Vim plugin for transparent editing of gpg encrypted files. +" Licence: This program is free software; you can redistribute it and/or +" modify it under the terms of the GNU General Public License. +" See http://www.gnu.org/copyleft/gpl.txt +" Section: Documentation {{{1 +" Description: +" +" This script implements transparent editing of gpg encrypted files. The +" filename must have a ".gpg", ".pgp" or ".asc" suffix. When opening such +" a file the content is decrypted, when opening a new file the script will +" ask for the recipients of the encrypted file. The file content will be +" encrypted to all recipients before it is written. The script turns off +" viminfo and swapfile to increase security. +" +" Installation: +" +" Copy the gnupg.vim file to the $HOME/.vim/plugin directory. +" Refer to ':help add-plugin', ':help add-global-plugin' and ':help +" runtimepath' for more details about Vim plugins. +" +" From "man 1 gpg-agent": +" +" ... +" You should always add the following lines to your .bashrc or whatever +" initialization file is used for all shell invocations: +" +" GPG_TTY=`tty` +" export GPG_TTY +" +" It is important that this environment variable always reflects the out‐ +" put of the tty command. For W32 systems this option is not required. +" ... +" +" Commands: +" +" :GPGEditRecipients +" Opens a scratch buffer to change the list of recipients. Recipients that +" are unknown (not in your public key) are highlighted and have +" a prepended "!". Closing the buffer makes the changes permanent. +" +" :GPGViewRecipients +" Prints the list of recipients. +" +" :GPGEditOptions +" Opens a scratch buffer to change the options for encryption (symmetric, +" asymmetric, signing). Closing the buffer makes the changes permanent. +" WARNING: There is no check of the entered options, so you need to know +" what you are doing. +" +" :GPGViewOptions +" Prints the list of options. +" +" Variables: +" +" g:GPGExecutable +" If set used as gpg executable, otherwise the system chooses what is run +" when "gpg" is called. Defaults to "gpg". +" +" g:GPGUseAgent +" If set to 0 a possible available gpg-agent won't be used. Defaults to 1. +" +" g:GPGPreferSymmetric +" If set to 1 symmetric encryption is preferred for new files. Defaults to 0. +" +" g:GPGPreferArmor +" If set to 1 armored data is preferred for new files. Defaults to 0. +" +" g:GPGPreferSign +" If set to 1 signed data is preferred for new files. Defaults to 0. +" +" g:GPGDefaultRecipients +" If set, these recipients are used as defaults when no other recipient is +" defined. This variable is a Vim list. Default is unset. +" +" Known Issues: +" +" In some cases gvim can't decryt files + +" This is caused by the fact that a running gvim has no TTY and thus gpg is +" not able to ask for the passphrase by itself. This is a problem for Windows +" and Linux versions of gvim and could not be solved unless a "terminal +" emulation" is implemented for gvim. To circumvent this you have to use any +" combination of gpg-agent and a graphical pinentry program: +" +" - gpg-agent only: +" you need to provide the passphrase for the needed key to gpg-agent +" in a terminal before you open files with gvim which require this key. +" +" - pinentry only: +" you will get a popup window every time you open a file that needs to +" be decrypted. +" +" - gpgagent and pinentry: +" you will get a popup window the first time you open a file that +" needs to be decrypted. +" +" Credits: +" +" - Mathieu Clabaut for inspirations through his vimspell.vim script. +" - Richard Bronosky for patch to enable ".pgp" suffix. +" - Erik Remmelzwaal for patch to enable windows support and patient beta +" testing. +" - Lars Becker for patch to make gpg2 working. +" - Thomas Arendsen Hein for patch to convert encoding of gpg output +" - Karl-Heinz Ruskowski for patch to fix unknown recipients and trust model +" and patient beta testing. +" - Giel van Schijndel for patch to get GPG_TTY dynamically. +" - Sebastian Luettich for patch to fix issue with symmetric encryption an set +" recipients. +" - Tim Swast for patch to generate signed files +" +" Section: Plugin header {{{1 +if (v:version < 700) + echohl ErrorMsg | echo 'plugin gnupg.vim requires Vim version >= 7.0' | echohl None + finish +endif + +if (exists("g:loaded_gnupg") || &cp || exists("#BufReadPre#*.\(gpg\|asc\|pgp\)")) + finish +endif + +let g:loaded_gnupg = "$Revision: 2782 $" + +" Section: Autocmd setup {{{1 +augroup GnuPG + autocmd! + + " initialize the internal variables + autocmd BufNewFile,BufReadPre,FileReadPre *.\(gpg\|asc\|pgp\) call s:GPGInit() + " force the user to edit the recipient list if he opens a new file and public + " keys are preferred + autocmd BufNewFile *.\(gpg\|asc\|pgp\) if (exists("g:GPGPreferSymmetric") && g:GPGPreferSymmetric == 0) | call s:GPGEditRecipients() | endif + " do the decryption + autocmd BufReadPost,FileReadPost *.\(gpg\|asc\|pgp\) call s:GPGDecrypt() + + " convert all text to encrypted text before writing + autocmd BufWritePre,FileWritePre *.\(gpg\|asc\|pgp\) call s:GPGEncrypt() + " undo the encryption so we are back in the normal text, directly + " after the file has been written. + autocmd BufWritePost,FileWritePost *.\(gpg\|asc\|pgp\) call s:GPGEncryptPost() + + " cleanup on leaving vim + autocmd VimLeave *.\(gpg\|asc\|pgp\) call s:GPGCleanup() +augroup END + +" Section: Constants {{{1 +let s:GPGMagicString = "\t \t" + +" Section: Highlight setup {{{1 +highlight default link GPGWarning WarningMsg +highlight default link GPGError ErrorMsg +highlight default link GPGHighlightUnknownRecipient ErrorMsg + +" Section: Functions {{{1 +" Function: s:GPGInit() {{{2 +" +" initialize the plugin +" +function s:GPGInit() + " first make sure nothing is written to ~/.viminfo while editing + " an encrypted file. + set viminfo= + + " we don't want a swap file, as it writes unencrypted data to disk + set noswapfile + + " check what gpg command to use + if (!exists("g:GPGExecutable")) + let g:GPGExecutable = "gpg --trust-model always" + endif + + " check if gpg-agent is allowed + if (!exists("g:GPGUseAgent")) + let g:GPGUseAgent = 1 + endif + + " check if symmetric encryption is preferred + if (!exists("g:GPGPreferSymmetric")) + let g:GPGPreferSymmetric = 0 + endif + + " check if armored files are preferred + if (!exists("g:GPGPreferArmor")) + let g:GPGPreferArmor = 0 + endif + + " check if signed files are preferred + if (!exists("g:GPGPreferSign")) + let g:GPGPreferSign = 0 + endif + + " check if debugging is turned on + if (!exists("g:GPGDefaultRecipients")) + let g:GPGDefaultRecipients = [] + endif + + " check if debugging is turned on + if (!exists("g:GPGDebugLevel")) + let g:GPGDebugLevel = 0 + endif + + " print version + call s:GPGDebug(1, "gnupg.vim ". g:loaded_gnupg) + + " determine if gnupg can use the gpg-agent + if (exists("$GPG_AGENT_INFO") && g:GPGUseAgent == 1) + if (!exists("$GPG_TTY") && !has("gui_running")) + let $GPG_TTY = system("tty") + if (v:shell_error) + let $GPG_TTY = "" + echohl GPGError + echom "The GPG_TTY is not set and no TTY could be found using the `tty` command!" + echom "gpg-agent might not work." + echohl None + endif + endif + let s:GPGCommand = g:GPGExecutable . " --use-agent" + else + let s:GPGCommand = g:GPGExecutable . " --no-use-agent" + endif + + " don't use tty in gvim + " FIXME find a better way to avoid an error. + " with this solution only --use-agent will work + if (has("gui_running")) + let s:GPGCommand = s:GPGCommand . " --no-tty" + endif + + " setup shell environment for unix and windows + let s:shellredirsave = &shellredir + let s:shellsave = &shell + if (has("unix")) + " unix specific settings + let s:shellredir = &shellredir + let s:shell = 'sh' + let s:stderrredirnull = '2>/dev/null' + let s:GPGCommand = "LANG=C LC_ALL=C " . s:GPGCommand + else + " windows specific settings + let s:shellredir = '>%s' + let s:shell = &shell + let s:stderrredirnull = '2>nul' + endif + + " find the supported algorithms + let &shellredir = s:shellredir + let &shell = s:shell + let output = system(s:GPGCommand . " --version") + let &shellredir = s:shellredirsave + let &shell = s:shellsave + + let s:GPGPubkey = substitute(output, ".*Pubkey: \\(.\\{-}\\)\n.*", "\\1", "") + let s:GPGCipher = substitute(output, ".*Cipher: \\(.\\{-}\\)\n.*", "\\1", "") + let s:GPGHash = substitute(output, ".*Hash: \\(.\\{-}\\)\n.*", "\\1", "") + let s:GPGCompress = substitute(output, ".*Compress: \\(.\\{-}\\)\n.*", "\\1", "") +endfunction + +" Function: s:GPGCleanup() {{{2 +" +" cleanup on leaving vim +" +function s:GPGCleanup() + " wipe out screen + new +only + redraw! +endfunction + +" Function: s:GPGDecrypt() {{{2 +" +" decrypt the buffer and find all recipients of the encrypted file +" +function s:GPGDecrypt() + " switch to binary mode to read the encrypted file + set bin + + " get the filename of the current buffer + let filename = escape(expand("%:p"), '\"') + + " clear GPGEncrypted, GPGRecipients and GPGOptions + let b:GPGEncrypted = 0 + let b:GPGRecipients = [] + let b:GPGOptions = [] + + " find the recipients of the file + let &shellredir = s:shellredir + let &shell = s:shell + let output = system(s:GPGCommand . " --verbose --decrypt --list-only --dry-run --batch --no-use-agent --logger-fd 1 \"" . filename . "\"") + let &shellredir = s:shellredirsave + let &shell = s:shellsave + call s:GPGDebug(1, "output of command '" . s:GPGCommand . " --verbose --decrypt --list-only --dry-run --batch --no-use-agent --logger-fd 1 \"" . filename . "\"' is:") + call s:GPGDebug(1, ">>>>> " . output . " <<<<<") + + " check if the file is symmetric/asymmetric encrypted + if (match(output, "gpg: encrypted with [[:digit:]]\\+ passphrase") >= 0) + " file is symmetric encrypted + let b:GPGEncrypted = 1 + call s:GPGDebug(1, "this file is symmetric encrypted") + + let b:GPGOptions += ["symmetric"] + + " find the used cipher algorithm + let cipher = substitute(output, ".*gpg: \\([^ ]\\+\\) encrypted data.*", "\\1", "") + if (match(s:GPGCipher, "\\<" . cipher . "\\>") >= 0) + let b:GPGOptions += ["cipher-algo " . cipher] + call s:GPGDebug(1, "cipher-algo is " . cipher) + else + echohl GPGWarning + echom "The cipher " . cipher . " is not known by the local gpg command. Using default!" + echo + echohl None + endif + elseif (match(output, "gpg: public key is [[:xdigit:]]\\{8}") >= 0) + " file is asymmetric encrypted + let b:GPGEncrypted = 1 + call s:GPGDebug(1, "this file is asymmetric encrypted") + + let b:GPGOptions += ["encrypt"] + + " find the used public keys + let start = match(output, "gpg: public key is [[:xdigit:]]\\{8}") + while (start >= 0) + let start = start + strlen("gpg: public key is ") + let recipient = strpart(output, start, 8) + call s:GPGDebug(1, "recipient is " . recipient) + let name = s:GPGNameToID(recipient) + if (strlen(name) > 0) + let b:GPGRecipients += [name] + call s:GPGDebug(1, "name of recipient is " . name) + else + let b:GPGRecipients += [recipient] + echohl GPGWarning + echom "The recipient \"" . recipient . "\" is not in your public keyring!" + echohl None + end + let start = match(output, "gpg: public key is [[:xdigit:]]\\{8}", start) + endwhile + else + " file is not encrypted + let b:GPGEncrypted = 0 + call s:GPGDebug(1, "this file is not encrypted") + echohl GPGWarning + echom "File is not encrypted, all GPG functions disabled!" + echohl None + set nobin + return + endif + + " check if the message is armored + if (match(output, "gpg: armor header") >= 0) + call s:GPGDebug(1, "this file is armored") + let b:GPGOptions += ["armor"] + endif + + " finally decrypt the buffer content + " since even with the --quiet option passphrase typos will be reported, + " we must redirect stderr (using shell temporarily) + let &shellredir = s:shellredir + let &shell = s:shell + exec "'[,']!" . s:GPGCommand . " --quiet --decrypt " . s:stderrredirnull + let &shellredir = s:shellredirsave + let &shell = s:shellsave + if (v:shell_error) " message could not be decrypted + silent u + echohl GPGError + let blackhole = input("Message could not be decrypted! (Press ENTER)") + echohl None + bwipeout + set nobin + return + endif + + " turn off binary mode + set nobin + + " call the autocommand for the file minus .gpg$ + execute ":doautocmd BufReadPost " . escape(expand("%:r"), ' *?\"'."'") + call s:GPGDebug(2, "called autocommand for " . escape(expand("%:r"), ' *?\"'."'")) + + " refresh screen + redraw! +endfunction + +" Function: s:GPGEncrypt() {{{2 +" +" encrypts the buffer to all previous recipients +" +function s:GPGEncrypt() + " save window view + let s:GPGWindowView = winsaveview() + call s:GPGDebug(2, "saved window view " . string(s:GPGWindowView)) + + " store encoding and switch to a safe one + if (&fileencoding != &encoding) + let s:GPGEncoding = &encoding + let &encoding = &fileencoding + call s:GPGDebug(2, "encoding was \"" . s:GPGEncoding . "\", switched to \"" . &encoding . "\"") + else + let s:GPGEncoding = "" + call s:GPGDebug(2, "encoding and fileencoding are the same (\"" . &encoding . "\"), not switching") + endif + + " switch buffer to binary mode + set bin + + " guard for unencrypted files + if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0) + echohl GPGWarning + echom "File is not encrypted, all GPG functions disabled!" + echohl None + return + endif + + " initialize GPGOptions if not happened before + if (!exists("b:GPGOptions") || len(b:GPGOptions) == 0) + let b:GPGOptions = [] + if (exists("g:GPGPreferSymmetric") && g:GPGPreferSymmetric == 1) + let b:GPGOptions += ["symmetric"] + let b:GPGRecipients = [] + else + let b:GPGOptions += ["encrypt"] + endif + if (exists("g:GPGPreferArmor") && g:GPGPreferArmor == 1) + let b:GPGOptions += ["armor"] + endif + if (exists("g:GPGPreferSign") && g:GPGPreferSign == 1) + let b:GPGOptions += ["sign"] + endif + call s:GPGDebug(1, "no options set, so using default options: " . string(b:GPGOptions)) + endif + + " built list of options + let options = "" + for option in b:GPGOptions + let options = options . " --" . option . " " + endfor + + " check here again if all recipients are available in the keyring + let [ recipients, unknownrecipients ] = s:GPGCheckRecipients(b:GPGRecipients) + + " check if there are unknown recipients and warn + if (len(unknownrecipients) > 0) + echohl GPGWarning + echom "Please use GPGEditRecipients to correct!!" + echo + echohl None + + " Let user know whats happend and copy known_recipients back to buffer + let dummy = input("Press ENTER to quit") + endif + + " built list of recipients + if (len(recipients) > 0) + for gpgid in recipients + let options = options . " -r " . gpgid + endfor + else + if (match(b:GPGOptions, "encrypt") >= 0) + echohl GPGError + echom "There are no recipients!!" + echom "Please use GPGEditRecipients to correct!!" + echo + echohl None + endif + endif + + " encrypt the buffer + let &shellredir = s:shellredir + let &shell = s:shell + silent exec "'[,']!" . s:GPGCommand . " --quiet --no-encrypt-to " . options . " " . s:stderrredirnull + let &shellredir = s:shellredirsave + let &shell = s:shellsave + call s:GPGDebug(1, "called gpg command is: " . "'[,']!" . s:GPGCommand . " --quiet --no-encrypt-to " . options . " " . s:stderrredirnull) + if (v:shell_error) " message could not be encrypted + " delete content of the buffer to be sure no data is written unencrypted + " content will be recovered in GPGEncryptPost() + silent normal! 1GdG + + echohl GPGError + let blackhole = input("Message could not be encrypted! File might be empty! (Press ENTER)") + echohl None + return + endif + +endfunction + +" Function: s:GPGEncryptPost() {{{2 +" +" undo changes don by encrypt, after writing +" +function s:GPGEncryptPost() + " guard for unencrypted files + if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0) + return + endif + + " undo encryption of buffer content + silent u + + " switch back from binary mode + set nobin + + " restore encoding + if (s:GPGEncoding != "") + let &encoding = s:GPGEncoding + call s:GPGDebug(2, "restored encoding \"" . &encoding . "\"") + endif + + " restore window view + call winrestview(s:GPGWindowView) + call s:GPGDebug(2, "restored window view" . string(s:GPGWindowView)) + + " refresh screen + redraw! +endfunction + +" Function: s:GPGViewRecipients() {{{2 +" +" echo the recipients +" +function s:GPGViewRecipients() + " guard for unencrypted files + if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0) + echohl GPGWarning + echom "File is not encrypted, all GPG functions disabled!" + echohl None + return + endif + + let [ recipients, unknownrecipients ] = s:GPGCheckRecipients(b:GPGRecipients) + + echo 'This file has following recipients (Unknown recipients have a prepended "!"):' + " echo the recipients + for name in recipients + let name = s:GPGIDToName(name) + echo name + endfor + + " echo the unknown recipients + echohl GPGWarning + for name in unknownrecipients + let name = "!" . name + echo name + endfor + echohl None + + " check if there is any known recipient + if (len(recipients) == 0) + echohl GPGError + echom 'There are no known recipients!' + echohl None + endif +endfunction + +" Function: s:GPGEditRecipients() {{{2 +" +" create a scratch buffer with all recipients to add/remove recipients +" +function s:GPGEditRecipients() + " guard for unencrypted files + if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0) + echohl GPGWarning + echom "File is not encrypted, all GPG functions disabled!" + echohl None + return + endif + + " only do this if it isn't already a GPGRecipients_* buffer + if (match(bufname("%"), "^\\(GPGRecipients_\\|GPGOptions_\\)") != 0 && match(bufname("%"), "\.\\(gpg\\|asc\\|pgp\\)$") >= 0) + + " save buffer name + let buffername = bufname("%") + let editbuffername = "GPGRecipients_" . buffername + + " check if this buffer exists + if (!bufexists(editbuffername)) + " create scratch buffer + execute 'silent! split ' . escape(editbuffername, ' *?\"'."'") + + " add a autocommand to regenerate the recipients after a write + autocmd BufHidden,BufUnload,BufWriteCmd call s:GPGFinishRecipientsBuffer() + else + if (bufwinnr(editbuffername) >= 0) + " switch to scratch buffer window + execute 'silent! ' . bufwinnr(editbuffername) . "wincmd w" + else + " split scratch buffer window + execute 'silent! sbuffer ' . escape(editbuffername, ' *?\"'."'") + + " add a autocommand to regenerate the recipients after a write + autocmd BufHidden,BufUnload,BufWriteCmd call s:GPGFinishRecipientsBuffer() + endif + + " empty the buffer + silent normal! 1GdG + endif + + " Mark the buffer as a scratch buffer + setlocal buftype=acwrite + setlocal bufhidden=hide + setlocal noswapfile + setlocal nowrap + setlocal nobuflisted + setlocal nonumber + + " so we know for which other buffer this edit buffer is + let b:GPGCorrespondingTo = buffername + + " put some comments to the scratch buffer + silent put ='GPG: ----------------------------------------------------------------------' + silent put ='GPG: Please edit the list of recipients, one recipient per line.' + silent put ='GPG: Unknown recipients have a prepended \"!\".' + silent put ='GPG: Lines beginning with \"GPG:\" are removed automatically.' + silent put ='GPG: Data after recipients between and including \"(\" and \")\" is ignored.' + silent put ='GPG: Closing this buffer commits changes.' + silent put ='GPG: ----------------------------------------------------------------------' + + " get the recipients + let [ recipients, unknownrecipients ] = s:GPGCheckRecipients(getbufvar(b:GPGCorrespondingTo, "GPGRecipients")) + + " if there are no known or unknown recipients, use the default ones + if (len(recipients) == 0 && len(unknownrecipients) == 0) + if (type(g:GPGDefaultRecipients) == type([])) + let [ recipients, unknownrecipients ] = s:GPGCheckRecipients(g:GPGDefaultRecipients) + else + echohl GPGWarning + echom "g:GPGDefaultRecipients is not a Vim list, please correct this in your vimrc!" + echohl None + endif + endif + + " put the recipients in the scratch buffer + for name in recipients + let name = s:GPGIDToName(name) + silent put =name + endfor + + " put the unknown recipients in the scratch buffer + let syntaxPattern = "\\(nonexxistinwordinthisbuffer" + for name in unknownrecipients + let name = "!" . name + let syntaxPattern = syntaxPattern . "\\|" . name + silent put =name + endfor + let syntaxPattern = syntaxPattern . "\\)" + + " define highlight + if (has("syntax") && exists("g:syntax_on")) + exec('syntax match GPGUnknownRecipient "' . syntaxPattern . '"') + highlight clear GPGUnknownRecipient + highlight link GPGUnknownRecipient GPGHighlightUnknownRecipient + + syntax match GPGComment "^GPG:.*$" + exec 'syntax match GPGComment "' . s:GPGMagicString . '.*$"' + highlight clear GPGComment + highlight link GPGComment Comment + endif + + " delete the empty first line + silent normal! 1Gdd + + " jump to the first recipient + silent normal! G + + endif +endfunction + +" Function: s:GPGFinishRecipientsBuffer() {{{2 +" +" create a new recipient list from RecipientsBuffer +function s:GPGFinishRecipientsBuffer() + " guard for unencrypted files + if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0) + echohl GPGWarning + echom "File is not encrypted, all GPG functions disabled!" + echohl None + return + endif + + " go to buffer before doing work + if (bufnr("%") != expand("")) + " switch to scratch buffer window + execute 'silent! ' . bufwinnr(expand("")) . "wincmd w" + endif + + " delete the autocommand + autocmd! * + + + " get the recipients from the scratch buffer + let recipients = [] + let lines = getline(1,"$") + for recipient in lines + " delete all text after magic string + let recipient = substitute(recipient, s:GPGMagicString . ".*$", "", "") + + " delete all spaces at beginning and end of the recipient + " also delete a '!' at the beginning of the recipient + let recipient = substitute(recipient, "^[[:space:]!]*\\(.\\{-}\\)[[:space:]]*$", "\\1", "") + + " delete comment lines + let recipient = substitute(recipient, "^GPG:.*$", "", "") + + " only do this if the line is not empty + if (strlen(recipient) > 0) + let gpgid = s:GPGNameToID(recipient) + if (strlen(gpgid) > 0) + if (match(recipients, gpgid) < 0) + let recipients += [gpgid] + endif + else + if (match(recipients, recipient) < 0) + let recipients += [recipient] + echohl GPGWarning + echom "The recipient \"" . recipient . "\" is not in your public keyring!" + echohl None + endif + endif + endif + endfor + + " write back the new recipient list to the corresponding buffer and mark it + " as modified. Buffer is now for sure a encrypted buffer. + call setbufvar(b:GPGCorrespondingTo, "GPGRecipients", recipients) + call setbufvar(b:GPGCorrespondingTo, "&mod", 1) + call setbufvar(b:GPGCorrespondingTo, "GPGEncrypted", 1) + + " check if there is any known recipient + if (len(recipients) == 0) + echohl GPGError + echom 'There are no known recipients!' + echohl None + endif + + " reset modified flag + set nomodified +endfunction + +" Function: s:GPGViewOptions() {{{2 +" +" echo the recipients +" +function s:GPGViewOptions() + " guard for unencrypted files + if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0) + echohl GPGWarning + echom "File is not encrypted, all GPG functions disabled!" + echohl None + return + endif + + if (exists("b:GPGOptions")) + echo 'This file has following options:' + " echo the options + for option in b:GPGOptions + echo option + endfor + endif +endfunction + +" Function: s:GPGEditOptions() {{{2 +" +" create a scratch buffer with all recipients to add/remove recipients +" +function s:GPGEditOptions() + " guard for unencrypted files + if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0) + echohl GPGWarning + echom "File is not encrypted, all GPG functions disabled!" + echohl None + return + endif + + " only do this if it isn't already a GPGOptions_* buffer + if (match(bufname("%"), "^\\(GPGRecipients_\\|GPGOptions_\\)") != 0 && match(bufname("%"), "\.\\(gpg\\|asc\\|pgp\\)$") >= 0) + + " save buffer name + let buffername = bufname("%") + let editbuffername = "GPGOptions_" . buffername + + " check if this buffer exists + if (!bufexists(editbuffername)) + " create scratch buffer + execute 'silent! split ' . escape(editbuffername, ' *?\"'."'") + + " add a autocommand to regenerate the options after a write + autocmd BufHidden,BufUnload,BufWriteCmd call s:GPGFinishOptionsBuffer() + else + if (bufwinnr(editbuffername) >= 0) + " switch to scratch buffer window + execute 'silent! ' . bufwinnr(editbuffername) . "wincmd w" + else + " split scratch buffer window + execute 'silent! sbuffer ' . escape(editbuffername, ' *?\"'."'") + + " add a autocommand to regenerate the options after a write + autocmd BufHidden,BufUnload,BufWriteCmd call s:GPGFinishOptionsBuffer() + endif + + " empty the buffer + silent normal! 1GdG + endif + + " Mark the buffer as a scratch buffer + setlocal buftype=nofile + setlocal noswapfile + setlocal nowrap + setlocal nobuflisted + setlocal nonumber + + " so we know for which other buffer this edit buffer is + let b:GPGCorrespondingTo = buffername + + " put some comments to the scratch buffer + silent put ='GPG: ----------------------------------------------------------------------' + silent put ='GPG: THERE IS NO CHECK OF THE ENTERED OPTIONS!' + silent put ='GPG: YOU NEED TO KNOW WHAT YOU ARE DOING!' + silent put ='GPG: IF IN DOUBT, QUICKLY EXIT USING :x OR :bd.' + silent put ='GPG: Please edit the list of options, one option per line.' + silent put ='GPG: Please refer to the gpg documentation for valid options.' + silent put ='GPG: Lines beginning with \"GPG:\" are removed automatically.' + silent put ='GPG: Closing this buffer commits changes.' + silent put ='GPG: ----------------------------------------------------------------------' + + " put the options in the scratch buffer + let options = getbufvar(b:GPGCorrespondingTo, "GPGOptions") + + for option in options + silent put =option + endfor + + " delete the empty first line + silent normal! 1Gdd + + " jump to the first option + silent normal! G + + " define highlight + if (has("syntax") && exists("g:syntax_on")) + syntax match GPGComment "^GPG:.*$" + highlight clear GPGComment + highlight link GPGComment Comment + endif + endif +endfunction + +" Function: s:GPGFinishOptionsBuffer() {{{2 +" +" create a new option list from OptionsBuffer +function s:GPGFinishOptionsBuffer() + " guard for unencrypted files + if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0) + echohl GPGWarning + echom "File is not encrypted, all GPG functions disabled!" + echohl None + return + endif + + " go to buffer before doing work + if (bufnr("%") != expand("")) + " switch to scratch buffer window + execute 'silent! ' . bufwinnr(expand("")) . "wincmd w" + endif + + " clear options and unknownOptions + let options = [] + let unknownOptions = [] + + " delete the autocommand + autocmd! * + + " get the options from the scratch buffer + let lines = getline(1, "$") + for option in lines + " delete all spaces at beginning and end of the option + " also delete a '!' at the beginning of the option + let option = substitute(option, "^[[:space:]!]*\\(.\\{-}\\)[[:space:]]*$", "\\1", "") + " delete comment lines + let option = substitute(option, "^GPG:.*$", "", "") + + " only do this if the line is not empty + if (strlen(option) > 0 && match(options, option) < 0) + let options += [option] + endif + endfor + + " write back the new option list to the corresponding buffer and mark it + " as modified + call setbufvar(b:GPGCorrespondingTo, "GPGOptions", options) + call setbufvar(b:GPGCorrespondingTo, "&mod", 1) + + " reset modified flag + set nomodified +endfunction + +" Function: s:GPGCheckRecipients(tocheck) {{{2 +" +" check if recipients are known +" Returns: two lists recipients and unknownrecipients +function s:GPGCheckRecipients(tocheck) + let recipients = [] + let unknownrecipients = [] + + if (type(a:tocheck) == type([])) + for recipient in a:tocheck + let gpgid = s:GPGNameToID(recipient) + if (strlen(gpgid) > 0) + if (match(recipients, gpgid) < 0) + let recipients += [gpgid] + endif + else + if (match(unknownrecipients, recipient) < 0) + let unknownrecipients += [recipient] + echohl GPGWarning + echom "The recipient \"" . recipient . "\" is not in your public keyring!" + echohl None + endif + end + endfor + endif + + call s:GPGDebug(2, "recipients are: " . string(recipients)) + call s:GPGDebug(2, "unknown recipients are: " . string(unknownrecipients)) + + return [ recipients, unknownrecipients ] +endfunction + +" Function: s:GPGNameToID(name) {{{2 +" +" find GPG key ID corresponding to a name +" Returns: ID for the given name +function s:GPGNameToID(name) + " ask gpg for the id for a name + let &shellredir = s:shellredir + let &shell = s:shell + let output = system(s:GPGCommand . " --quiet --with-colons --fixed-list-mode --list-keys \"" . a:name . "\"") + let &shellredir = s:shellredirsave + let &shell = s:shellsave + + " when called with "--with-colons" gpg encodes its output _ALWAYS_ as UTF-8, + " so convert it, if necessary + if (&encoding != "utf-8") + let output = iconv(output, "utf-8", &encoding) + endif + let lines = split(output, "\n") + + " parse the output of gpg + let pubseen = 0 + let counter = 0 + let gpgids = [] + let choices = "The name \"" . a:name . "\" is ambiguous. Please select the correct key:\n" + for line in lines + let fields = split(line, ":") + " search for the next uid + if (pubseen == 1) + if (fields[0] == "uid") + let choices = choices . " " . fields[9] . "\n" + else + let pubseen = 0 + endif + endif + + " search for the next pub + if (pubseen == 0) + if (fields[0] == "pub") + let identity = fields[4] + let gpgids += [identity] + if exists("*strftime") + let choices = choices . counter . ": ID: 0x" . identity . " created at " . strftime("%c", fields[5]) . "\n" + else + let choices = choices . counter . ": ID: 0x" . identity . "\n" + endif + let counter = counter+1 + let pubseen = 1 + endif + endif + + endfor + + " counter > 1 means we have more than one results + let answer = 0 + if (counter > 1) + let choices = choices . "Enter number: " + let answer = input(choices, "0") + while (answer == "") + let answer = input("Enter number: ", "0") + endwhile + endif + + return get(gpgids, answer, "") +endfunction + +" Function: s:GPGIDToName(identity) {{{2 +" +" find name corresponding to a GPG key ID +" Returns: Name for the given ID +function s:GPGIDToName(identity) + " TODO is the encryption subkey really unique? + + " ask gpg for the id for a name + let &shellredir = s:shellredir + let &shell = s:shell + let output = system(s:GPGCommand . " --quiet --with-colons --fixed-list-mode --list-keys " . a:identity ) + let &shellredir = s:shellredirsave + let &shell = s:shellsave + + " when called with "--with-colons" gpg encodes its output _ALWAYS_ as UTF-8, + " so convert it, if necessary + if (&encoding != "utf-8") + let output = iconv(output, "utf-8", &encoding) + endif + let lines = split(output, "\n") + + " parse the output of gpg + let pubseen = 0 + let uid = "" + for line in lines + let fields = split(line, ":") + if (pubseen == 0) " search for the next pub + if (fields[0] == "pub") + let pubseen = 1 + endif + else " search for the next uid + if (fields[0] == "uid") + let pubseen = 0 + if exists("*strftime") + let uid = fields[9] . s:GPGMagicString . "(ID: 0x" . a:identity . " created at " . strftime("%c", fields[5]) . ")" + else + let uid = fields[9] . s:GPGMagicString . "(ID: 0x" . a:identity . ")" + endif + break + endif + endif + endfor + + return uid +endfunction + +" Function: s:GPGDebug(level, text) {{{2 +" +" output debug message, if this message has high enough importance +function s:GPGDebug(level, text) + if (g:GPGDebugLevel >= a:level) + echom a:text + endif +endfunction + +" Section: Command definitions {{{1 +command! GPGViewRecipients call s:GPGViewRecipients() +command! GPGEditRecipients call s:GPGEditRecipients() +command! GPGViewOptions call s:GPGViewOptions() +command! GPGEditOptions call s:GPGEditOptions() +" Section: Menu {{{1 +if (has("menu")) + amenu Plugin.GnuPG.View\ Recipients :GPGViewRecipients + amenu Plugin.GnuPG.Edit\ Recipients :GPGEditRecipients + amenu Plugin.GnuPG.View\ Options :GPGViewOptions + amenu Plugin.GnuPG.Edit\ Options :GPGEditOptions +endif + +" vim600: set foldmethod=marker foldlevel=0 : -- cgit v1.2.3-24-g4f1b