diff --git a/0003-o2cb-add-build-scripts-for-rhel7.patch b/0003-o2cb-add-build-scripts-for-rhel7.patch new file mode 100644 index 0000000..f068cc9 --- /dev/null +++ b/0003-o2cb-add-build-scripts-for-rhel7.patch @@ -0,0 +1,163 @@ +From: Junxiao Bi +To: +Date: 6/29/2015 4:29 PM +Subject: [Ocfs2-tools-devel] [PATCH 1/6] ocfs2-tools: add build scripts for rhel7 + +Signed-off-by: Junxiao Bi +--- + vendor/Makefile | 2 +- + vendor/rhel7/Makefile | 10 +++++++ + vendor/rhel7/Vendor.make | 10 +++++++ + vendor/rhel7/rpmarch.guess | 68 ++++++++++++++++++++++++++++++++++++++++++++ + vendor/rhel7/vendor.guess | 13 +++++++++ + 5 files changed, 102 insertions(+), 1 deletion(-) + create mode 100644 vendor/rhel7/Makefile + create mode 100644 vendor/rhel7/Vendor.make + create mode 100755 vendor/rhel7/rpmarch.guess + create mode 100755 vendor/rhel7/vendor.guess + +diff --git a/vendor/Makefile b/vendor/Makefile +index 8819586..58ac84d 100644 +--- a/vendor/Makefile ++++ b/vendor/Makefile +@@ -2,6 +2,6 @@ TOPDIR = .. + + include $(TOPDIR)/Preamble.make + +-SUBDIRS = common rhel6 rhel5 sles10 rhel4 sles9 fc7 fc8 fc9 ++SUBDIRS = common rhel7 rhel6 rhel5 sles10 rhel4 sles9 fc7 fc8 fc9 + + include $(TOPDIR)/Postamble.make +diff --git a/vendor/rhel7/Makefile b/vendor/rhel7/Makefile +new file mode 100644 +index 0000000..7afe47c +--- /dev/null ++++ b/vendor/rhel7/Makefile +@@ -0,0 +1,10 @@ ++TOPDIR = ../.. ++ ++include $(TOPDIR)/Preamble.make ++ ++DIST_FILES = \ ++ rpmarch.guess \ ++ Vendor.make \ ++ vendor.guess ++ ++include $(TOPDIR)/Postamble.make +diff --git a/vendor/rhel7/Vendor.make b/vendor/rhel7/Vendor.make +new file mode 100644 +index 0000000..b8fc25e +--- /dev/null ++++ b/vendor/rhel7/Vendor.make +@@ -0,0 +1,10 @@ ++# ++# RHEL 7 ++# ++ ++TOOLSARCH = $(shell $(TOPDIR)/vendor/rhel7/rpmarch.guess tools $(TOPDIR)) ++VENDOR_EXTENSION = el7 ++ ++include $(TOPDIR)/vendor/common/Vendor.make ++ ++packages: rpm +diff --git a/vendor/rhel7/rpmarch.guess b/vendor/rhel7/rpmarch.guess +new file mode 100755 +index 0000000..8519589 +--- /dev/null ++++ b/vendor/rhel7/rpmarch.guess +@@ -0,0 +1,68 @@ ++#! /bin/sh ++ ++mode="$1" ++srcdir="$2" ++ ++host_cpu= ++ ++ ++QUERYFILE=/etc/redhat-release ++ ++if test -n "$QUERYFILE"; then ++ host_cpu="`rpm -qf $QUERYFILE --queryformat \"%{ARCH}\"`" ++fi ++ ++if test -z "$host_cpu" -o "$host_cpu" = "noarch" ; then ++ host_alias=`$srcdir/config.guess` ++ host=`$srcdir/config.sub $host_alias` ++ host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` ++fi ++ ++case "$host_cpu" in ++ x86_64|ia64|s390x) ++ TOOLSARCH="$host_cpu" ++ ;; ++ i386|i486|i586|i686|i786|k6|k7) ++ TOOLSARCH="i386" ++ ;; ++ ppc|ppc64|ppciseries|ppcpseries|ppc64iseries|ppc64pseries|powerpc|powerpc64) ++ TOOLSARCH="ppc" ++ ;; ++ *) ++ echo "rpmarch.guess: Warning: unknown RPM CPU architecture: $host_cpu" >&2 ++ TOOLSARCH="" ++ ;; ++esac ++ ++# Only a few of these need to be overwritten from RPM's default ++case "$host_cpu" in ++ i386|i586) ++ MODULEARCH="i686" ++ ;; ++ ppc|ppc64|ppciseries|ppcpseries|ppc64iseries|ppc64pseries|powerpc|powerpc64) ++ MODULEARCH="ppc64" ++ ;; ++ *) ++ MODULEARCH="" ++ ;; ++esac ++ ++case "$mode" in ++ module) ++ if [ -n "$MODULEARCH" ] ; then ++ echo "--target $MODULEARCH" ++ fi ++ ;; ++ tools) ++ if [ -n "$TOOLSARCH" ] ; then ++ echo "--target $TOOLSARCH" ++ fi ++ ;; ++ *) ++ echo "rpmarch.guess: Invalid mode: $mode" >&2 ++ echo "error" ++ exit 1 ++ ;; ++esac ++ ++exit 0 +diff --git a/vendor/rhel7/vendor.guess b/vendor/rhel7/vendor.guess +new file mode 100755 +index 0000000..c3a8b12 +--- /dev/null ++++ b/vendor/rhel7/vendor.guess +@@ -0,0 +1,13 @@ ++#!/bin/sh ++ ++if [ ! -f /etc/redhat-release ] ++then ++ exit 1 ++fi ++ ++case "`rpm -qf /etc/redhat-release --qf '%{VERSION}' 2>/dev/null`" in ++ 7*) ;; ++ *) exit 1;; ++esac ++ ++exit 0 +-- +1.7.9.5 + + +_______________________________________________ +Ocfs2-tools-devel mailing list +Ocfs2-tools-devel@oss.oracle.com +https://oss.oracle.com/mailman/listinfo/ocfs2-tools-devel diff --git a/0004-add-systemd-support.patch b/0004-add-systemd-support.patch new file mode 100644 index 0000000..24fdfa2 --- /dev/null +++ b/0004-add-systemd-support.patch @@ -0,0 +1,309 @@ +From: Junxiao Bi +To: +Date: 6/29/2015 4:29 PM +Subject: [Ocfs2-tools-devel] [PATCH 2/6] ocfs2-tools: add systemd support + +When systemd is enabled, the old way to start/stop/status service +should be disabled, so move /etc/init.d/o2cb and /etc/init.d/ocfs2 +to /sbin. + +Signed-off-by: Junxiao Bi +--- + vendor/common/Makefile | 4 ++- + vendor/common/Vendor.make | 1 + + vendor/common/o2cb.service | 14 ++++++++ + vendor/common/ocfs2-tools.spec-generic.in | 55 +++++++++++++++++++++++------ + vendor/common/ocfs2.service | 14 ++++++++ + vendor/fc7/Vendor.make | 1 + + vendor/fc8/Vendor.make | 1 + + vendor/fc9/Vendor.make | 1 + + vendor/rhel4/Vendor.make | 1 + + vendor/rhel5/Vendor.make | 1 + + vendor/rhel6/Vendor.make | 1 + + vendor/rhel7/Vendor.make | 1 + + vendor/sles10/Vendor.make | 1 + + vendor/sles9/Vendor.make | 1 + + 14 files changed, 85 insertions(+), 12 deletions(-) + create mode 100644 vendor/common/o2cb.service + create mode 100644 vendor/common/ocfs2.service + +diff --git a/vendor/common/Makefile b/vendor/common/Makefile +index 864a71e..3c8902c 100644 +--- a/vendor/common/Makefile ++++ b/vendor/common/Makefile +@@ -25,6 +25,8 @@ DIST_FILES = \ + ocfs2-tools.spec-generic.in \ + 51-ocfs2.rules \ + Vendor.make \ +- o2cb.sysconfig.5.in ++ o2cb.sysconfig.5.in \ ++ o2cb.service \ ++ ocfs2.service + + include $(TOPDIR)/Postamble.make +diff --git a/vendor/common/Vendor.make b/vendor/common/Vendor.make +index e92884e..2526cdc 100644 +--- a/vendor/common/Vendor.make ++++ b/vendor/common/Vendor.make +@@ -20,6 +20,7 @@ $(TOPDIR)/ocfs2-tools-$(DIST_VERSION)-$(PKG_VERSION).$(VENDOR_EXTENSION).src.rpm + -e 's,@@PYVERSION@@,'$(PYVERSION)',g' \ + -e 's,@@COMPILE_PY@@,'$(COMPILE_PY)',g' \ + -e 's,@@CHKCONFIG_DEP@@,'$(CHKCONFIG_DEP)',g' \ ++ -e 's,@@SYSTEMD_ENABLED@@,'$(SYSTEMD_ENABLED)',g' \ + < "$(TOPDIR)/vendor/common/ocfs2-tools.spec-generic" \ + > "$(TOPDIR)/vendor/common/ocfs2-tools.spec" + $(RPMBUILD) -bs --define "_sourcedir $(RPM_TOPDIR)" --define "_srcrpmdir $(RPM_TOPDIR)" "$(TOPDIR)/vendor/common/ocfs2-tools.spec" +diff --git a/vendor/common/o2cb.service b/vendor/common/o2cb.service +new file mode 100644 +index 0000000..94e2b1a +--- /dev/null ++++ b/vendor/common/o2cb.service +@@ -0,0 +1,14 @@ ++[Unit] ++Description=Load o2cb Modules ++Requires=network.service ++After=network.service ++ ++[Service] ++Type=oneshot ++RemainAfterExit=yes ++ExecStart=/sbin/o2cb.init enable ++ExecStop=/sbin/o2cb.init disable ++ExecRestart=/sbin/o2cb.init restart ++ ++[Install] ++WantedBy=multi-user.target +diff --git a/vendor/common/ocfs2-tools.spec-generic.in b/vendor/common/ocfs2-tools.spec-generic.in +index 4fabc8c..9527908 100644 +--- a/vendor/common/ocfs2-tools.spec-generic.in ++++ b/vendor/common/ocfs2-tools.spec-generic.in +@@ -17,6 +17,7 @@ + + %define build_ocfs2console 0 + %define compile_py 0 ++%define systemd_enabled @@SYSTEMD_ENABLED@@ + + %if %{build_ocfs2console} + %define compile_py @@COMPILE_PY@@ +@@ -80,9 +81,18 @@ make + + %install + +-mkdir -p $RPM_BUILD_ROOT/etc/init.d +-cp -f vendor/common/o2cb.init $RPM_BUILD_ROOT/etc/init.d/o2cb +-cp -f vendor/common/ocfs2.init $RPM_BUILD_ROOT/etc/init.d/ocfs2 ++%if %{systemd_enabled} ++ mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/system ++ cp -f vendor/common/o2cb.service $RPM_BUILD_ROOT/usr/lib/systemd/system/ ++ cp -f vendor/common/ocfs2.service $RPM_BUILD_ROOT/usr/lib/systemd/system/ ++ mkdir -p $RPM_BUILD_ROOT/sbin ++ cp -f vendor/common/o2cb.init $RPM_BUILD_ROOT/sbin ++ cp -f vendor/common/ocfs2.init $RPM_BUILD_ROOT/sbin ++%else ++ mkdir -p $RPM_BUILD_ROOT/etc/init.d ++ cp -f vendor/common/o2cb.init $RPM_BUILD_ROOT/etc/init.d/o2cb ++ cp -f vendor/common/ocfs2.init $RPM_BUILD_ROOT/etc/init.d/ocfs2 ++%endif + if [ -f /etc/redhat-release ] + then + # Red Hat chkconfig is completely and utterly broken +@@ -104,14 +114,27 @@ rm -rf "$RPM_BUILD_ROOT" + + + %post +-/sbin/chkconfig --add o2cb >/dev/null +-/sbin/chkconfig --add ocfs2 >/dev/null ++%if !%{systemd_enabled} ++ /sbin/chkconfig --add o2cb >/dev/null ++ /sbin/chkconfig --add ocfs2 >/dev/null ++%else ++ # clean up start/kill entry in /etc/rc*.d/ when upgrade. ++ if [ -f /etc/init.d/o2cb ]; then ++ /sbin/chkconfig --del o2cb >/dev/null ++ fi ++ ++ if [ -f /etc/init.d/ocfs2 ]; then ++ /sbin/chkconfig --del ocfs2 >/dev/null ++ fi ++%endif + + %preun +-if [ $1 = 0 ]; then # execute this only if we are NOT doing an upgrade +- /sbin/chkconfig --del ocfs2 >/dev/null +- /sbin/chkconfig --del o2cb >/dev/null +-fi ++%if !%{systemd_enabled} ++ if [ $1 = 0 ]; then # execute this only if we are NOT doing an upgrade ++ /sbin/chkconfig --del ocfs2 >/dev/null ++ /sbin/chkconfig --del o2cb >/dev/null ++ fi ++%endif + + %files + %defattr(-,root,root) +@@ -127,10 +150,17 @@ fi + /sbin/o2image + /sbin/o2cluster + /sbin/ocfs2_hb_ctl +-/usr/bin/o2info +-/usr/sbin/o2hbmonitor ++%if %{systemd_enabled} ++/sbin/o2cb.init ++/sbin/ocfs2.init ++/usr/lib/systemd/system/o2cb.service ++/usr/lib/systemd/system/ocfs2.service ++%else + /etc/init.d/o2cb + /etc/init.d/ocfs2 ++%endif ++/usr/bin/o2info ++/usr/sbin/o2hbmonitor + %config(noreplace) /etc/sysconfig/o2cb + /usr/share/man/man8/debugfs.ocfs2.8.gz + /usr/share/man/man8/fsck.ocfs2.8.gz +@@ -172,6 +202,9 @@ fi + + + %changelog ++* Thu Jun 18 2015 Junxiao Bi ++- Add systemd support ++ + * Thu Jan 27 2005 Manish Singh + - Add ocfs2console + +diff --git a/vendor/common/ocfs2.service b/vendor/common/ocfs2.service +new file mode 100644 +index 0000000..768f806 +--- /dev/null ++++ b/vendor/common/ocfs2.service +@@ -0,0 +1,14 @@ ++[Unit] ++Description=Load ocfs2 Modules ++Requires=o2cb.service ++After=o2cb.service ++ ++[Service] ++Type=oneshot ++RemainAfterExit=yes ++ExecStart=/sbin/ocfs2.init start ++ExecStop=/sbin/ocfs2.init stop ++ExecReload=/sbin/ocfs2.init restart ++ ++[Install] ++WantedBy=multi-user.target +diff --git a/vendor/fc7/Vendor.make b/vendor/fc7/Vendor.make +index 025de08..a3002af 100644 +--- a/vendor/fc7/Vendor.make ++++ b/vendor/fc7/Vendor.make +@@ -4,6 +4,7 @@ + + TOOLSARCH = $(shell $(TOPDIR)/vendor/fc7/rpmarch.guess tools $(TOPDIR)) + VENDOR_EXTENSION = fc7 ++SYSTEMD_ENABLED = 0 + + include $(TOPDIR)/vendor/common/Vendor.make + +diff --git a/vendor/fc8/Vendor.make b/vendor/fc8/Vendor.make +index 6a78602..ba9c4f0 100644 +--- a/vendor/fc8/Vendor.make ++++ b/vendor/fc8/Vendor.make +@@ -4,6 +4,7 @@ + + TOOLSARCH = $(shell $(TOPDIR)/vendor/fc8/rpmarch.guess tools $(TOPDIR)) + VENDOR_EXTENSION = fc8 ++SYSTEMD_ENABLED = 0 + + include $(TOPDIR)/vendor/common/Vendor.make + +diff --git a/vendor/fc9/Vendor.make b/vendor/fc9/Vendor.make +index db9fde1..64d03fd 100644 +--- a/vendor/fc9/Vendor.make ++++ b/vendor/fc9/Vendor.make +@@ -4,6 +4,7 @@ + + TOOLSARCH = $(shell $(TOPDIR)/vendor/fc9/rpmarch.guess tools $(TOPDIR)) + VENDOR_EXTENSION = fc9 ++SYSTEMD_ENABLED = 0 + + include $(TOPDIR)/vendor/common/Vendor.make + +diff --git a/vendor/rhel4/Vendor.make b/vendor/rhel4/Vendor.make +index 2245f44..5ce8e05 100644 +--- a/vendor/rhel4/Vendor.make ++++ b/vendor/rhel4/Vendor.make +@@ -4,6 +4,7 @@ + + TOOLSARCH = $(shell $(TOPDIR)/vendor/rhel4/rpmarch.guess tools $(TOPDIR)) + VENDOR_EXTENSION = el4 ++SYSTEMD_ENABLED = 0 + + include $(TOPDIR)/vendor/common/Vendor.make + +diff --git a/vendor/rhel5/Vendor.make b/vendor/rhel5/Vendor.make +index fb5b591..8156000 100644 +--- a/vendor/rhel5/Vendor.make ++++ b/vendor/rhel5/Vendor.make +@@ -4,6 +4,7 @@ + + TOOLSARCH = $(shell $(TOPDIR)/vendor/rhel5/rpmarch.guess tools $(TOPDIR)) + VENDOR_EXTENSION = el5 ++SYSTEMD_ENABLED = 0 + + include $(TOPDIR)/vendor/common/Vendor.make + +diff --git a/vendor/rhel6/Vendor.make b/vendor/rhel6/Vendor.make +index 8f4a470..20144a3 100644 +--- a/vendor/rhel6/Vendor.make ++++ b/vendor/rhel6/Vendor.make +@@ -4,6 +4,7 @@ + + TOOLSARCH = $(shell $(TOPDIR)/vendor/rhel6/rpmarch.guess tools $(TOPDIR)) + VENDOR_EXTENSION = el6 ++SYSTEMD_ENABLED = 0 + + include $(TOPDIR)/vendor/common/Vendor.make + +diff --git a/vendor/rhel7/Vendor.make b/vendor/rhel7/Vendor.make +index b8fc25e..cc3925b 100644 +--- a/vendor/rhel7/Vendor.make ++++ b/vendor/rhel7/Vendor.make +@@ -4,6 +4,7 @@ + + TOOLSARCH = $(shell $(TOPDIR)/vendor/rhel7/rpmarch.guess tools $(TOPDIR)) + VENDOR_EXTENSION = el7 ++SYSTEMD_ENABLED = 1 + + include $(TOPDIR)/vendor/common/Vendor.make + +diff --git a/vendor/sles10/Vendor.make b/vendor/sles10/Vendor.make +index 85969ea..56b1feb 100644 +--- a/vendor/sles10/Vendor.make ++++ b/vendor/sles10/Vendor.make +@@ -4,6 +4,7 @@ + + TOOLSARCH = $(shell $(TOPDIR)/vendor/sles10/rpmarch.guess tools $(TOPDIR)) + VENDOR_EXTENSION = SLE10 ++SYSTEMD_ENABLED = 0 + + include $(TOPDIR)/vendor/common/Vendor.make + +diff --git a/vendor/sles9/Vendor.make b/vendor/sles9/Vendor.make +index 8cb0482..56be69f 100644 +--- a/vendor/sles9/Vendor.make ++++ b/vendor/sles9/Vendor.make +@@ -4,6 +4,7 @@ + + TOOLSARCH = $(shell $(TOPDIR)/vendor/sles9/rpmarch.guess tools $(TOPDIR)) + VENDOR_EXTENSION = SLE9 ++SYSTEMD_ENABLED = 0 + + include $(TOPDIR)/vendor/common/Vendor.make + +-- +1.7.9.5 + + +_______________________________________________ +Ocfs2-tools-devel mailing list +Ocfs2-tools-devel@oss.oracle.com +https://oss.oracle.com/mailman/listinfo/ocfs2-tools-devel diff --git a/0005-do-not-write-sysconfig-if-status-not-changed.patch b/0005-do-not-write-sysconfig-if-status-not-changed.patch new file mode 100644 index 0000000..c0c2bc0 --- /dev/null +++ b/0005-do-not-write-sysconfig-if-status-not-changed.patch @@ -0,0 +1,49 @@ +From: Junxiao Bi +To: +Date: 6/29/2015 4:29 PM +Subject: [Ocfs2-tools-devel] [PATCH 3/6] o2cb: don't write sysconfig if status not changed + +Signed-off-by: Junxiao Bi +--- + vendor/common/o2cb.init.sh | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +diff --git a/vendor/common/o2cb.init.sh b/vendor/common/o2cb.init.sh +index 9e0b31c..e2f80f7 100755 +--- a/vendor/common/o2cb.init.sh ++++ b/vendor/common/o2cb.init.sh +@@ -1925,16 +1925,20 @@ case "$1" in + ;; + + enable) +- O2CB_ENABLED=true +- write_sysconfig +- if_fail "$?" "Unable to write the driver configuration" ++ if [ "$O2CB_ENABLED" != "true" ]; then ++ O2CB_ENABLED=true ++ write_sysconfig ++ if_fail "$?" "Unable to write the driver configuration" ++ fi + start + ;; + + disable) +- O2CB_ENABLED=false +- write_sysconfig +- if_fail "$?" "Unable to write the driver configuration" ++ if [ "$O2CB_ENABLED" != "false" ]; then ++ O2CB_ENABLED=false ++ write_sysconfig ++ if_fail "$?" "Unable to write the driver configuration" ++ fi + stop + ;; + +-- +1.7.9.5 + + +_______________________________________________ +Ocfs2-tools-devel mailing list +Ocfs2-tools-devel@oss.oracle.com +https://oss.oracle.com/mailman/listinfo/ocfs2-tools-devel diff --git a/0006-o2cb-mount-debugfs-when-load-config.patch b/0006-o2cb-mount-debugfs-when-load-config.patch new file mode 100644 index 0000000..8023f53 --- /dev/null +++ b/0006-o2cb-mount-debugfs-when-load-config.patch @@ -0,0 +1,79 @@ +From: Junxiao Bi +To: +Date: 6/29/2015 4:29 PM +Subject: [Ocfs2-tools-devel] [PATCH 4/6] o2cb: mount debugfs when load config + +o2hbmonitor depends on debugfs to work, mount it when +load the config. + +Signed-off-by: Cathy A Avery +Signed-off-by: Adnan G Misherfi +Signed-off-by: Junxiao Bi +--- + vendor/common/o2cb.init.sh | 27 +++++++++++++++++++++++++++ + 1 file changed, 27 insertions(+) + +diff --git a/vendor/common/o2cb.init.sh b/vendor/common/o2cb.init.sh +index e2f80f7..dedb408 100755 +--- a/vendor/common/o2cb.init.sh ++++ b/vendor/common/o2cb.init.sh +@@ -1315,10 +1315,25 @@ check_load_module() + return 2 + } + ++check_debugfs_mount() ++{ ++ echo "checking debugfs..." ++ ++ mount | grep debugfs | grep /sys/kernel/debug > /dev/null ++ if [ "$?" -eq "1" ] ++ then ++ mount -t debugfs nodev /sys/kernel/debug ++ fi ++} ++ ++ ++ + load() + { + PLUGIN="$(select_stack_plugin)" + ++ check_debugfs_mount ++ + touch_lockfile + + # XXX: SPECIAL CASE! We must load configfs for configfs_path() to work +@@ -1820,6 +1835,16 @@ online_status() + online_status_$PLUGIN "$CLUSTER" + } + ++debugfs_mount_status() ++{ ++ if mount | grep debugfs | grep /sys/kernel/debug > /dev/null ++ then ++ echo "Debug file system at /sys/kernel/debug: mounted" ++ else ++ echo "Debug file system at /sys/kernel/debug: not mounted" ++ fi ++} ++ + status() + { + load_status +@@ -1833,6 +1858,8 @@ status() + online_status "$CLUSTER" + + userdlm_status ++ ++ debugfs_mount_status + } + + # +-- +1.7.9.5 + + +_______________________________________________ +Ocfs2-tools-devel mailing list +Ocfs2-tools-devel@oss.oracle.com +https://oss.oracle.com/mailman/listinfo/ocfs2-tools-devel diff --git a/0007-vendor-Add-vendor-files-for-sles12.patch b/0007-vendor-Add-vendor-files-for-sles12.patch new file mode 100644 index 0000000..4ba53c8 --- /dev/null +++ b/0007-vendor-Add-vendor-files-for-sles12.patch @@ -0,0 +1,165 @@ +From c89760fc41f466a7a2be99ed2f648875c2d64e7a Mon Sep 17 00:00:00 2001 +From: Eric Ren +Date: Thu, 23 Jul 2015 17:13:39 +0800 +Subject: [PATCH 2/3] vendor: Add vendor files for sles12 + +Add vendor files for sles12, and enable systemd support for o2cb +based on the patch named "add systemd support" from "Junxiao Bi" +. + +Signed-off-by: Eric Ren +--- + vendor/Makefile | 2 +- + vendor/sles12/Makefile | 10 +++++++ + vendor/sles12/Vendor.make | 11 +++++++ + vendor/sles12/rpmarch.guess | 70 +++++++++++++++++++++++++++++++++++++++++++++ + vendor/sles12/vendor.guess | 13 +++++++++ + 5 files changed, 105 insertions(+), 1 deletion(-) + create mode 100644 vendor/sles12/Makefile + create mode 100644 vendor/sles12/Vendor.make + create mode 100755 vendor/sles12/rpmarch.guess + create mode 100755 vendor/sles12/vendor.guess + +diff --git a/vendor/Makefile b/vendor/Makefile +index 58ac84d..022d030 100644 +--- a/vendor/Makefile ++++ b/vendor/Makefile +@@ -2,6 +2,6 @@ TOPDIR = .. + + include $(TOPDIR)/Preamble.make + +-SUBDIRS = common rhel7 rhel6 rhel5 sles10 rhel4 sles9 fc7 fc8 fc9 ++SUBDIRS = common sles12 rhel7 rhel6 rhel5 sles10 rhel4 sles9 fc7 fc8 fc9 + + include $(TOPDIR)/Postamble.make +diff --git a/vendor/sles12/Makefile b/vendor/sles12/Makefile +new file mode 100644 +index 0000000..89c16a7 +--- /dev/null ++++ b/vendor/sles12/Makefile +@@ -0,0 +1,10 @@ ++TOPDIR = ../.. ++ ++include $(TOPDIR)/Preamble.make ++ ++DIST_FILES = \ ++ rpmarch.guess \ ++ Vendor.make \ ++ vendor.guess ++ ++include $(TOPDIR)/Postamble.make +diff --git a/vendor/sles12/Vendor.make b/vendor/sles12/Vendor.make +new file mode 100644 +index 0000000..b186054 +--- /dev/null ++++ b/vendor/sles12/Vendor.make +@@ -0,0 +1,11 @@ ++# ++# SLES 12 ++# ++ ++TOOLSARCH = $(shell $(TOPDIR)/vendor/sles12/rpmarch.guess tools $(TOPDIR)) ++VENDOR_EXTENSION = SLE12 ++SYSTEMD_ENABLED = 1 ++ ++include $(TOPDIR)/vendor/common/Vendor.make ++ ++packages: rpm +diff --git a/vendor/sles12/rpmarch.guess b/vendor/sles12/rpmarch.guess +new file mode 100755 +index 0000000..3514627 +--- /dev/null ++++ b/vendor/sles12/rpmarch.guess +@@ -0,0 +1,70 @@ ++#! /bin/sh ++ ++mode="$1" ++srcdir="$2" ++ ++host_cpu= ++ ++QUERYFILE=/etc/SuSE-release ++ ++if test -n "$QUERYFILE"; then ++ host_cpu="`rpm -qf $QUERYFILE --queryformat \"%{ARCH}\"`" ++fi ++ ++if test -z "$host_cpu" -o "$host_cpu" = "noarch" ; then ++ host_alias=`$srcdir/config.guess` ++ host=`$srcdir/config.sub $host_alias` ++ host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` ++fi ++ ++case "$host_cpu" in ++ x86_64|ia64|s390x) ++ TOOLSARCH="$host_cpu" ++ ;; ++ i386|i486|i586|i686|i786|k6|k7) ++ TOOLSARCH="i386" ++ ;; ++ ppc|ppc64|ppciseries|ppcpseries|ppc64iseries|ppc64pseries|powerpc|powerpc64) ++ TOOLSARCH="ppc" ++ ;; ++ *) ++ echo "rpmarch.guess: Warning: unknown RPM CPU architecture: $host_cpu" >&2 ++ TOOLSARCH="" ++ ;; ++esac ++ ++# Only a few of these need to be overwritten from RPM's default ++case "$host_cpu" in ++ i586) ++ MODULEARCH="$host_cpu" ++ ;; ++ i386|i686) ++ MODULEARCH="i586" ++ ;; ++ ppc|ppc64|ppciseries|ppcpseries|ppc64iseries|ppc64pseries|powerpc|powerpc64) ++ MODULEARCH="ppc64" ++ ;; ++ *) ++ MODULEARCH="" ++ ;; ++esac ++ ++case "$mode" in ++ module) ++ if [ -n "$MODULEARCH" ] ; then ++ echo "--target $MODULEARCH" ++ fi ++ ;; ++ tools) ++ if [ -n "$TOOLSARCH" ] ; then ++ echo "--target $TOOLSARCH" ++ fi ++ ;; ++ *) ++ echo "rpmarch.guess: Invalid mode: $mode" >&2 ++ echo "error" ++ exit 1 ++ ;; ++esac ++ ++exit 0 +diff --git a/vendor/sles12/vendor.guess b/vendor/sles12/vendor.guess +new file mode 100755 +index 0000000..83ce085 +--- /dev/null ++++ b/vendor/sles12/vendor.guess +@@ -0,0 +1,13 @@ ++#!/bin/sh ++ ++if [ ! -f /etc/SuSE-release ] ++then ++ exit 1 ++fi ++ ++if [ "`rpm -qf /etc/SuSE-release --qf '%{VERSION}' 2>/dev/null`" != "12" ] ++then ++ exit 1 ++fi ++ ++exit 0 +-- +2.1.4 + diff --git a/0008-ocfs2-tools-add-systemd-support-fix.patch b/0008-ocfs2-tools-add-systemd-support-fix.patch new file mode 100644 index 0000000..2c9c92f --- /dev/null +++ b/0008-ocfs2-tools-add-systemd-support-fix.patch @@ -0,0 +1,30 @@ +From dc357b652edb7e8e2970fd6f4549c433710093b8 Mon Sep 17 00:00:00 2001 +From: Eric Ren +Date: Tue, 8 Sep 2015 10:27:51 +0800 +Subject: [PATCH 3/3] ocfs2-tools: add systemd support fix + +The ocfs2.service should be after remote-fs.target so that iscsi +volume would be available at first. + +Signed-off-by: Eric Ren +Reviewed-by: Junxiao Bi +--- + vendor/common/ocfs2.service | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/vendor/common/ocfs2.service b/vendor/common/ocfs2.service +index 768f806..c7ecbea 100644 +--- a/vendor/common/ocfs2.service ++++ b/vendor/common/ocfs2.service +@@ -1,7 +1,7 @@ + [Unit] + Description=Load ocfs2 Modules + Requires=o2cb.service +-After=o2cb.service ++After=o2cb.service remote-fs.target + + [Service] + Type=oneshot +-- +2.1.4 + diff --git a/ocfs2-tools.changes b/ocfs2-tools.changes index 08cb559..69112ca 100644 --- a/ocfs2-tools.changes +++ b/ocfs2-tools.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Tue Sep 8 02:58:55 UTC 2015 - zren@suse.com + +- Add systemd support for o2cb and ocfs2 service + + 0003-o2cb-add-build-scripts-for-rhel7.patch + + 0004-add-systemd-support.patch + + 0005-do-not-write-sysconfig-if-status-not-changed.patch + + 0006-o2cb-mount-debugfs-when-load-config.patch + + 0007-vendor-Add-vendor-files-for-sles12.patch + + 0008-ocfs2-tools-add-systemd-support-fix.patch + ------------------------------------------------------------------- Fri May 8 13:12:57 UTC 2015 - ghe@suse.com diff --git a/ocfs2-tools.spec b/ocfs2-tools.spec index b4ccdb8..e862cfa 100644 --- a/ocfs2-tools.spec +++ b/ocfs2-tools.spec @@ -37,6 +37,12 @@ Patch205: ocfs2-tools-kernel33.patch Patch206: ocfs2-tools-resource.patch Patch301: 0001-libo2dlm-Close-file-description-after-use.patch Patch302: 0002-debugfs.ocfs2-Fix-a-bug-in-process_open_args.patch +Patch401: 0003-o2cb-add-build-scripts-for-rhel7.patch +Patch402: 0004-add-systemd-support.patch +Patch403: 0005-do-not-write-sysconfig-if-status-not-changed.patch +Patch404: 0006-o2cb-mount-debugfs-when-load-config.patch +Patch405: 0007-vendor-Add-vendor-files-for-sles12.patch +Patch406: 0008-ocfs2-tools-add-systemd-support-fix.patch BuildRequires: autoconf BuildRequires: e2fsprogs-devel @@ -63,6 +69,11 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?suse_version} < 1320 Recommends: ocfs2-kmp %endif +%if 0%{?suse_version} >= 1315 + %define systemd_enabled 1 +%else + %define systemd_enabled 0 +%endif %description OCFS2 is the Oracle Cluster File System. @@ -137,6 +148,12 @@ OCFS2 filesystem. %patch206 -p1 %patch301 -p1 %patch302 -p1 +%patch401 -p1 +%patch402 -p1 +%patch403 -p1 +%patch404 -p1 +%patch405 -p1 +%patch406 -p1 %build export PROJECT="ocfs2-tools" @@ -153,18 +170,27 @@ cd .. %install mkdir -p %{buildroot}/sbin mkdir -p %{buildroot}%{_prefix}/bin -mkdir -p %{buildroot}%{_sysconfdir}/init.d mkdir -p %{buildroot}%{_localstatedir}/adm/fillup-templates mkdir -p %{buildroot}%{_sysconfdir}/udev/rules.d/ mkdir -p %{buildroot}%{_prefix}/lib/ocf/resource.d/ocfs2 -cp -f vendor/common/o2cb.init %{buildroot}%{_sysconfdir}/init.d/o2cb -cp -f vendor/common/ocfs2.init %{buildroot}%{_sysconfdir}/init.d/ocfs2 cp -f vendor/common/51-ocfs2.rules %{buildroot}%{_sysconfdir}/udev/rules.d cp -f $RPM_SOURCE_DIR/o2cb.ocf %{buildroot}%{_prefix}/lib/ocf/resource.d/ocfs2/o2cb chmod a+x %{buildroot}%{_prefix}/lib/ocf/resource.d/ocfs2/o2cb cp -f vendor/common/o2cb.sysconfig %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.o2cb -ln -sf ..%{_sysconfdir}/init.d/o2cb %{buildroot}/sbin/rco2cb -ln -sf ..%{_sysconfdir}/init.d/ocfs2 %{buildroot}/sbin/rcocfs2 + +%if %{systemd_enabled} + mkdir -p %{buildroot}/usr/lib/systemd/system + cp -f vendor/common/o2cb.service %{buildroot}/usr/lib/systemd/system/ + cp -f vendor/common/ocfs2.service %{buildroot}/usr/lib/systemd/system/ + cp -f vendor/common/o2cb.init %{buildroot}/sbin + cp -f vendor/common/ocfs2.init %{buildroot}/sbin +%else + mkdir -p %{buildroot}%{_sysconfdir}/init.d + cp -f vendor/common/o2cb.init %{buildroot}%{_sysconfdir}/init.d/o2cb + cp -f vendor/common/ocfs2.init %{buildroot}%{_sysconfdir}/init.d/ocfs2 + ln -sf ..%{_sysconfdir}/init.d/o2cb %{buildroot}/sbin/rco2cb + ln -sf ..%{_sysconfdir}/init.d/ocfs2 %{buildroot}/sbin/rcocfs2 +%endif make DESTDIR="%{buildroot}" install cd reflink @@ -236,12 +262,21 @@ python -c "import compileall; compileall.compile_dir('%{buildroot}/%{py_sitedir} %files o2cb %defattr(-,root,root) %doc README.O2CB -/sbin/rco2cb -/sbin/rcocfs2 /sbin/o2cb_ctl /sbin/o2cb -%{_sysconfdir}/init.d/o2cb -%{_sysconfdir}/init.d/ocfs2 + +%if %{systemd_enabled} + /sbin/o2cb.init + /sbin/ocfs2.init + /usr/lib/systemd/system/o2cb.service + /usr/lib/systemd/system/ocfs2.service +%else + /sbin/rco2cb + /sbin/rcocfs2 + %{_sysconfdir}/init.d/o2cb + %{_sysconfdir}/init.d/ocfs2 +%endif + %{_mandir}/man8/o2cb_ctl.8* %{_localstatedir}/adm/fillup-templates/sysconfig.o2cb %{_mandir}/man7/o2cb.7.gz