From patchwork Tue Dec 13 07:17:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Roberto A. Foglietta" X-Patchwork-Id: 2289 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Tue, 13 Dec 2022 08:17:09 +0100 X-Sieve: CMU Sieve 2.4 Received: from mail-vs1-f61.google.com (mail-vs1-f61.google.com [209.85.217.61]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 2BD7H8jS032037 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 08:17:09 +0100 Received: by mail-vs1-f61.google.com with SMTP id h7-20020a676c07000000b003b14cb5cc8fsf3771575vsc.7; Mon, 12 Dec 2022 23:17:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1670915822; cv=pass; d=google.com; s=arc-20160816; b=R+maQWlvTMAWxdWVHA/ziL7+T1K6DRd782RDLzLdsiLiB0dqDbpOMbnFMqPncOP7Tg buXQ48BRIwXsLAZRzXXazC3PS4KQtcYOyaiRFTZjbdIbvVvGaR55UhGGZ2JrJ0V/TtBI S58NTUDnoWYZfTImjrHqZfsrDS4g+Q0wQrBl/67WGZ33ggj5bH4/dPL9wrxNFOeOP8+J 02uY86w/SNw3kQRtrjajbmDn/TZc4j87bJA2LOUX4keseT6sMRn22BOeoDQbMbtOoRFu skv9GbHSyv0GeqeRQF5Uoac5SiDyYZsdtcVyBm1Phy3lXshyFHB+z8Jt79EkB37XrjJv 9mOQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-subscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:list-unsubscribe:cc:to :reply-to:message-id:subject:date:from:sender:dkim-signature; bh=4CsELAOmAQMwIY40HX4cP4ejcfbHvB44d+9DtbZ9ROg=; b=Zv0biAyXwB4+EQXwQ8qXGOh/KScEbIt4FNyZHPdDyWMqVcW6q3VlEi/MRn21MoU2UL oi2n1Y6blNG05iPDILqXPLp+ggMT+fhPwtc7O9AgLEi3vAbRO3bNEj5IvT41/hEODL63 dqvGJKzUyVSebYGflBVsbeojBGfItfWHi5dDsSE+nrOqGqgaejO7SHOhQouTUIhUHbQJ /J/thnnpxTA0V706azTTSt5mYF38WEqFMZFjruDgGw1Alp9rG2Im5WGXFIeCSGfyrw6X smTvgBcssOhz56mpa/lSVjK6lDmZjjTeICrjrVnWM0aaj5yx7JXF+Q8tChCmXa7mppiO ChVA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of bounces+mlvmnk2i9krfha0tj2x-dq2@bounces.elasticemail.net designates 216.169.99.117 as permitted sender) smtp.mailfrom=bounces+mlVMNk2I9KRFHa0TJ2x-dQ2@bounces.elasticemail.net; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=list-subscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:list-unsubscribe:cc:to:reply-to :message-id:subject:date:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=4CsELAOmAQMwIY40HX4cP4ejcfbHvB44d+9DtbZ9ROg=; b=LYrmCWDKG0Ew+/agc0ruikpDocvcN3KBYWpI5F0GtZeHafMAGPLrhmbGnC3WIxsa0b 5WdPv94AxWBG4Qx+1pTH4AnBCtckFnGovs+Pynf52/UdK1n74yF5bXt3b1EYlExDL794 YKkcApEywfUWpHY4eHiTzGlyPosDZ83q9ab4qE1FG+kcb4mz8+3pHCBEFd3yE2Qxr8MT +2kA6j4O89A2HN1m85xoEMNtkafPnAvlMzJbNmVmhWYlJ3+sc8iTrmssFG3o4eUpElI0 V6yNeGGkea8ca0H8KwUBv7uTmu1f4D2JS/l5+x6fzrx1umhmWuBrXuU4ZTp9yE6MBBEF t6ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :list-unsubscribe:cc:to:reply-to:message-id:subject:date:from :x-gm-message-state:sender:from:to:cc:subject:date:message-id :reply-to; bh=4CsELAOmAQMwIY40HX4cP4ejcfbHvB44d+9DtbZ9ROg=; b=wFAdmXYeqvyo/i9lhtQR9yIH8m6jA55OV0+0u7PudMwwnl1gRMn2xtUxZoAhNuvUo+ bhhtF0QwVDYKgMYo/nMQWO/b9Opvuv6qkb2+4og8tODKEtzVv28JqwFOxqXOJ9IMoMaJ YSpQZDJqggwvYaYdJO9cyNnOxkp6sByqCj3M+yDkzHesg40kI/BsMs+19ASn22z37vWo WBQF+AwULma5mqtDvtrVkFAd3H1pEBzmvYsXPaaaiDDl7NEpEy3w6oefXq0A/3j8CNtv RXcpqodt3+ImZp/QE+xufsT95KrVRRBDDdftHnJ4I8cBzRaMhYNB0PQvanVroFgqbxGl 7dxw== Sender: isar-users@googlegroups.com X-Gm-Message-State: ANoB5pmUfgSmMrfjKATwfFhd9ywxnH3ccu73yvn6sfPp9caTFnuFgSdq EyFD6FXUcOz5dFHsXBHJ/VI= X-Google-Smtp-Source: AA0mqf4Ir6VMA2NPooJlCn7Yl+Yys+uuIaUfTzuvwe7buSj6/oChJIyBWzzEOJtMPLGXqbQ4M/QbhA== X-Received: by 2002:a1f:348f:0:b0:3ab:8c38:c4b8 with SMTP id b137-20020a1f348f000000b003ab8c38c4b8mr55456773vka.2.1670915822750; Mon, 12 Dec 2022 23:17:02 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a67:d392:0:b0:3b1:14a5:dc82 with SMTP id b18-20020a67d392000000b003b114a5dc82ls4501696vsj.5.-pod-prod-gmail; Mon, 12 Dec 2022 23:17:02 -0800 (PST) X-Received: by 2002:a67:eec4:0:b0:3aa:1665:5eae with SMTP id o4-20020a67eec4000000b003aa16655eaemr9522833vsp.14.1670915822057; Mon, 12 Dec 2022 23:17:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670915822; cv=none; d=google.com; s=arc-20160816; b=C1mFkcr4puv3VD5PaLlCjVGkqHrAVnnyuXj8qfTGxQ5AHiRpcdKbOKcMLFueSBRnBL bmvwlWtAPJThaUEQcxLTis2ez2uKqMb8HvDMSlk90i387nl2DcEVUHFpPoTGx4dEU51h w5xrbcM/RdUNEScuP/MlUZMumulPxHh8+vxYUy4ozIDqj3wf2U5r2jSTXh+4SFLsDdP9 9CWNOEtX4P6W9BqmOd9vv6V5pxAoR1ys+KyPKhGq/HsMXOcHjeGX2rff6CF4S0+3f8HC Aqce1IY2kIKvG7gZ2j+VIMX1FmtTUNFDyY0vIHxYRVDn/AYR0QDASOjwFg6PvNPHkEWu 5n3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe:cc:to :reply-to:message-id:subject:date:from; bh=n3NU4o5HmyZ3YxsC5UwzrsVHC0OO37u8RufGMBRE87Q=; b=g+BbITFISTH5pvKSRRgQRuNgPioRgnURN/f0Y+A6A4UlZDjm+jO59cqlCwQuGi0q7x Rm4MqshrYakjXD74QafpDbKXZ90ZFnDfKK9hw4PnGW0u3hClhsjAc02eh0Xf7xSJNzO4 48z9GXv8Eh7rp2H1ty3q6s9U1p4vdEbZxJp9SA0kafGMhGLTrwuiUhpw9o2ADIVHiACF hUL3yYZcHcgPfrvwOx3ic4z5MyjiBX+An6I+Aj9bLXtYFVzxtfDgSqWCyeN4SKnaA+Ln ahUZv7nyY0quWDZtK6bg7tkjbSoFNSYT6c+DYFtjJwwWJ6FoQaBRwuKGQB8Tx6hE6X2Q yg9g== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of bounces+mlvmnk2i9krfha0tj2x-dq2@bounces.elasticemail.net designates 216.169.99.117 as permitted sender) smtp.mailfrom=bounces+mlVMNk2I9KRFHa0TJ2x-dQ2@bounces.elasticemail.net; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from pn117.mxout.mta2.net (pn117.mxout.mta2.net. [216.169.99.117]) by gmr-mx.google.com with ESMTPS id t8-20020a67ad08000000b003b06d9dca0bsi769951vsl.1.2022.12.12.23.17.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Dec 2022 23:17:01 -0800 (PST) Received-SPF: pass (google.com: domain of bounces+mlvmnk2i9krfha0tj2x-dq2@bounces.elasticemail.net designates 216.169.99.117 as permitted sender) client-ip=216.169.99.117; From: roberto.foglietta@gmail.com Date: Tue, 13 Dec 2022 07:17:00 +0000 Subject: [PATCH v3] In expand last partition script btrfs support added Message-Id: <4uin7kd4pqus.mlVMNk2I9KRFHa0TJ2x-dQ2@16F0H.trk.elasticemail.com> Reply-To: roberto.foglietta@gmail.com To: isar-users@googlegroups.com Cc: roberto.foglietta@gmail.com List-Unsubscribe: , X-Msg-EID: mlVMNk2I9KRFHa0TJ2x-dQ2 MIME-Version: 1.0 X-Original-Sender: roberto.foglietta@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of bounces+mlvmnk2i9krfha0tj2x-dq2@bounces.elasticemail.net designates 216.169.99.117 as permitted sender) smtp.mailfrom=bounces+mlVMNk2I9KRFHa0TJ2x-dQ2@bounces.elasticemail.net; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Precedence: list Mailing-list: list isar-users@googlegroups.com; contact isar-users+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: isar-users@googlegroups.com X-Google-Group-Id: 914930254986 List-Post: , List-Help: , List-Archive: , X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= From: "Roberto A. Foglietta" Improvement, expand-on-first-boot: support for btrfs added v2: the mount point for btrfs filesystem to resizes is under /dev/shm by default but a variable defined in the running enviroment can change the temporary directory path. The /dev/shm has been choosen because in some system /tmp can be on a RO root filesystem and /tmp not yet mounted with tmpfs. This requires the system has /dev/shm configured into the kernel. v3: the previous version was using a bashism but the shebang is /bin/sh this means that the script will fail in customised system in which /bin/sh do not link to bash or bash in even not available. Signed-off-by: Roberto A. Foglietta --- .../expand-on-first-boot_1.2.bb | 2 +- .../files/expand-last-partition.sh | 38 +++++++------------ 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.2.bb b/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.2.bb index 0996000..fe7b72b 100644 --- a/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.2.bb +++ b/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.2.bb @@ -10,7 +10,7 @@ inherit dpkg-raw DESCRIPTION = "This service grows the last partition to the full medium during first boot" MAINTAINER = "isar-users " -DEBIAN_DEPENDS = "systemd, sed, grep, coreutils, mount, e2fsprogs, fdisk (>=2.29.2-3) | util-linux (<2.29.2-3), util-linux" +DEBIAN_DEPENDS = "systemd, sed, grep, coreutils, mount, e2fsprogs, fdisk (>=2.29.2-3) | util-linux (<2.29.2-3), util-linux, btrfs-progs" SRC_URI = " \ file://expand-on-first-boot.service \ diff --git a/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh b/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh index 4d55645..038124e 100755 --- a/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh +++ b/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh @@ -59,29 +59,19 @@ sfdisk -d "${BOOT_DEV}" 2>/dev/null | \ # Inform the kernel about the partitioning change partx -u "${LAST_PART}" -# this is for debian stretch or systemd < 236 -if [ ! -x /lib/systemd/systemd-growfs ]; then - # Do not fail resize2fs if no mtab entry is found, e.g., - # when using systemd mount units. - export EXT2FS_NO_MTAB_OK=1 +# Do not fail resize2fs if no mtab entry is found, e.g., +# when using systemd mount units. +export EXT2FS_NO_MTAB_OK=1 - resize2fs "${LAST_PART}" - exit 0 -fi - -if grep -q x-systemd.growfs /etc/fstab; then - echo "Found x-systemd.growfs option in /etc/fstab, won't call it explicitly." >&2 - exit 0 +if [ -n "$BOOT_DEV_TMPDIR" ]; then + tmp=$BOOT_DEV_TMPDIR fi - -# mount $LAST_PART out of tree, so we won't conflict with other mounts -MOUNT_POINT=$(mktemp -d -p /mnt "$(basename "$0").XXXXXXXXXX") -if [ ! -d "${MOUNT_POINT}" ]; then - echo "Cannot create temporary mount point ${MOUNT_POINT}." >&2 - exit 1 -fi - -mount "${LAST_PART}" "${MOUNT_POINT}" -/lib/systemd/systemd-growfs "${MOUNT_POINT}" -umount "${MOUNT_POINT}" -rmdir "${MOUNT_POINT}" +case $(lsblk -fno FSTYPE "${LAST_PART}") in + ext4) resize2fs "${LAST_PART}" + ;; + btrfs) mkdir -p $tmp/btrfs + mount "${LAST_PART}" $tmp/btrfs + btrfs filesystem resize max $tmp/btrfs + umount $tmp/btrfs && rmdir $tmp/btrfs + ;; +esac