changeset 522:8cc0598b0b9a maemo

- Split into separate debs
author Matt Johnston <matt@ucc.asn.au>
date Tue, 18 Nov 2008 12:53:48 +0000
parents cc2dff9bd671
children 4ff1bf0345c9 b0668a7f76d9
files debian/control debian/dropbear-server.conffiles debian/dropbear-server.postinst debian/dropbear-server.postrm debian/dropbear-server.prerm debian/rules
diffstat 6 files changed, 279 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/debian/control	Tue Nov 18 12:53:39 2008 +0000
+++ b/debian/control	Tue Nov 18 12:53:48 2008 +0000
@@ -1,7 +1,7 @@
 Source: dropbear
 Section: net
 Priority: optional
-Maintainer: Gerrit Pape <[email protected]>
+Maintainer: Matt Johnston <[email protected]>
 Build-Depends: libz-dev
 Standards-Version: 3.7.3.0
 
@@ -9,6 +9,7 @@
 Architecture: any
 Depends: ${shlibs:Depends}
 Suggests: openssh-client, runit
+Conflicts: dropbear-server, dropbear-client, dropbear-common, dropbear-scp
 Description: lightweight SSH2 server and client
  dropbear is a SSH 2 server and client designed to be small enough to
  be used in small memory environments, while still being functional and
@@ -17,4 +18,57 @@
  It implements most required features of the SSH 2 protocol, and other
  features such as X11 and authentication agent forwarding.
  .
+ This packages provides Dropbear client and server as a single binary.
+ .
  See http://matt.ucc.asn.au/dropbear/dropbear.html
+
+Package: dropbear-server
+Architecture: any
+Depends: ${shlibs:Depends}, dropbear-common
+Recommends: dropbear-scp
+Description: lightweight SSH2 server
+ dropbear is a SSH 2 server and client designed to be small enough to
+ be used in small memory environments, while still being functional and
+ secure enough for general use.
+ .
+ It implements most required features of the SSH 2 protocol, and other
+ features such as X11 and authentication agent forwarding.
+ .
+ See http://matt.ucc.asn.au/dropbear/dropbear.html
+
+Package: dropbear-client
+Architecture: any
+Depends: ${shlibs:Depends}
+Recommends: dropbear-common, dropbear-scp
+Description: lightweight SSH2 client
+ dropbear is a SSH 2 server and client designed to be small enough to
+ be used in small memory environments, while still being functional and
+ secure enough for general use.
+ .
+ It implements most required features of the SSH 2 protocol, and other
+ features such as X11 and authentication agent forwarding.
+ .
+ See http://matt.ucc.asn.au/dropbear/dropbear.html
+
+Package: dropbear-common
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: lightweight SSH2, key management utilities
+ dropbear is a SSH 2 server and client designed to be small enough to
+ be used in small memory environments, while still being functional and
+ secure enough for general use.
+ .
+ This package provides dropbearkey and dropbearconvert programs,
+ for generating keys and converting to/from OpenSSH keys.
+ .
+ See http://matt.ucc.asn.au/dropbear/dropbear.html
+
+Package: dropbear-scp
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: lightweight SSH2 scp
+ dropbear is a SSH 2 server and client designed to be small enough to
+ be used in small memory environments, while still being functional and
+ secure enough for general use.
+ .
+ This dropbear-scp package provides /usr/bin/scp.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/dropbear-server.conffiles	Tue Nov 18 12:53:48 2008 +0000
@@ -0,0 +1,3 @@
+/etc/init.d/dropbear
+/etc/dropbear/run
+/etc/dropbear/log/run
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/dropbear-server.postinst	Tue Nov 18 12:53:48 2008 +0000
@@ -0,0 +1,79 @@
+#!/bin/sh
+set -e
+
+test "$1" = 'configure' || exit 0
+
+if test ! -e /etc/dropbear/dropbear_rsa_host_key; then
+  if test -f /etc/ssh/ssh_host_rsa_key; then
+    echo "Converting existing OpenSSH RSA host key to Dropbear format."
+    /usr/lib/dropbear/dropbearconvert openssh dropbear \
+      /etc/ssh/ssh_host_rsa_key /etc/dropbear/dropbear_rsa_host_key
+  else
+    echo "Generating Dropbear RSA key. Please wait."
+    dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
+  fi
+fi
+if test ! -e /etc/dropbear/dropbear_dss_host_key; then
+  if test -f /etc/ssh/ssh_host_dsa_key; then
+    echo "Converting existing OpenSSH RSA host key to Dropbear format."
+    /usr/lib/dropbear/dropbearconvert openssh dropbear \
+      /etc/ssh/ssh_host_dsa_key /etc/dropbear/dropbear_dss_host_key
+  else
+    echo "Generating Dropbear DSS key. Please wait."
+    dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key
+  fi
+fi
+if test ! -s /etc/default/dropbear; then 
+  # check whether OpenSSH seems to be installed.
+  if test -x /usr/sbin/sshd; then
+    cat <<EOT
+OpenSSH appears to be installed.  Setting /etc/default/dropbear so that
+Dropbear will not start by default.  Edit this file to change this behaviour.
+
+EOT
+    cat >>/etc/default/dropbear <<EOT
+# disabled because OpenSSH is installed
+# change to NO_START=0 to enable Dropbear
+NO_START=1
+
+EOT
+  fi
+  cat >>/etc/default/dropbear <<EOT
+# the TCP port that Dropbear listens on
+DROPBEAR_PORT=22
+
+# any additional arguments for Dropbear
+DROPBEAR_EXTRA_ARGS=
+
+# specify an optional banner file containing a message to be
+# sent to clients before they connect, such as "/etc/issue.net"
+DROPBEAR_BANNER=""
+
+# RSA hostkey file (default: /etc/dropbear/dropbear_rsa_host_key)
+#DROPBEAR_RSAKEY="/etc/dropbear/dropbear_rsa_host_key"
+
+# DSS hostkey file (default: /etc/dropbear/dropbear_dss_host_key)
+#DROPBEAR_DSSKEY="/etc/dropbear/dropbear_dss_host_key"
+
+# Receive window size - this is a tradeoff between memory and
+# network performance
+DROPBEAR_RECEIVE_WINDOW=65536
+EOT
+fi
+
+if test -x /etc/init.d/dropbear; then
+  update-rc.d dropbear defaults >/dev/null
+  if test -x /usr/sbin/invoke-rc.d; then
+    invoke-rc.d dropbear restart
+  else
+    /etc/init.d/dropbear restart
+  fi
+fi
+
+if test -n "$2" && dpkg --compare-versions "$2" lt '0.50-4' &&
+update-service --check dropbear 2>/dev/null; then
+  update-service --remove /etc/dropbear 2>/dev/null || :
+  sleep 6
+  rm -rf /var/run/dropbear /var/run/dropbear.log
+  update-service --add /etc/dropbear || :
+fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/dropbear-server.postrm	Tue Nov 18 12:53:48 2008 +0000
@@ -0,0 +1,12 @@
+#! /bin/sh
+set -e
+
+test "$1" = 'purge' || exit 0
+if test -e /etc/dropbear; then
+  rm -f /etc/dropbear/dropbear_rsa_host_key
+  rm -f /etc/dropbear/dropbear_dss_host_key
+  rmdir --ignore-fail-on-non-empty /etc/dropbear
+fi
+update-rc.d dropbear remove >/dev/null
+rm -f /etc/default/dropbear
+rm -rf /etc/dropbear/supervise /etc/dropbear/log/supervise
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/dropbear-server.prerm	Tue Nov 18 12:53:48 2008 +0000
@@ -0,0 +1,11 @@
+#!/bin/sh
+set -e
+
+test "$1" = 'remove' || test "$1" = 'deconfigure' || exit 0
+if test -x /etc/init.d/dropbear; then
+  if test -x /usr/sbin/invoke-rc.d; then
+    invoke-rc.d dropbear stop
+  else
+    /etc/init.d/dropbear stop
+  fi
+fi
--- a/debian/rules	Tue Nov 18 12:53:39 2008 +0000
+++ b/debian/rules	Tue Nov 18 12:53:48 2008 +0000
@@ -13,7 +13,7 @@
 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
   CFLAGS +=-O0
 else
-  CFLAGS +=-O2
+  CFLAGS +=-Os
 endif
 
 CONFFLAGS =
@@ -23,8 +23,6 @@
   CC =diet -v -Os gcc -nostdinc
 endif
 
-DIR =$(shell pwd)/debian/dropbear
-
 patch: deb-checkdir patch-stamp
 patch-stamp:
 	for i in `ls -1 debian/diff/*.diff || :`; do \
@@ -45,7 +43,8 @@
 	$(MAKE) CC='$(CC)' LD='$(CC)'
 	touch build-stamp
 
-clean: deb-checkdir deb-checkuid
+clean: DIR=$(shell pwd)/debian/dropbear
+clean: deb-checkdir deb-checkuid 
 	test ! -r Makefile || $(MAKE) distclean
 	rm -f libtomcrypt/Makefile libtommath/Makefile
 	test ! -e patch-stamp || \
@@ -54,22 +53,21 @@
 	  done
 	rm -f patch-stamp build-stamp config.log config.status
 	rm -rf '$(DIR)'
+	rm -rf '$(DIR)'-client
+	rm -rf '$(DIR)'-server
+	rm -rf '$(DIR)'-common
+	rm -rf '$(DIR)'-scp
 	rm -f debian/files debian/substvars debian/copyright changelog
 
-install: deb-checkdir deb-checkuid build-stamp
-	rm -rf '$(DIR)'
+install-server: DIR=$(shell pwd)/debian/dropbear-server
+install-server: deb-checkdir deb-checkuid config.status 
+	rm -f '$(DIR)'
+	$(MAKE) clean
+	$(MAKE) CC='$(CC)' LD='$(LD)' PROGRAMS=dropbear dropbear
 	install -d -m0755 '$(DIR)'/etc/dropbear
 	# programs
 	install -d -m0755 '$(DIR)'/usr/sbin
 	install -m0755 dropbear '$(DIR)'/usr/sbin/dropbear
-	install -d -m0755 '$(DIR)'/usr/bin
-	install -m0755 dbclient '$(DIR)'/usr/bin/dbclient
-	install -m0755 dropbearkey '$(DIR)'/usr/bin/dropbearkey
-	install -d -m0755 '$(DIR)'/usr/lib/dropbear
-	install -m0755 dropbearconvert \
-	  '$(DIR)'/usr/lib/dropbear/dropbearconvert
-	$(STRIP) -R .comment -R .note '$(DIR)'/usr/sbin/* \
-	  '$(DIR)'/usr/bin/* '$(DIR)'/usr/lib/dropbear/*
 	# init and run scripts
 	install -d -m0755 '$(DIR)'/etc/init.d
 	install -m0755 debian/dropbear.init '$(DIR)'/etc/init.d/dropbear
@@ -77,7 +75,105 @@
 	install -d -m0755 '$(DIR)'/etc/dropbear/log
 	install -m0755 debian/service/log '$(DIR)'/etc/dropbear/log/run
 	ln -s /var/log/dropbear '$(DIR)'/etc/dropbear/log/main
-	# man pages
+	install -d -m0755 '$(DIR)'/usr/share/man/man8
+	for i in dropbear.8 ; do \
+	  install -m644 $$i '$(DIR)'/usr/share/man/man8/ || exit 1; \
+	done
+	gzip -9 '$(DIR)'/usr/share/man/man8/*.8
+	# copyright, changelog
+	cat debian/copyright.in LICENSE > debian/copyright
+	test -r changelog || ln -s CHANGES changelog
+	$(STRIP) -R .comment -R .note '$(DIR)'/usr/sbin/*
+
+	install -d -m0755 '$(DIR)'/DEBIAN
+	test '$(CC)' != 'gcc' || \
+	  dpkg-shlibdeps '$(DIR)'/usr/sbin/* \
+	    '$(DIR)'/usr/lib/dropbear/*
+	dpkg-gencontrol -isp -pdropbear-server -P'$(DIR)'
+	dpkg -b '$(DIR)' ..
+
+install-client: DIR=$(shell pwd)/debian/dropbear-client
+install-client: deb-checkdir deb-checkuid config.status 
+	rm -f '$(DIR)'
+	$(MAKE) clean
+	$(MAKE) CC='$(CC)' LD='$(LD)' PROGRAMS=dbclient dbclient
+	install -d -m0755 '$(DIR)'/usr/bin
+	install -m0755 dbclient '$(DIR)'/usr/bin/dbclient
+	install -d -m0755 '$(DIR)'/usr/share/man/man1
+	install -m644 dbclient.1 '$(DIR)'/usr/share/man/man1/
+	gzip -9 '$(DIR)'/usr/share/man/man1/*.1
+	$(STRIP) -R .comment -R .note '$(DIR)'/usr/bin/* 
+
+	install -d -m0755 '$(DIR)'/DEBIAN
+	test '$(CC)' != 'gcc' || \
+	  dpkg-shlibdeps  '$(DIR)'/usr/bin/*
+	dpkg-gencontrol -isp -pdropbear-client -P'$(DIR)'
+	dpkg -b '$(DIR)' ..
+
+install-common: DIR=$(shell pwd)/debian/dropbear-common
+install-common: deb-checkdir deb-checkuid config.status 
+	rm -f '$(DIR)'
+	$(MAKE) clean
+	$(MAKE) CC='$(CC)' LD='$(LD)' PROGRAMS="dropbearkey dropbearconvert" MULTI=1
+	install -d -m0755 '$(DIR)'/usr/bin
+	install -d -m0755 '$(DIR)'/usr/lib/dropbear
+	install -m0755 dropbearmulti \
+	  '$(DIR)'/usr/lib/dropbear/dropbearmulti
+	ln -s ../lib/dropbear/dropbearmulti '$(DIR)'/usr/bin/dropbearkey
+	ln -s dropbearmulti '$(DIR)'/usr/lib/dropbear/dropbearconvert
+	install -d -m0755 '$(DIR)'/usr/share/man/man8
+	for i in dropbearkey.8; do \
+	  install -m644 $$i '$(DIR)'/usr/share/man/man8/ || exit 1; \
+	done
+	gzip -9 '$(DIR)'/usr/share/man/man8/*.8
+	$(STRIP) -R .comment -R .note \
+	  '$(DIR)'/usr/bin/* '$(DIR)'/usr/lib/dropbear/*
+
+	install -d -m0755 '$(DIR)'/DEBIAN
+	test '$(CC)' != 'gcc' || \
+	  dpkg-shlibdeps '$(DIR)'/usr/bin/*  '$(DIR)'/usr/lib/dropbear/*
+	dpkg-gencontrol -isp -pdropbear-common -P'$(DIR)'
+	dpkg -b '$(DIR)' ..
+
+install-scp: DIR=$(shell pwd)/debian/dropbear-scp
+install-scp: deb-checkdir deb-checkuid config.status 
+	rm -f '$(DIR)'
+	$(MAKE) clean
+	$(MAKE) CC='$(CC)' LD='$(LD)' PROGRAMS="scp" scp 
+	install -d -m0755 '$(DIR)'/usr/bin
+	install -m0755 scp '$(DIR)'/usr/bin/scp
+	$(STRIP) -R .comment -R .note '$(DIR)'/usr/bin/*
+
+	install -d -m0755 '$(DIR)'/DEBIAN
+	test '$(CC)' != 'gcc' || \
+	  dpkg-shlibdeps '$(DIR)'/usr/bin/* 
+	dpkg-gencontrol -isp -pdropbear-scp -P'$(DIR)'
+	dpkg -b '$(DIR)' ..
+
+install-multi: DIR=$(shell pwd)/debian/dropbear
+install-multi: deb-checkdir deb-checkuid config.status 
+	rm -f '$(DIR)'
+	$(MAKE) clean
+	$(MAKE) CC='$(CC)' LD='$(LD)' PROGRAMS="dropbearkey dropbearconvert scp dropbear dbclient" MULTI=1
+	install -d -m0755 '$(DIR)'/etc/dropbear
+	# programs
+	install -d -m0755 '$(DIR)'/usr/bin
+	install -d -m0755 '$(DIR)'/usr/sbin
+	install -d -m0755 '$(DIR)'/usr/lib/dropbear
+	install -m0755 dropbearmulti \
+	  '$(DIR)'/usr/lib/dropbear/dropbearmulti
+	ln -s ../lib/dropbear/dropbearmulti '$(DIR)'/usr/bin/dropbearkey
+	ln -s ../lib/dropbear/dropbearmulti '$(DIR)'/usr/bin/dbclient
+	ln -s ../lib/dropbear/dropbearmulti '$(DIR)'/usr/bin/scp
+	ln -s ../lib/dropbear/dropbearmulti '$(DIR)'/usr/sbin/dropbear
+	ln -s dropbearmulti '$(DIR)'/usr/lib/dropbear/dropbearconvert
+	# init and run scripts
+	install -d -m0755 '$(DIR)'/etc/init.d
+	install -m0755 debian/dropbear.init '$(DIR)'/etc/init.d/dropbear
+	install -m0755 debian/service/run '$(DIR)'/etc/dropbear/run
+	install -d -m0755 '$(DIR)'/etc/dropbear/log
+	install -m0755 debian/service/log '$(DIR)'/etc/dropbear/log/run
+	ln -s /var/log/dropbear '$(DIR)'/etc/dropbear/log/main
 	install -d -m0755 '$(DIR)'/usr/share/man/man8
 	for i in dropbear.8 dropbearkey.8; do \
 	  install -m644 $$i '$(DIR)'/usr/share/man/man8/ || exit 1; \
@@ -86,19 +182,21 @@
 	install -d -m0755 '$(DIR)'/usr/share/man/man1
 	install -m644 dbclient.1 '$(DIR)'/usr/share/man/man1/
 	gzip -9 '$(DIR)'/usr/share/man/man1/*.1
-	# copyright, changelog
-	cat debian/copyright.in LICENSE >debian/copyright
-	test -r changelog || ln -s CHANGES changelog
+	$(STRIP) -R .comment -R .note '$(DIR)'/usr/sbin/* \
+	  '$(DIR)'/usr/bin/* '$(DIR)'/usr/lib/dropbear/*
 
-binary-indep:
-
-binary-arch: install dropbear.deb
+	install -d -m0755 '$(DIR)'/DEBIAN
 	test '$(CC)' != 'gcc' || \
 	  dpkg-shlibdeps '$(DIR)'/usr/sbin/* '$(DIR)'/usr/bin/* \
 	    '$(DIR)'/usr/lib/dropbear/*
 	dpkg-gencontrol -isp -pdropbear -P'$(DIR)'
 	dpkg -b '$(DIR)' ..
 
+install: install-client install-server install-common install-multi install-scp
+binary-indep:
+
+binary-arch: install dropbear.deb
+
 binary: binary-arch binary-indep
 
 .PHONY: patch build clean install binary-indep binary-arch binary