V2 of this patch uses dh_installdocs, rather than install -D, to put the contributed hook in /usr/share/doc.
Signed-off-by: Nicholas D Steeves <nstee...@gmail.com>
diff -Nur btrfs-progs-4.5.2.orig/debian/local/btrfs-convert.hook btrfs-progs-4.5.2/debian/local/btrfs-convert.hook --- btrfs-progs-4.5.2.orig/debian/local/btrfs-convert.hook 1969-12-31 19:00:00.000000000 -0500 +++ btrfs-progs-4.5.2/debian/local/btrfs-convert.hook 2016-05-23 10:37:31.000000000 -0400 @@ -0,0 +1,8 @@ +#!/bin/sh + +. /usr/share/initramfs-tools/hook-functions + +if command -v /bin/btrfs-convert >/dev/null 2>&1; then + copy_exec /bin/btrfs-convert bin/btrfs-convert + copy_exec /bin/btrfs-convert.real bin/btrfs-convert.real +fi diff -Nur btrfs-progs-4.5.2.orig/debian/local/btrfs-convert.wrapper btrfs-progs-4.5.2/debian/local/btrfs-convert.wrapper --- btrfs-progs-4.5.2.orig/debian/local/btrfs-convert.wrapper 1969-12-31 19:00:00.000000000 -0500 +++ btrfs-progs-4.5.2/debian/local/btrfs-convert.wrapper 2016-05-23 10:37:31.000000000 -0400 @@ -0,0 +1,35 @@ +#!/bin/sh + +cat << !EOF! +******** WARNING ******** +Btrfs-convert is known to fail. An upstream rewrite of the +utility is currently in progress. At this point in time, +btrfs-convert is provided for experimental purposes only. + +Please do not convert filesystems filled with data you value. +Expect that you will need to restore from backup. Beware, +the dataloss may not be immediately apparent, and may take +some time to manifest. + +If you choose to experiment with btrfs-convert, please do so +with the willingness to work with linux-bt...@vger.kernel.org + +!EOF! +echo -n 'Proceed (Yes/No)?: ' + +while true; do + read -r choice + case "$choice" in + Yes ) + exec /bin/btrfs-convert.real "$@" + exit $? + ;; + no | n | No | NO ) + echo "Thank you for making the safe choice" + exit 0 + ;; + * ) + echo -n "Please answer Yes or No: " + ;; + esac +done diff -Nur btrfs-progs-4.5.2.orig/debian/rules btrfs-progs-4.5.2/debian/rules --- btrfs-progs-4.5.2.orig/debian/rules 2016-05-10 05:15:55.000000000 -0400 +++ btrfs-progs-4.5.2/debian/rules 2016-05-23 12:21:40.000000000 -0400 @@ -28,8 +28,17 @@ install -D -m 0755 debian/local/btrfs.hook debian/btrfs-progs/usr/share/initramfs-tools/hooks/btrfs install -D -m 0755 debian/local/btrfs.local-premount debian/btrfs-progs/usr/share/initramfs-tools/scripts/local-premount/btrfs +# Divert btrfs-convert to btrfs-convert.real and use a wrapper script to +# notify use of btrfs-convert is currently dangerous + mv debian/btrfs-progs/bin/btrfs-convert debian/btrfs-progs/bin/btrfs-convert.real + install -D -m 0755 debian/local/btrfs-convert.wrapper debian/btrfs-progs/bin/btrfs-convert + # Needs autopkgtest override_dh_auto_test: override_dh_strip: dh_strip --dbg-package=btrfs-progs-dbg + +override_dh_installdocs: + dh_installdocs debian/local/btrfs-convert.hook + dh_installdocs