From patchwork Thu Jul 26 21:51:54 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: 10546485 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 17F251805 for ; Thu, 26 Jul 2018 21:52:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 143592B621 for ; Thu, 26 Jul 2018 21:52:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1239C2B891; Thu, 26 Jul 2018 21:52:01 +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 A55292B877 for ; Thu, 26 Jul 2018 21:52:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730533AbeGZXKn (ORCPT ); Thu, 26 Jul 2018 19:10:43 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:40280 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730441AbeGZXKn (ORCPT ); Thu, 26 Jul 2018 19:10:43 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w6QLiKHY053874; Thu, 26 Jul 2018 21:51:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2018-07-02; bh=928eKLTRVzU5ONMyEf8rReRkLL84ftd4BWbn608ClJI=; b=ujc7UcX9ABXCx1z76IBwBfhx9TKTWGuT5XFO2eHtp9CK2eZu7G4CiqGFkghMNYI0L+k7 1uKtgfDDG8p9cRk9vWRAjslz5W5T+eui3hBh2pqN7JtebNy4PKuakkX4gfJbRDa8mkKd IJxXYrbUwnB1VwBdWEThqG1pg9FqL87m2oBhcmk46RvQ8PpAC/0z8rusTHOZX0NhilGm O39D5hlMH1IeMc3tIGyjZVzMSV9K0NX81vJpByZQFabo+kiBr5Z/kM9UtMEe89SbhWcr Fs+aglnwOKC6cCTX99/wEUMMBDJCQcZ3TNY5+p5b/RNvp2xIomb8H7XFqp0/vMVCLNav 2g== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2120.oracle.com with ESMTP id 2kbvsp4wp5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Jul 2018 21:51:56 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w6QLpt3G001482 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Jul 2018 21:51:55 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w6QLptkw014388; Thu, 26 Jul 2018 21:51:55 GMT Received: from localhost (/10.159.237.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 26 Jul 2018 14:51:55 -0700 Date: Thu, 26 Jul 2018 14:51:54 -0700 From: "Darrick J. Wong" To: Eric Sandeen Cc: xfs Subject: [PATCH] xfs: add debian initramfs hook to package Message-ID: <20180726215154.GI30972@magnolia> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8966 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-1807260220 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: Bill O'Donnell --- debian/local/initramfs.hook | 47 +++++++++++++++++++++++++++++++++++++++++++ debian/rules | 1 + 2 files changed, 48 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..20df5d69 --- /dev/null +++ b/debian/local/initramfs.hook @@ -0,0 +1,47 @@ +#!/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 + 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