diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..cedc6f94 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +mars (0.1astable114-1) unstable; urgency=medium + + * Initial release (Closes: #nnnn) + + -- Gabriel Francisco Thu, 19 Nov 2020 01:02:34 +0000 diff --git a/debian/compat b/debian/compat new file mode 100644 index 00000000..b4de3947 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +11 diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..df587220 --- /dev/null +++ b/debian/control @@ -0,0 +1,21 @@ +Source: mars +Section: misc +Priority: optional +Maintainer: Gabriel Francisco +Build-Depends: debhelper (>= 11), dkms +Standards-Version: 4.1.3 +Homepage: http://schoebel.github.io/mars/ +#Vcs-Browser: https://salsa.debian.org/debian/sample +#Vcs-Git: https://salsa.debian.org/debian/sample.git + +Package: mars-dkms +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: mars kernel module. + It generates and compare two builds using diffoscope. + MARS Light is a block-level storage replication solution implemented + in the form of a Linux kernel module. + . + It's almost a drop-in replacement for DRBD but it works + asynchronously and over arbitrary distances using a technology + similar to transaction logging of database systems. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 00000000..43f73b2a --- /dev/null +++ b/debian/copyright @@ -0,0 +1,31 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: mars +Source: https://github.com/schoebel/mars + +Files: * +Copyright: 2010-2014 Thomas Schoebel-Theuer + 2011-2014 1&1 Internet AG +License: GPL-2+ + This package is 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. + +Files: debian/* +Copyright: 2020 Gabriel Francisco +License: GPL-2+ + This package is 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. + . + This package is 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 received a copy of the GNU General Public License + along with this program. If not, see + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". diff --git a/debian/mars-Kbuild b/debian/mars-Kbuild new file mode 100644 index 00000000..e5d0ae20 --- /dev/null +++ b/debian/mars-Kbuild @@ -0,0 +1,77 @@ +# +# Makefile for MARS +# + +KBUILD_CFLAGS += -fdelete-null-pointer-checks + +obj-$(if $(KBUILD_EXTMOD),m,$(CONFIG_MARS)) := mars.o + +mars-y := \ + lamport.o \ + brick_say.o \ + brick_mem.o \ + brick.o \ + mars_generic.o \ + lib_log.o \ + lib_rank.o \ + lib_limiter.o \ + lib_timing.o \ + lib_mapfree.o \ + mars_net.o \ + mars_server.o \ + mars_client.o \ + mars_aio.o \ + mars_sio.o \ + mars_bio.o \ + mars_if.o \ + mars_copy.o \ + mars_trans_logger.o \ + sy_old/sy_generic.o \ + sy_old/sy_net.o \ + sy_old/mars_proc.o \ + sy_old/mars_main.o + +ifdef CONFIG_DEBUG_KERNEL + +KBUILD_CFLAGS += -fno-inline-functions -fno-inline-small-functions -fno-inline-functions-called-once + +# This is currently not really used. +# We urge people to maintain it by including it in debug versions +# (so the compiler may throw any complaints) + +mars-y += \ + mars_dummy.o \ + mars_check.o \ + mars_buf.o \ + mars_usebuf.o \ + +endif + +extra-y := mars_config.h buildtag.h + +$(obj)/buildtag.h: + exec > $@;\ + /bin/echo -e "/* Automatically generated -- DO NOT EDIT! */";\ + if [ "$$MARSVERSION" != "" ]; then \ + BUILDTAG="$$MARSVERSION"; \ + elif git describe --tags >/dev/null 2>&1; then \ + BUILDTAG="$$(git describe --tags)"; \ + elif [ -e DISTVERSION ]; then \ + BUILDTAG=$$(cat DISTVERSION); \ + else \ + BUILDTAG="no-buildtag-available"; \ + fi; \ + /bin/echo -e "#define BUILDTAG \"$$BUILDTAG\"";\ + /bin/echo -e "#define BUILDHOST \"$$USER@`hostname`\"";\ + /bin/echo -e "#define BUILDDATE \"$$(date '+%F %T')\"" + cat $@; + +GEN_CONFIG_SCRIPT := $(obj)/gen_config.pl +$(obj)/mars_config.h: + $(kecho) "building $@ ..." + if [ ! -x $(GEN_CONFIG_SCRIPT) ]; then \ + $(kecho) "MARS: cannot execute script $(GEN_CONFIG_SCRIPT)"; \ + /bin/false; \ + fi; \ + cat $(src)/Kconfig | $(GEN_CONFIG_SCRIPT) 2>/dev/null > $@; + cat $@ diff --git a/debian/mars-Makefile b/debian/mars-Makefile new file mode 100644 index 00000000..a4acbe0a --- /dev/null +++ b/debian/mars-Makefile @@ -0,0 +1,97 @@ +# +# Makefile for out-of-tree build of MARS module +# +# +# By Benjamin Kübler +# +# usage make [ KDIR =/path/to/kernel/source ] +# +obj-$(CONFIG_MARS) += mars.o + +mars-objs := \ + lamport.o \ + brick_say.o \ + brick_mem.o \ + brick.o \ + mars_generic.o \ + lib_log.o \ + lib_rank.o \ + lib_limiter.o \ + lib_timing.o \ + lib_mapfree.o \ + mars_net.o \ + mars_server.o \ + mars_client.o \ + mars_aio.o \ + mars_sio.o \ + mars_bio.o \ + mars_if.o \ + mars_copy.o \ + mars_trans_logger.o \ + sy_old/sy_generic.o \ + sy_old/sy_net.o \ + sy_old/mars_proc.o \ + sy_old/mars_main.o + +ifneq ($(KERNELRELEASE),) + +# in-tree-build process +include Kbuild + +else +# out-of-tree-build process + +MARSSRC := $(shell pwd) +DESTDIR ?= / +KDIR ?= /lib/modules/$(shell uname -r)/build + +.PHONY: greeting install default clean config + +default: mars_config.h + $(MAKE) -C $(KDIR) M=$(PWD) modules + +greeting: + @echo "Building MARS Module again: KDIR=$(KDIR)" ; + @if ! test -e $(KDIR)/Makefile ; then \ + echo -e "Sorry, kernel makefile not found. You need to tell me a correct KDIR!\n" ; \ + false; \ + fi + +clean: + $(MAKE) -C $(KDIR) M=$(PWD) clean + +config: + $(MAKE) -C $(KDIR) M=$(PWD) config + +install: + $(MAKE) -C $(KDIR) M=$(PWD) modules_install + +extra-y := buildtag.h +buildtag.h: + exec > $@;\ + /bin/echo -e "/* Automatically generated -- DO NOT EDIT! */";\ + if [ "$$MARSVERSION" != "" ]; then \ + BUILDTAG="$$MARSVERSION"; \ + elif git describe --tags >/dev/null 2>&1; then \ + BUILDTAG="$$(git describe --tags)"; \ + elif [ -e DISTVERSION ]; then \ + BUILDTAG=$$(cat DISTVERSION); \ + else \ + BUILDTAG="no-buildtag-available"; \ + fi; \ + /bin/echo -e "#define BUILDTAG \"$$BUILDTAG\"";\ + /bin/echo -e "#define BUILDHOST \"$$USER@`hostname`\"";\ + /bin/echo -e "#define BUILDDATE \"$$(date '+%F %T')\"" + cat $@; + +extra-y += mars_config.h +GEN_CONFIG_SCRIPT := $(MARSSRC)/gen_config.pl +mars_config.h: buildtag.h + if [ ! -x $(GEN_CONFIG_SCRIPT) ]; then \ + $(kecho) "MARS: cannot execute script $(GEN_CONFIG_SCRIPT)"; \ + /bin/false; \ + fi; \ + cat $(MARSSRC)/Kconfig | $(GEN_CONFIG_SCRIPT) 2>/dev/null > $@; + cat $@; + +endif diff --git a/debian/mars-dkms.dkms b/debian/mars-dkms.dkms new file mode 100644 index 00000000..8b70e529 --- /dev/null +++ b/debian/mars-dkms.dkms @@ -0,0 +1,5 @@ +PACKAGE_NAME="mars" +PACKAGE_VERSION="0.1astable144" +BUILT_MODULE_NAME[0]="$PACKAGE_NAME" +DEST_MODULE_LOCATION[0]="/kernel/drivers/block" +AUTOINSTALL="yes" diff --git a/debian/mars-dkms.postinst b/debian/mars-dkms.postinst new file mode 100644 index 00000000..ee661d25 --- /dev/null +++ b/debian/mars-dkms.postinst @@ -0,0 +1,26 @@ +#!/bin/sh +set -e + +#DEBHELPER# + +case "$1" in + install) + ;; + + configure|reconfigure) + # Get the version of the current loaded module: + old_version="$(cat /sys/module/mars/version 2>/dev/null)" || exit 0 + # Get the version of the latest available module: + new_version="$(modinfo -F version mars 2>/dev/null)" || exit 0 + # See if the new one is actually newer: + dpkg --compare-versions "$old_version" lt "$new_version" || exit 0 + # Trigger an update notification that recommends a reboot: + touch /run/reboot-required || true + grep -Fqsx mars-dkms /run/reboot-required.pkgs || \ + echo mars-dkms >> /run/reboot-required.pkgs || true + ;; + *) + ;; +esac + +exit 0 diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000..737636a9 --- /dev/null +++ b/debian/rules @@ -0,0 +1,35 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +#export DH_VERBOSE = 1 + +# see FEATURE AREAS in dpkg-buildflags(1) +#export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +# see ENVIRONMENT in dpkg-buildflags(1) +# package maintainers to append CFLAGS +#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +# package maintainers to append LDFLAGS +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + +include /usr/share/dpkg/default.mk + +%: + dh $@ --with dkms + +override_dh_install: + cp debian/mars-Makefile kernel/Makefile + cp debian/mars-Kbuild kernel/Kbuild + dh_install scripts/gen_config.pl usr/src/mars-$(DEB_VERSION_UPSTREAM)/ + dh_install kernel/* usr/src/mars-$(DEB_VERSION_UPSTREAM)/ + +override_dh_dkms: + dh_dkms -V $(DEB_VERSION_UPSTREAM) + +override_dh_auto_configure: +override_dh_auto_build: +override_dh_auto_test: +override_dh_auto_install: +override_dh_auto_clean: + @git checkout -- kernel + diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 00000000..163aaf8d --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt)