Reflected RBM keyword removal in debian/ dir.
authorMaximilian Wilhelm <max@rfc2324.org>
Tue, 13 May 2008 23:21:34 +0000 (01:21 +0200)
committerMaximilian Wilhelm <max@rfc2324.org>
Tue, 13 May 2008 23:21:34 +0000 (01:21 +0200)
  Changed packaging to build ssh-keysync-{client,server} packages
  and beautified debian/ dir.

Signed-off-by: Maximilian Wilhelm <max@rfc2324.org>

debian/compat [new file with mode: 0644]
debian/ssh-keysync-client.cron.d [new file with mode: 0644]
debian/ssh-keysync-client.dirs [new file with mode: 0644]
debian/ssh-keysync-client.postinst [new file with mode: 0644]
debian/ssh-keysync-server.cron.d [new file with mode: 0644]
debian/ssh-keysync-server.dirs [new file with mode: 0644]
debian/ssh-keysync-server.postinst [new file with mode: 0644]

diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/ssh-keysync-client.cron.d b/debian/ssh-keysync-client.cron.d
new file mode 100644 (file)
index 0000000..1555ab5
--- /dev/null
@@ -0,0 +1,5 @@
+PATH=/sbin:/bin:/usr/sbin:/usr/bin:/opt/sbin:/opt/bin
+#
+# Regular cron jobs for the ssh-keysync-client package
+#
+42 * * * * root ( /usr/sbin/ssh-keysync -pull -quiet )
diff --git a/debian/ssh-keysync-client.dirs b/debian/ssh-keysync-client.dirs
new file mode 100644 (file)
index 0000000..80fe026
--- /dev/null
@@ -0,0 +1,2 @@
+etc/ssh-keysync
+usr/sbin
diff --git a/debian/ssh-keysync-client.postinst b/debian/ssh-keysync-client.postinst
new file mode 100644 (file)
index 0000000..54a6fc5
--- /dev/null
@@ -0,0 +1,57 @@
+#! /bin/sh
+# postinst script for sshkey-sync-client
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+#
+# quoting from the policy:
+#     Any necessary prompting should almost always be confined to the
+#     post-installation script, and should be protected with a conditional
+#     so that unnecessary prompting doesn't happen if a package's
+#     installation fails and the `postinst' is called with `abort-upgrade',
+#     `abort-remove' or `abort-deconfigure'.
+
+case "$1" in
+    configure)
+       works="false"
+       if /usr/sbin/ssh-keysync -configcheck 2>/dev/null; then
+               if /usr/sbin/ssh-keysync -pull; then
+                       works="true"
+               fi
+       fi
+
+       if [ "${works}" == "false" ]; then
+               echo "Attention: You have to customize /etc/ssh-keysync/ssh-keysync-client.conf to make ssh-keysync work."
+       fi
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
diff --git a/debian/ssh-keysync-server.cron.d b/debian/ssh-keysync-server.cron.d
new file mode 100644 (file)
index 0000000..b73bd26
--- /dev/null
@@ -0,0 +1,5 @@
+PATH=/sbin:/bin:/usr/sbin:/usr/bin:/opt/sbin:/opt/bin
+#
+# Regular cron jobs for the ssh-keysync-server package
+#
+23 * * * * skeysync ( /usr/bin/ssh-keysync-merge -quiet )
diff --git a/debian/ssh-keysync-server.dirs b/debian/ssh-keysync-server.dirs
new file mode 100644 (file)
index 0000000..f2b1dac
--- /dev/null
@@ -0,0 +1,2 @@
+etc/ssh-keysync
+usr/bin
diff --git a/debian/ssh-keysync-server.postinst b/debian/ssh-keysync-server.postinst
new file mode 100644 (file)
index 0000000..f1aa77c
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/sh
+#
+# ssh-keysync-server.postinst
+# 
+
+is_initial_configuration() { # {{{
+# Check if this is the initial configuration and not an upgrade of an 
+# existing configuration
+# Usage: if is_initial_configuration "$@"; then ... fi from top level
+
+        # Plain installation
+        if [ "$1" = configure ] && [ -z "$2" ]; then
+                return 0
+        fi
+        # Configuration via dpkg-reconfigure
+        if [ "$1" = reconfigure ] || [ "$DEBCONF_RECONFIGURE" ]; then
+                return 0
+        fi
+        return 1
+}
+
+# }}}
+
+# Create ssh-keysync management user, if not allready there
+if ! getent passwd skeysync > /dev/null; then
+        adduser --system --home /var/cache/ssh-keysync/ --no-create-home --shell /bin/bash skeysync
+fi
+
+# Create ssh-keysync management group, if no allready there
+if ! getent group skeysync > /dev/null; then
+       addgroup --system skeysync
+fi
+
+# Set primary group of the ssh-keysync user to skeysync if not allready done.
+if [ `id -n -g skeysync` != skeysync ]; then
+       usermod -g skeysync skeysync
+fi
+
+# If you have a 'fai' user, you might want to let this user write to
+# /var/cache/ssh-keysync, so we put him into the group
+if getent passwd fai > /dev/null; then
+       if [ `id -n -G fai | grep -c skeysync` == 0 ]; then
+               adduser fai skeysync
+       fi
+fi
+
+# create public directory that will be shared by a webserver (apache by
+# default) to let the clients access the generated ssh_knonw_hosts files.
+mkdir -p /var/cache/ssh-keysync/pub
+
+# set feasible rights to allow every member of 'skeysync'
+# to write in /var/cache/ssh-keysync
+find /var/cache/ssh-keysync -type d -exec chmod 2775 {} \;
+find /var/cache/ssh-keysync -type f -exec chmod  664 {} \;
+find /var/cache/ssh-keysync -exec chown skeysync:skeysync {} \;
+
+##
+# Call automagic upgrade script if this package is upgraded
+if ! is_initial_configuration "$@"; then
+       /usr/bin/upgrade_sshkeysync
+fi
+
+##
+# If apache is installed, place a config in conf.d
+if dpkg -l apache | grep -q ^ii; then
+       cp /usr/share/doc/ssh-keysync-server/apache-example.conf /etc/apache/conf.d/ssh-keysync-server.conf
+       /etc/init.d/apache reload
+fi
+
+
+# vim:set foldmethod=marker: