From patchwork Wed Jul 28 12:10:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: y@vger.kernel.org X-Patchwork-Id: 114753 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6SCJHAd016918 for ; Wed, 28 Jul 2010 12:19:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754846Ab0G1MTR (ORCPT ); Wed, 28 Jul 2010 08:19:17 -0400 Received: from mail.muellerit.ch ([92.51.129.153]:45867 "EHLO mail.muellerit.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754851Ab0G1MTQ (ORCPT ); Wed, 28 Jul 2010 08:19:16 -0400 X-Virus-Scanned: amavisd-new at mail.muellerit.ch Received: from mail.muellerit.ch ([127.0.0.1]) by localhost (mail.muellerit.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id uUUc5sJji1OW; Wed, 28 Jul 2010 14:10:38 +0200 (CEST) Received: from localhost.localdomain (zux221-125-110.adsl.green.ch [81.221.125.110]) by mail.muellerit.ch (Postfix) with ESMTPSA id AE1B0792402E; Wed, 28 Jul 2010 14:10:38 +0200 (CEST) From: y@vger.kernel.org To: ceph-devel@vger.kernel.org Cc: Thomas Mueller Subject: [PATCH 1/2] add dkms support Date: Wed, 28 Jul 2010 14:10:35 +0200 Message-Id: <1280319036-17877-1-git-send-email-y> X-Mailer: git-send-email 1.7.1 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 28 Jul 2010 12:19:18 +0000 (UTC) diff --git a/Makefile b/Makefile index 6a660e6..4b8f6e7 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,8 @@ else #Otherwise we were called directly from the command # line; invoke the kernel build system. -KERNELDIR ?= /lib/modules/$(shell uname -r)/build +KERNELRELEASE ?= $(shell uname -r) +KERNELDIR ?= /lib/modules/$(KERNELRELEASE)/build PWD := $(shell pwd) default: all diff --git a/dkms.conf b/dkms.conf new file mode 100644 index 0000000..bbf607c --- /dev/null +++ b/dkms.conf @@ -0,0 +1,7 @@ +PACKAGE_NAME="ceph" +PACKAGE_VERSION="1.0" +DEST_MODULE_LOCATION[0]="/updates/ceph" +BUILT_MODULE_NAME[0]="ceph" +AUTOINSTALL="yes" +PRE_BUILD="dkms/prebuild.sh ${kernelver}" +POST_REMOVE="dkms/postremove.sh ${kernelver}" diff --git a/dkms/add-to-dkms-and-build b/dkms/add-to-dkms-and-build new file mode 100644 index 0000000..ffea573 --- /dev/null +++ b/dkms/add-to-dkms-and-build @@ -0,0 +1,15 @@ +#!/bin/sh + +if ! [ -f ./upstream_version.h ] +then + echo "Failure: ./upstream_version.h not found. Did you call this script from ceph-client root?" +fi + +CEPH_VERSION=$(grep CEPH_VERSION upstream_version.h | egrep -o "[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+[^\"]+") + +mkdir /usr/src/ceph-${CEPH_VERSION} || exit 1 +cp -r ./ /usr/src/ceph-${CEPH_VERSION} + +dkms add -m ceph -v ${CEPH_VERSION} && +dkms build -m ceph -v ${CEPH_VERSION} && +dkms install -m ceph -v ${CEPH_VERSION} diff --git a/dkms/postremove.sh b/dkms/postremove.sh new file mode 100644 index 0000000..8693fcf --- /dev/null +++ b/dkms/postremove.sh @@ -0,0 +1,34 @@ +#!/bin/sh + + +if [ "$1" = "" ] +then + echo "Usage: $0 " + exit +fi + +MODROOT="/lib/modules/$1" + +if ! [ -f /etc/debian_version ] +then + echo "Info: runs only on Debian and derivates" + exit +fi + + + +if [ -d "$MODROOT" ] +then + if [ -f "$MODROOT/kernel/fs/ceph/ceph.ko.dpkg-divert-by-ceph-dkms" ] + then + if ! [ -f "$MODROOT/kernel/fs/ceph/ceph.ko" ] + then + dpkg-divert --rename --remove "$MODROOT/kernel/fs/ceph/ceph.ko" + else + echo "Warning: $MODROOT/kernel/fs/ceph/ceph.ko and diverted $MODROOT/kernel/fs/ceph/ceph.ko.dpkg-divert-by-ceph-dkms exist both!" + fi + fi +else + echo "Warning: $MODROOT is not a directory" +fi + diff --git a/dkms/prebuild.sh b/dkms/prebuild.sh new file mode 100644 index 0000000..1aee069 --- /dev/null +++ b/dkms/prebuild.sh @@ -0,0 +1,32 @@ +#!/bin/sh + + +if [ "$1" = "" ] +then + echo "Usage: $0 " + exit +fi + +MODROOT="/lib/modules/$1" + +if ! [ -f /etc/debian_version ] +then + echo "Info: runs only on Debian and derivates" + exit +fi + + +if [ -d "$MODROOT" ] +then + if [ -f "$MODROOT/kernel/fs/ceph/ceph.ko" ] + then + if ! [ -f "$MODROOT/kernel/fs/ceph/ceph.ko.dpkg-divert-by-ceph-dkms" ] + then + dpkg-divert --rename --package ceph-dkms --divert "$MODROOT/kernel/fs/ceph/ceph.ko.dpkg-divert-by-ceph-dkms" --add "$MODROOT/kernel/fs/ceph/ceph.ko" + else + echo "Warning: $MODROOT/kernel/fs/ceph/ceph.ko and diverted $MODROOT/kernel/fs/ceph/ceph.ko.dpkg-divert-by-ceph-dkms exist both!" + fi + fi +else + echo "Warning: $MODROOT is not a directory" +fi