summaryrefslogtreecommitdiff
path: root/ptranslate
diff options
context:
space:
mode:
Diffstat (limited to 'ptranslate')
-rw-r--r--ptranslate/Makefile.in58
-rwxr-xr-xptranslate/configure96
-rw-r--r--ptranslate/ptranslate.sh23
-rw-r--r--ptranslate/translators-posix/Makefile.in70
-rw-r--r--ptranslate/translators-posix/x-bzip2.sh7
-rw-r--r--ptranslate/translators-posix/x-gzip.sh7
-rw-r--r--ptranslate/translators-posix/x-tar.sh4
7 files changed, 265 insertions, 0 deletions
diff --git a/ptranslate/Makefile.in b/ptranslate/Makefile.in
new file mode 100644
index 0000000..c8d51dd
--- /dev/null
+++ b/ptranslate/Makefile.in
@@ -0,0 +1,58 @@
+#!/usr/bin/make -f
+name = ptranslate
+ver = 1.9.0
+# Copyright (C) 2009 Luke Shumaker
+#
+# This file is part of pget.
+#
+# pget is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2, or (at your option) any later version.
+#
+# rvs is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rvs; see the file COPYING.
+# If not, write to the Free Software Foundation,
+# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+srcdir = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+
+trans_srcdir = @trans@
+
+INSTALL = install
+MKDIR = $(INSTALL) -d #mkdir -p
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA = $(INSTALL) -m 644
+RM = rm -f
+
+all : translators ptranslate
+install : install-translators $(bindir)/ptranslate
+.PHONY : translators
+.SUFFIXES :
+VPATH = $(srcdir)
+
+translators : ; $(MAKE) -C $(trans_srcdir)
+install-translators : ; $(MAKE) -C $(trans_srcdir) install
+remove-translators : ; $(MAKE) -C $(trans_srcdir) remove
+
+% : %.sh
+ $(INSTALL_PROGRAM) $< $@
+
+$(bindir)/% : %
+ $(INSTALL_PROGRAM) $< $@
+
+Makefile : $(srcdir)/configure
+ $<
+
+remove: remove-translators
+ $(RM) $(bindir)/ptranslate
+
diff --git a/ptranslate/configure b/ptranslate/configure
new file mode 100755
index 0000000..fdccfea
--- /dev/null
+++ b/ptranslate/configure
@@ -0,0 +1,96 @@
+#!/usr/bin/env bash
+name='configure' # rvs configureation script
+#version='0.7.3'
+# Copyright (C) 2009 Luke Shumaker
+#
+# This file is part of rvs.
+#
+# rvs is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2, or (at your option) any later version.
+#
+# rvs is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rvs; see the file COPYING.
+# If not, write to the Free Software Foundation,
+# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ _CC='gcc'
+ _SHELL='/bin/sh'
+ _prefix='/usr/local'
+_exec_prefix='$(prefix)'
+ _bindir='$(exec_prefix)/bin'
+ _sbindir='$(exec_prefix)/sbin'
+ _libexecdir='$(exec_prefix)/libexec'
+ _srcdir=$(readlink -f `dirname "$0"`)
+ _trans='translators-posix'
+
+vars='CC SHELL prefix exec_prefix bindir sbindir libexecdir srcdir'
+
+error() {
+ echo "$name: $1" >> /dev/stderr
+ exit 1
+}
+
+args=`getopt -n "$name" -o "${sopt}" -l "${lopt}${vars}" -- "$@"`
+if [ $? == 0 ]; then
+ set -- $args
+ while [ $# -gt 0 ]; do case "$1" in
+ --) break;;
+ --*)
+ var0="${1/--/}"
+ match='false'
+ for var1 in $vars; do
+ if [ "$var0" == "$var1" ]; then
+ match='true'
+ break;
+ fi
+ done
+ if [ "$match" == 'true' ]; then
+ val="$2"
+ eval _$var0=$val
+ else
+ error "option \`$1' not recognized";
+ fi
+ :;;
+ *) error "option \`$1' not recognized";;
+ esac
+ shift
+ done
+else
+ error 'unable to parse command line arguments'
+fi
+
+echo '#!/bin/sed -f' > var.sed
+for var in $vars; do
+ var1="_$var"
+ val=${!var1}
+
+ # GNU bash optimized version
+ var=${var//':'/'\:'}
+ val=${val//':'/'\:'}
+ # POSIX version
+ #var=`echo "$var" | sed 's@:@\\:@g'`
+ #val=`echo "$val" | sed 's@:@\\:@g'`
+
+ echo "s:@$var@:$val:g" >> var.sed
+done
+
+echo "11 a# DO NOT edit this file, it has been generated by configure, and will
+11 a# be overwritten. Instead, edit the file \`Makefile.in'" >> var.sed
+
+Makefiles=`find "${_srcdir}/" -regextype posix-extended \
+-regex '(.*/)?Makefile\.in' -type f`
+
+for orig in $Makefiles; do
+ new=${orig/%.in/}
+ new=${new/#$_srcdir\//}
+ mkdir -p `dirname "$new"`
+ sed -f var.sed < "${orig}" > "${new}"
+done
+#rm var.sed
+
diff --git a/ptranslate/ptranslate.sh b/ptranslate/ptranslate.sh
new file mode 100644
index 0000000..0c377d1
--- /dev/null
+++ b/ptranslate/ptranslate.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+# pget translate
+ver="1.9.0"
+#
+# Copyright (C) 2009 Luke Shumaker
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
+
+file="$1"
+echo "$file" >> /dev/stderr
+mime=`file -bi "$file"`
+echo "$mime" >> /dev/stderr
+translator="/usr/local/libexec/media-types/$mime"
+if [ -e "$translator" ]; then
+ "$0" "`"$translator" "$file"`"
+else
+ echo "$file"
+fi
+
diff --git a/ptranslate/translators-posix/Makefile.in b/ptranslate/translators-posix/Makefile.in
new file mode 100644
index 0000000..91f8c9c
--- /dev/null
+++ b/ptranslate/translators-posix/Makefile.in
@@ -0,0 +1,70 @@
+#!/usr/bin/make -f
+ver = 1.9.0
+# Copyright (C) 2009 Luke Shumaker
+#
+# This file is part of pget.
+#
+# pget is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2, or (at your option) any later version.
+#
+# rvs is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rvs; see the file COPYING.
+# If not, write to the Free Software Foundation,
+# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+srcdir ?= @srcdir@/translators
+prefix ?= @prefix@
+exec_prefix ?= @exec_prefix@
+bindir ?= @bindir@
+sbindir ?= @sbindir@
+libexecdir ?= @libexecdir@
+
+INSTALL ?= install
+MKDIR ?= $(INSTALL) -d #mkdir -p
+INSTALL_PROGRAM ?= $(INSTALL)
+INSTALL_DATA ?= $(INSTALL) -m 644
+RM ?= rm -f
+
+all : x-bzip2 x-gzip x-tar
+install : mime install-x-bzip2 install-x-gzip install-x-tar
+.PHONY : install-x-bzip2 install-x-gzip install-x-tar
+.SUFFIXES :
+VPATH = $(srcdir)
+
+mime :
+ $(MKDIR) $(libexecdir)/media-types
+ $(MKDIR) $(libexecdir)/media-types/application
+ $(MKDIR) $(libexecdir)/media-types/audio
+ $(MKDIR) $(libexecdir)/media-types/image
+ $(MKDIR) $(libexecdir)/media-types/message
+ $(MKDIR) $(libexecdir)/media-types/model
+ $(MKDIR) $(libexecdir)/media-types/multipart
+ $(MKDIR) $(libexecdir)/media-types/text
+ $(MKDIR) $(libexecdir)/media-types/video
+
+
+install-x-bzip2: $(libexecdir)/media-types/application/x-bzip2
+install-x-gzip : $(libexecdir)/media-types/application/x-gzip
+install-x-tar : $(libexecdir)/media-types/application/x-tar
+
+$(libexecdir)/media-types/application/% : % mime; $(INSTALL_PROGRAM) $< $@
+$(libexecdir)/media-types/audio/% : % mime; $(INSTALL_PROGRAM) $< $@
+$(libexecdir)/media-types/image/% : % mime; $(INSTALL_PROGRAM) $< $@
+$(libexecdir)/media-types/message/% : % mime; $(INSTALL_PROGRAM) $< $@
+$(libexecdir)/media-types/model/% : % mime; $(INSTALL_PROGRAM) $< $@
+$(libexecdir)/media-types/multipart/% : % mime; $(INSTALL_PROGRAM) $< $@
+$(libexecdir)/media-types/text/% : % mime; $(INSTALL_PROGRAM) $< $@
+$(libexecdir)/media-types/video/% : % mime; $(INSTALL_PROGRAM) $< $@
+
+remove :
+ $(RM) -r $(libexecdir)/media-types
+
+% : %.sh
+ $(INSTALL_PROGRAM) $< $@
+
diff --git a/ptranslate/translators-posix/x-bzip2.sh b/ptranslate/translators-posix/x-bzip2.sh
new file mode 100644
index 0000000..0402784
--- /dev/null
+++ b/ptranslate/translators-posix/x-bzip2.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+file="$1"
+bzip2 -dk "$file"
+out="`echo "$file" | sed -r 's/\.(bz2)|(bz)|(tbz2)|(tbz)|(bzip2)$//'`"
+if [ "$out" == "$file" ]; then out="$out.out"; fi
+echo "$out"
+
diff --git a/ptranslate/translators-posix/x-gzip.sh b/ptranslate/translators-posix/x-gzip.sh
new file mode 100644
index 0000000..6177b7f
--- /dev/null
+++ b/ptranslate/translators-posix/x-gzip.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+file="$1"
+tmp=`mktemp`
+cp "$file" "$tmp"
+gzip -dN "$file"
+mv "$tmp" "$file"
+
diff --git a/ptranslate/translators-posix/x-tar.sh b/ptranslate/translators-posix/x-tar.sh
new file mode 100644
index 0000000..d7a5872
--- /dev/null
+++ b/ptranslate/translators-posix/x-tar.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+cd `dirname "$1"`
+tar -xvf "$1" | sort | sed 's:/.*::' | uniq
+