Package: sks
Severity: normal

Here's the updated patch which don't fail if the database was not
created and sks wasn't executed at leasts once.

I also took liberty of fixing some other relatively easy to fix bugs.

O.

-- System Information:
Debian Release: 6.0.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=cs_CZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff --git a/debian/README.Debian b/debian/README.Debian
index d263f14..e0fda95 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -7,15 +7,15 @@ http://ftp.prato.linux.it/pub/keyring/dump-latest/
 
 If you don't find one feel free to ask on the SKS mailing list.
 
-You can retrieve one use commands similar to the following lines:
+You can retrieve the keydump by executing following commands as the
+root user (or just su to debian-sks user)):
 
  cd /var/lib/sks/dump
- wget -q -r -np -nd -A asc http://ftp.prato.linux.it/pub/keyring/dump-latest/ -e robots=off
+ su debian-sks -c "wget -q -r -np -nd -A pgp http://ftp.prato.linux.it/pub/keyring/dump-latest/ -e robots=off"
 
 To build the database from the keydumps call:
 
- /usr/lib/sks/sks_build.sh
- chown -R debian-sks:debian-sks /var/lib/sks
+ su debian-sks -c "/usr/lib/sks/sks_build.sh"
 
 To make the server start you have to edit the defaults file:
 
@@ -30,4 +30,4 @@ gossip partners. Include the partners in /etc/sks/membership.
 Thanks to Peter Palfrader <wea...@debian.org> for building the
 original Debian package.
 
- -- Ondřej Surý <ond...@debian.org>, Fri, 13 May 2011 13:15:18 +0200
+ -- Ondřej Surý <ond...@debian.org>, Thu, 19 May 2011 11:55:48 +0200
diff --git a/debian/changelog b/debian/changelog
index 0f2c7a9..92f4abc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,16 @@
+sks (1.1.1+dpkgv3-6.2) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Handle gracefully missing db directory, which can happen if:
+    + sks was not enabled and didn't create PTree directory
+    + keys haven't been imported to the package
+  * Update instructions for retrieving keydump (Closes: #605454)
+  * Install README from source directory (Closes: #599868)
+  * Use dh_ocaml >= 0.9 (Closes: #599579)
+  * Add hints to run commands as debian-sks user as suggested in the BTS
+
+ -- Ondřej Surý <ond...@debian.org>  Thu, 19 May 2011 11:56:33 +0200
+
 sks (1.1.1+dpkgv3-6.1) unstable; urgency=low
 
   * Non-maintainer upload.
diff --git a/debian/control b/debian/control
index 5b16fe0..d3b6ba3 100644
--- a/debian/control
+++ b/debian/control
@@ -4,11 +4,12 @@ Priority: optional
 Standards-Version: 3.8.3
 Maintainer: Christoph Martin <christoph.mar...@uni-mainz.de>
 Uploaders: Fabio M. Di Nitto <fabbi...@fabbione.net>
-Build-Depends: ocaml (>= 3.08), camlp4, libdb-dev, debhelper (>= 7.0.50~), zlib1g-dev, libcryptokit-ocaml-dev (>= 1.2-4), ocaml-nox (>= 1.3-4), perl, perl-doc
+Build-Depends: ocaml (>= 3.08), camlp4, libdb-dev, debhelper (>= 7.0.50~), zlib1g-dev, libcryptokit-ocaml-dev (>= 1.2-4), ocaml-nox (>= 1.3-4), perl, perl-doc, dh-ocaml (>= 0.9~)
 
 Package: sks
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, ${F:OCamlRun}, db-util, adduser, logrotate
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${ocaml:Depends}, db-util, adduser, logrotate
+Provides: ${ocaml:Provides}
 Recommends: db4.7-util
 Suggests: postfix | mail-transport-agent, procmail
 Description: Synchronizing OpenPGP Key Server
diff --git a/debian/rules b/debian/rules
index 663eb49..467c33c 100755
--- a/debian/rules
+++ b/debian/rules
@@ -15,7 +15,7 @@ export DEB_BUILD_OPTIONS += $(if $(BYTECODE)," nostrip",)
 BDB_VERSION ?= $(shell LC_ALL=C dpkg-query -l 'libdb[45].[0-9]-dev' | grep ^ii | sed -e 's|.*\s\libdb\([45]\.[0-9]\)-dev\s.*|\1|')
 
 %:
-	dh  $@
+	dh  $@ --with=ocaml
 
 override_dh_auto_build:
 	dh_auto_build -v --  $(all)
@@ -27,9 +27,6 @@ override_dh_auto_install:
 	cp -a debian/debcfg/* debian/sks/etc/sks
 	echo $(BDB_VERSION) > debian/sks/usr/lib/sks/berkeley_db.txt
 
-override_dh_gencontrol:
-	dh_gencontrol -- -VF:OCamlRun="$(OCAMLRUN)"
-
 # Use override_dh_* targets to customize this.
 # ---------------------------------------------------
 # Followings are the old debian/rules
diff --git a/debian/sks.docs b/debian/sks.docs
index 2cafa60..e845566 100644
--- a/debian/sks.docs
+++ b/debian/sks.docs
@@ -1 +1 @@
-build-tree/*/README
+README
diff --git a/debian/sks.postinst b/debian/sks.postinst
index 854d2d1..44cc195 100755
--- a/debian/sks.postinst
+++ b/debian/sks.postinst
@@ -92,6 +92,10 @@ else
 	chown debian-sks:debian-sks ${BACKUP_DIR}
 
 	for DBHOME in DB PTree; do
+
+	    # Don't run if the database directory doesn't exist
+	    [ ! -d ${SKS_DIR}/${DBHOME} ] && continue
+
 	    # Create backup directory
 	    mkdir -p ${BACKUP_DIR}/${DBHOME}
 	    chown debian-sks:debian-sks ${BACKUP_DIR}/${DBHOME}
@@ -102,16 +106,19 @@ else
 	    if [ -x /usr/bin/db${OLD_BDB}_recover ]; then
 	        # Run recover with old tools
 		su debian-sks -c "db${OLD_BDB}_recover -h ${SKS_DIR}/${DBHOME}"
-	        # Backup log files
-		su debian-sks -c "db${OLD_BDB}_archive -h ${SKS_DIR}/${DBHOME} -l" | \
-		    while read log_file; do
-		    cp -a ${SKS_DIR}/${DBHOME}/$log_file ${BACKUP_DIR}/${DBHOME}/
-		done
+	        # Backup needed log files
+		LOG_FILES=$(su debian-sks -c "db${OLD_BDB}_archive -h ${SKS_DIR}/${DBHOME} -l")
 	    else
-		# If we don't have the Berkeley DB tools then copy everything to backup
-		su debian-sks -c "cp ${SKS_DIR}/${DBHOME}/log.* ${BACKUP_DIR}/${DBHOME}/"
+		# If we don't have the Berkeley DB tools then backup all log files
+		LOG_FILES=$(cd ${SKS_DIR}/${DBHOME}; ls -1 | grep -E "^log\.")
 	    fi
 
+	    # Backup log files
+	    for log_file in ${LOG_FILES}; do
+		cp -a ${SKS_DIR}/${DBHOME}/$log_file ${BACKUP_DIR}/${DBHOME}/
+	    done
+
+	    # Backup & upgrade database files
 	    for db in $(cd ${SKS_DIR}/${DBHOME}; ls -1 | grep -Ev "^(__|log\.)"); do
 		# Backup database file
 		su debian-sks -c "cp ${SKS_DIR}/${DBHOME}/${db} ${BACKUP_DIR}/${DBHOME}/"

Reply via email to