From 2906706dbaeb4eb4142f928d1ead0812461f2e78 Mon Sep 17 00:00:00 2001 Message-Id: <2906706dbaeb4eb4142f928d1ead0812461f2e78.1717030047.git.mdw@distorted.org.uk> From: Mark Wooding Date: Fri, 6 May 2005 09:56:28 +0000 Subject: [PATCH] Debianize. Organization: Straylight/Edgeware From: mdw --- Makefile | 58 +++++++++++++++++++++++++++++++++++++++----- debian/changelog | 5 ++++ debian/control | 25 +++++++++++++++++++ debian/copyright | 16 ++++++++++++ debian/noip.install | 3 +++ debian/rules | 48 ++++++++++++++++++++++++++++++++++++ debian/uopen.install | 3 +++ noip | 6 ----- uopen => withlib.in | 2 +- 9 files changed, 153 insertions(+), 13 deletions(-) create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/noip.install create mode 100755 debian/rules create mode 100644 debian/uopen.install delete mode 100755 noip rename uopen => withlib.in (56%) mode change 100755 => 100644 diff --git a/Makefile b/Makefile index dcf4b74..eaab421 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,63 @@ +PACKAGE = preload-hacks +VERSION = 1.0.0 + +prefix = /usr/local +exec_prefix = ${prefix} +bindir = ${exec_prefix}/bin +libdir = ${exec_prefix}/lib +mandir = ${prefix}/man +man1dir = ${mandir}/man1 + CC = gcc LD = gcc CFLAGS = -O2 -g -fPIC -Wall LDFLAGS = -shared -LIBS = -ldl +LDLIBS = -ldl +INST_BIN = install -c -m755 +INST_LIB = install -c -m644 +INST_MAN = install -c -m644 +INST_BIN = install -c -m755 +MKDIRS = install -d -m755 +DESTDIR = -SOURCES = noip.c uopen.c -TARGETS = noip.so uopen.so +LIBS = noip.so uopen.so +MAN1 = $(patsubst %.so, %.1, $(LIBS)) +SCRIPTS = $(patsubst %.so, %, $(LIBS)) +TARGETS = $(LIBS) $(SCRIPTS) +SOURCES = noip.c uopen.c withlib.in all: $(TARGETS) %.o: %.c $(CC) -c $(CFLAGS) $< -o $@ noip.so: $(patsubst %.c, %.o, noip.c) - $(LD) $(LDFLAGS) $< $(LIBS) -o $@ + $(LD) $(LDFLAGS) $< $(LDLIBS) -o $@ uopen.so: $(patsubst %.c, %.o, uopen.c) - $(LD) $(LDFLAGS) $< $(LIBS) -o $@ + $(LD) $(LDFLAGS) $< $(LDLIBS) -o $@ +$(SCRIPTS): withlib.in + for i in $(SCRIPTS); do \ + sed "s/@lib@/$$i/" withlib.in >$$i.new || exit 1; \ + mv $$i.new $$i || exit 1; \ + done +install: all + $(MKDIRS) $(addprefix $(DESTDIR), \ + $(bindir) $(libdir) $(bindir) $(man1dir)) + $(INST_LIB) $(LIBS) $(DESTDIR)$(libdir) + $(INST_BIN) $(SCRIPTS) $(DESTDIR)$(bindir) + $(INST_MAN) $(MAN1) $(DESTDIR)$(man1dir) +uninstall: + rm -f $(addprefix $(DESTDIR)$(libdir)/, $(LIBS)) + rm -f $(addprefix $(DESTDIR)$(bindir)/, $(SCRIPTS)) + rm -f $(addprefix $(DESTDIR)$(man1dir)/, $(MAN1)) +DISTDIR = $(PACKAGE)-$(VERSION) +DISTTAR = $(DISTDIR).tar.gz +distdir: + rm -rf $(DISTDIR) + mkdir $(DISTDIR) + ln $(SOURCES) $(MAN1) Makefile $(DISTDIR) + mkdir $(DISTDIR)/debian + ln debian/rules debian/copyright debian/changelog debian/control \ + debian/*.install $(DISTDIR)/debian +dist: distdir + tar chozf $(DISTTAR) $(DISTDIR) + rm -rf $(DISTDIR) clean: - rm -f $(OBJECTS) $(TARGETS) \ No newline at end of file + rm -f *.o $(OBJECTS) $(TARGETS) diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..5d6068a --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +preload-hacks (1.0.0) experimental; urgency=low + + * Newly written preload hacks, specially for you. + + -- Mark Wooding Fri, 6 May 2005 10:17:24 +0100 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..45018f5 --- /dev/null +++ b/debian/control @@ -0,0 +1,25 @@ +Source: preload-hacks +Section: utils +Priority: extra +Maintainer: Mark Wooding +Standards-Version: 3.1.1 + +Package: uopen +Architecture: any +Suggests: fw +Depends: ${shlibs:Depends} +Description: Automatic connection to Unix-domain sockets + uopen is a preload hack which detects attempts to open(2) Unix-domain + sockets and connects to the socket instead. This can be used, for + example, to implement a random-signature daemon. + +Package: noip +Architecture: any +Depends: ${shlibs:Depends} +Description: Run programs with limited network access + noip is a preload hack which traps socket calls and forces (most) + attempts to use TCP/IP to use Unix-domain sockets in a private directory + instead. This can be used to help secure systems which use IP sockets + unnecessarily. It can also be used to limit access to forwarded SSH + ports. Full configuration is available via a file or environment + variables. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..8337bf2 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,16 @@ +Preload-hacks are copyright (c) 2003 Straylight/Edgeware. + +Preload-hacks are 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 of the License, or +(at your option) any later version. + +Preload-hacks are 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 a copy of the GNU General Public License in +/usr/share/common-licenses/GPL; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. diff --git a/debian/noip.install b/debian/noip.install new file mode 100644 index 0000000..018d14a --- /dev/null +++ b/debian/noip.install @@ -0,0 +1,3 @@ +usr/bin/noip +usr/lib/noip.so +usr/share/man/man1/noip.1 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..6739f8f --- /dev/null +++ b/debian/rules @@ -0,0 +1,48 @@ +#! /usr/bin/make -f + +export DH_COMPAT = 4 + +build: + make clean + make + touch build + +clean: + dh_clean + make clean + +install: build + dh_clean + make install \ + prefix=/usr \ + mandir=/usr/share/man \ + DESTDIR=`pwd`/debian/tmp + dh_install --sourcedir=debian/tmp + rm -rf debian/tmp + +binary-indep: + +binary-arch: install + dh_testdir -a + dh_testroot -a + dh_compress -a + dh_installdocs -a + dh_strip -a + dh_shlibdeps -a + dh_gencontrol -a + dh_fixperms -a + dh_installdeb -a + dh_md5sums -a + dh_builddeb -a + +binary: binary-indep binary-arch + +source: + rm -rf deb-dist.tar.gz =deb= + make dist DISTTAR=deb-dist.tar.gz + mkdir =deb= + cd =deb=; tar xvfz ../deb-dist.tar.gz + d=`pwd`; cd ..; dpkg-source -i -i'/\.svn/' -b $$d/=deb=/* + rm -rf deb-dist.tar.gz =deb= + +.PHONY: binary binary-arch binary-indep clean install source diff --git a/debian/uopen.install b/debian/uopen.install new file mode 100644 index 0000000..cb36fa7 --- /dev/null +++ b/debian/uopen.install @@ -0,0 +1,3 @@ +usr/bin/uopen +usr/lib/uopen.so +usr/share/man/man1/uopen.1 diff --git a/noip b/noip deleted file mode 100755 index 7e385f5..0000000 --- a/noip +++ /dev/null @@ -1,6 +0,0 @@ -#! /bin/sh - -set -e -export LD_PRELOAD=$LD_PRELOAD${LD_PRELOAD+ }./noip.so -[ $# -eq 0 ] && set -- "$SHELL" -exec "$@" diff --git a/uopen b/withlib.in old mode 100755 new mode 100644 similarity index 56% rename from uopen rename to withlib.in index aab9b83..47e19d1 --- a/uopen +++ b/withlib.in @@ -1,6 +1,6 @@ #! /bin/sh set -e -export LD_PRELOAD=$LD_PRELOAD${LD_PRELOAD+ }./uopen.so +export LD_PRELOAD=$LD_PRELOAD${LD_PRELOAD+ }@lib@.so [ $# -eq 0 ] && set -- "${SHELL-/bin/sh}" exec "$@" -- [mdw]