From patchwork Sat Jul 28 18:36:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10548039 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 55BD21751 for ; Sat, 28 Jul 2018 18:36:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 448D42AD30 for ; Sat, 28 Jul 2018 18:36:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38F8A2B151; Sat, 28 Jul 2018 18:36:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CFB0E2AD30 for ; Sat, 28 Jul 2018 18:36:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729576AbeG1UEL (ORCPT ); Sat, 28 Jul 2018 16:04:11 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:38442 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729464AbeG1UEL (ORCPT ); Sat, 28 Jul 2018 16:04:11 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w6SIYl72167538; Sat, 28 Jul 2018 18:36:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=iUCx2KlAX8/FDxeOi/Vfkm+Um+Kr76GWHyRGDW1olmw=; b=Kmm4/eZabuA2wR6ZUYOa2ZjI7TYkDo7YUQ/APSCTRnm/XhQbn3PsBiQJ36jVnk5zYlt2 +iFs3eBBsQOV2tAxI5JJzxIVMk6X2/u3sRaGW2PaeuAyR6MG0XYQsiaJkg+N6ARYtGxz bObkgYshFt7HPPpEQguM8Pv9xZ3YkZrJM4hvifHoKkbapvS2kn90ISvIJmf3q63PL/aI g+0Bphy0H20sHsuuvwuEtx5iQ4sdglPLtmcoNgcg6jlr9DWizEE6E+QfJK2hZWfjAVdG VR3cdj2wRK4JT+hFMnwIpwwYw9d1agyC0yscXjdoFeIbmfo96Dxu5kJ/7CnyS/dScla2 qg== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2kgh4prtnj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 28 Jul 2018 18:36:46 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w6SIajHA024446 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 28 Jul 2018 18:36:45 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w6SIaiZh031750; Sat, 28 Jul 2018 18:36:44 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 28 Jul 2018 11:36:44 -0700 Date: Sat, 28 Jul 2018 11:36:36 -0700 From: "Darrick J. Wong" To: Eric Sandeen Cc: xfs , billodo@redhat.com Subject: [PATCH v2] xfs: add debian initramfs hook to package Message-ID: <20180728183636.GS30972@magnolia> References: <20180726215154.GI30972@magnolia> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180726215154.GI30972@magnolia> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8968 signatures=668706 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807280204 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong In Debian bug 904086, the reporter complained that xfs_repair wasn't present in the initramfs, which prevented him from using shutdown -F to force a filesystem fsck after a reboot. Add a hook to put the xfs utilities in the initramfs if xfs is the root filesystem. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen --- v2: ignore comment lines --- debian/local/initramfs.hook | 52 +++++++++++++++++++++++++++++++++++++++++++ debian/rules | 1 + 2 files changed, 53 insertions(+) create mode 100644 debian/local/initramfs.hook -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/debian/local/initramfs.hook b/debian/local/initramfs.hook new file mode 100644 index 00000000..5b24eaec --- /dev/null +++ b/debian/local/initramfs.hook @@ -0,0 +1,52 @@ +#!/bin/sh + +# Put XFS utilities in initramfs if the root fs is XFS. + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +prereqs) + prereqs + exit 0 + ;; +esac + +fstab_files() +{ + echo /etc/fstab + if [ -d /etc/fstab.d ]; then + ls -1 /etc/fstab.d | grep '\.fstab$' | sed -e 's;^;/etc/fstab.d/;' + fi +} + +rootfs_type() { + fstab_files | while read file; do + test ! -f "$file" && continue + + while read MNT_FSNAME MNT_DIR MNT_TYPE MNT_OPTS MNT_FREQ MNT_PASS MNT_JUNK; do + case "$MNT_FSNAME" in + ""|\#*) + continue; + ;; + esac + test "$MNT_DIR" != "/" && continue + echo "$MNT_TYPE" + break; + done < "$file" + done +} + +. /usr/share/initramfs-tools/scripts/functions +. /usr/share/initramfs-tools/hook-functions + +if [ "$(rootfs_type)" = "xfs" ]; then + copy_exec /sbin/xfs_repair + copy_exec /usr/sbin/xfs_db + copy_exec /usr/sbin/xfs_metadump +fi +exit 0 diff --git a/debian/rules b/debian/rules index cb4fa22c..4c50654c 100755 --- a/debian/rules +++ b/debian/rules @@ -77,6 +77,7 @@ binary-arch: checkroot built $(pkgdev) $(MAKE) -C . install-dev $(pkgdi) $(MAKE) -C debian install-d-i $(pkgme) $(MAKE) dist + install -D -m 0755 debian/local/initramfs.hook debian/xfsprogs/usr/share/initramfs-tools/hooks/xfs rmdir debian/xfslibs-dev/usr/share/doc/xfsprogs rm -f debian/xfslibs-dev/lib/libhandle.la rm -fr debian/xfslibs-dev/usr/lib