Package: bcache-tools Version: 1.0.8-2 Tags: patch Please find attached bc-debdiff. It's basically smoser's proposed patch but with a proper systemd service instead of dropping scripts in places intended for local use only. Also added a 1-second delay before and after suspend because my laptop still seemed to have issues with suspend which stopped after I added the delays.
diff -Nru bcache-tools-1.0.8/debian/bcache-tools.dirs bcache-tools-1.0.8/debian/bcache-tools.dirs --- bcache-tools-1.0.8/debian/bcache-tools.dirs 2015-06-10 03:18:50.000000000 -1000 +++ bcache-tools-1.0.8/debian/bcache-tools.dirs 2018-10-13 19:38:53.000000000 -1000 @@ -1,4 +1,6 @@ usr/sbin/ lib/udev/rules.d/ +lib/systemd/system/ usr/share/man/man8/ usr/share/initramfs-tools/hooks/ + diff -Nru bcache-tools-1.0.8/debian/changelog bcache-tools-1.0.8/debian/changelog --- bcache-tools-1.0.8/debian/changelog 2015-06-26 04:25:47.000000000 -1000 +++ bcache-tools-1.0.8/debian/changelog 2018-10-15 12:02:41.000000000 -1000 @@ -1,3 +1,16 @@ +bcache-tools (1.0.8-2vppa3) UNRELEASED; urgency=medium + + * debian/patches/0003-Fix-suspend-systemd.patch: Handle suspend/resume + in systemd using recommended interface. + Based on smoser's proposed fix but using a proper service instead of + dropping scripts in places intended for local use. + (Debian bug #823860) + * debian/rules: Enable systemd service for suspend/resume. + * debian/control: Add dh-systemd to Build-Depends. + * debian/bcache-tools.dirs: Add /lib/systemd/system/ + + -- nbpwrsav <[email protected]> Mon, 15 Oct 2018 12:02:41 -1000 + bcache-tools (1.0.8-2) unstable; urgency=medium * Only run update-initramfs if installed. Fix dracut. (Closes: #788442) diff -Nru bcache-tools-1.0.8/debian/control bcache-tools-1.0.8/debian/control --- bcache-tools-1.0.8/debian/control 2015-06-10 03:18:50.000000000 -1000 +++ bcache-tools-1.0.8/debian/control 2018-10-15 12:02:41.000000000 -1000 @@ -4,7 +4,7 @@ Section: utils Priority: optional Standards-Version: 3.9.5 -Build-Depends: debhelper (>= 9), pkg-config, uuid-dev, libblkid-dev +Build-Depends: debhelper (>= 9), dh-systemd, pkg-config, uuid-dev, libblkid-dev Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/bcache-tools.git Vcs-Git: git://anonscm.debian.org/collab-maint/bcache-tools.git Homepage: http://bcache.evilpiepirate.org/ diff -Nru bcache-tools-1.0.8/debian/patches/0003-Fix-suspend-systemd.patch bcache-tools-1.0.8/debian/patches/0003-Fix-suspend-systemd.patch --- bcache-tools-1.0.8/debian/patches/0003-Fix-suspend-systemd.patch 1969-12-31 14:00:00.000000000 -1000 +++ bcache-tools-1.0.8/debian/patches/0003-Fix-suspend-systemd.patch 2018-10-11 17:58:41.000000000 -1000 @@ -0,0 +1,125 @@ +## Description: add some description +## Origin/Author: add some origin or author +## Bug: bug URL +Index: bcache-tools-1.0.8/Makefile +=================================================================== +--- bcache-tools-1.0.8.orig/Makefile ++++ bcache-tools-1.0.8/Makefile +@@ -2,6 +2,7 @@ + PREFIX=/usr + UDEVLIBDIR=/lib/udev + DRACUTLIBDIR=/lib/dracut ++SYSDDIR=/lib/systemd/system + INSTALL=install + CFLAGS+=-O2 -Wall -g + +@@ -9,12 +10,16 @@ all: make-bcache probe-bcache bcache-sup + + install: make-bcache probe-bcache bcache-super-show + $(INSTALL) -m0755 make-bcache bcache-super-show $(DESTDIR)${PREFIX}/sbin/ ++ $(INSTALL) -m0755 bcache-suspend.sh $(DESTDIR)${PREFIX}/sbin/bcache-suspend.sh + $(INSTALL) -m0755 probe-bcache bcache-register $(DESTDIR)$(UDEVLIBDIR)/ + $(INSTALL) -m0644 69-bcache.rules $(DESTDIR)$(UDEVLIBDIR)/rules.d/ + $(INSTALL) -m0644 -- *.8 $(DESTDIR)${PREFIX}/share/man/man8/ + $(INSTALL) -D -m0755 initramfs/hook $(DESTDIR)/usr/share/initramfs-tools/hooks/bcache + $(INSTALL) -D -m0755 initcpio/install $(DESTDIR)/usr/lib/initcpio/install/bcache + $(INSTALL) -D -m0755 dracut/module-setup.sh $(DESTDIR)$(DRACUTLIBDIR)/modules.d/90bcache/module-setup.sh ++ifneq ($(BCACHE_NO_SYSTEMD),1) ++ $(INSTALL) -D -m0644 bcache-suspend.service $(DESTDIR)$(SYSDDIR)/bcache-suspend.service ++endif + # $(INSTALL) -m0755 bcache-test $(DESTDIR)${PREFIX}/sbin/ + + clean: +Index: bcache-tools-1.0.8/bcache-suspend.service +=================================================================== +--- /dev/null ++++ bcache-tools-1.0.8/bcache-suspend.service +@@ -0,0 +1,17 @@ ++# bcache - systemd suspend/resume service ++# Handle suspend/resume (fixes Debian bug 823860 and Ubuntu bug 1515780) ++# https://bugs.launchpad.net/debian/+source/bcache-tools/+bug/1515780 ++ ++[Unit] ++Description=bcache suspend/resume ++Before=sleep.target ++StopWhenUnneeded=yes ++ ++[Service] ++Type=oneshot ++RemainAfterExit=yes ++ExecStart=/usr/sbin/bcache-suspend.sh suspend ++ExecStop=/usr/sbin/bcache-suspend.sh resume ++ ++[Install] ++WantedBy=sleep.target +Index: bcache-tools-1.0.8/bcache-suspend.sh +=================================================================== +--- /dev/null ++++ bcache-tools-1.0.8/bcache-suspend.sh +@@ -0,0 +1,66 @@ ++#!/bin/sh ++# /usr/sbin/bcache-suspend.sh ++# Handle suspend/resume (fixes Debian bug 823860 and Ubuntu bug 1515780) ++# https://bugs.launchpad.net/debian/+source/bcache-tools/+bug/1515780 ++ ++OP="$1" ++def_mode="writethrough" ++state_d="/run/bcache-suspend" ++state_f="$state_d/restore-modes" ++LOG_F="$state_d/log" ++ ++warn() { ++ set -- "WARN:" "$@" ++ echo "$@"; ++ echo "$@" >>"$LOG_F" ++ #echo "$@" >/dev/console || : ++} ++msg() { ++ set -- "[${0##*/}]" "$@"; ++ echo "$@" ++ echo "$@" >>"$LOG_F" ++} ++ ++get_cache_mode() { ++ local n="${1#*[}" ++ n="${n%]*}" ++ [ -n "$n" -a "${n#* }" = "$n" -a "$n" != "$1" ] || return ++ _RET="$n" ++} ++ ++[ -d "$state_d" ] || mkdir -p "$state_d" || ++ warn "bad news no state dir $state_d" ++ ++msg "start OP=$OP" ++if [ "$OP" = "suspend" ]; then ++ : >> "$LOG_F" ++ : > "$state_f" ++ for modefile in /sys/block/bcache*/bcache/cache_mode; do ++ [ -f "$modefile" ] || continue ++ if read line <"$modefile" && get_cache_mode "$line"; then ++ mode="$_RET" ++ else ++ warn "failed read, assuming $def_mode for $modefile" ++ mode=$def_mode ++ fi ++ if echo "none" > "$modefile"; then ++ echo "$modefile $mode" >> "$state_f" || ++ warn "failed writing $modefile $mode to $state_f" ++ msg "set $modefile to none" ++ else ++ warn "failed write none to $modefile" ++ fi ++ done ++ sleep 1 ++elif [ "$1" = "resume" ]; then ++ sleep 1 ++ if [ -e "$state_f" ]; then ++ while read modefile mode; do ++ if echo "$mode" > "$modefile"; then ++ msg "restored $mode for $modefile" ++ else ++ warn "failed restoring $modefile to $mode" ++ fi ++ done < "$state_f" ++ fi ++fi diff -Nru bcache-tools-1.0.8/debian/patches/series bcache-tools-1.0.8/debian/patches/series --- bcache-tools-1.0.8/debian/patches/series 2015-06-10 03:18:50.000000000 -1000 +++ bcache-tools-1.0.8/debian/patches/series 2018-10-11 17:57:24.000000000 -1000 @@ -1,2 +1,3 @@ 0001-Clean-should-remove-bcache-register.patch 0002-Don-t-inline-crc64-for-gcc-5-compatability.patch +0003-Fix-suspend-systemd.patch diff -Nru bcache-tools-1.0.8/debian/rules bcache-tools-1.0.8/debian/rules --- bcache-tools-1.0.8/debian/rules 2015-06-26 04:25:47.000000000 -1000 +++ bcache-tools-1.0.8/debian/rules 2018-10-13 19:42:01.000000000 -1000 @@ -1,7 +1,12 @@ #!/usr/bin/make -f %: - dh $@ + dh $@ --with systemd + +override_dh_systemd_enable: + dh_systemd_enable bcache-suspend.service + +override_dh_systemd_start: + echo "Not running dh_systemd_start" override_dh_auto_install: dh_auto_install -- DRACUTLIBDIR=/usr/lib/dracut -
signature.asc
Description: OpenPGP digital signature

