From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7176574724112121856 X-Received: by 2002:a05:6870:7907:b0:143:ee83:d5ca with SMTP id hg7-20020a056870790700b00143ee83d5camr613996oab.87.1671126530815; Thu, 15 Dec 2022 09:48:50 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6808:1a98:b0:354:b362:347f with SMTP id bm24-20020a0568081a9800b00354b362347fls2882933oib.2.-pod-prod-gmail; Thu, 15 Dec 2022 09:48:50 -0800 (PST) X-Google-Smtp-Source: AA0mqf6d/qv/+tY2CPECJXAb3Dah4seMBRsK3txadSUaQifKeAqn3merq0YYNtOlZCc7eXgXIJ+p X-Received: by 2002:aca:58c4:0:b0:35a:b63:afa3 with SMTP id m187-20020aca58c4000000b0035a0b63afa3mr11272997oib.54.1671126529997; Thu, 15 Dec 2022 09:48:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671126529; cv=none; d=google.com; s=arc-20160816; b=j/A+/pzEXjsRVswL8iodzgpalerApGI9uxBgAM3QtNNdyntilceFgidxyB+Ck5L5bT RQccVwY9JAZDStlELnkH5j+AScUotVv+7lWFriaUTO0RzX4ksWaV7B+Z6liLQwoOWfZG 0WaWXzGcAjwQhooVn1DaTKT4KOZGXbCDjJ5T+dOTKbp8AZja2vEiSAOR6IivxdInViRG TYnniyktSf4ryZC694u3qNMCDFWeyaONmmAIg5gzhSFRxcGMlRa5gr7QCzlkH6oktXJG ptMa4TG5Zj/VwfN6YenJTpUDOru8DXCdzkkBtbEefFXbYla9MB4TyKCVLsM9E9AZ0DvZ FdLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=YNOJtp95lNqltbN80kRuP5XbKUy9p+/IVh87rUFBdu8=; b=Lnva6GpU1IeIGCRQmniPsslCN7LxbLb3FQrfj7O3sx1SZTY+vY8L5PFXQ2erCDAO1H mXkz7a8gFRBsoOHngwnYcrFR//fd1T2GkX33nBsReydAcwYztJXYyvCsI5dov5Vej6G5 T5ztiVCzB24yIkoHXDgBlPxpMVLTPvAaQHWxd4NKG7kqJYG4l4i8rF78yuKR8XVbebby i3fvP5iw22xHb2dZRGt86cYA/TmwOm752iUrlT/ENJoKKLggwMrA3FJpn4lBNFcCryK/ 3idhuFudAWQNvpghLqknx/OTHHErcHuheAKDYo1SBZTtkNy9anEeA2jmotnE/ufhyFV6 qA2Q== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=noYCQqvd; spf=pass (google.com: domain of roberto.foglietta@gmail.com designates 2607:f8b0:4864:20::82f as permitted sender) smtp.mailfrom=roberto.foglietta@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com. [2607:f8b0:4864:20::82f]) by gmr-mx.google.com with ESMTPS id i206-20020acab8d7000000b0035e22a3e8c4si338932oif.0.2022.12.15.09.48.49 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 15 Dec 2022 09:48:49 -0800 (PST) Received-SPF: pass (google.com: domain of roberto.foglietta@gmail.com designates 2607:f8b0:4864:20::82f as permitted sender) client-ip=2607:f8b0:4864:20::82f; Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=noYCQqvd; spf=pass (google.com: domain of roberto.foglietta@gmail.com designates 2607:f8b0:4864:20::82f as permitted sender) smtp.mailfrom=roberto.foglietta@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: by mail-qt1-x82f.google.com with SMTP id s9so139752qtx.6 for ; Thu, 15 Dec 2022 09:48:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=YNOJtp95lNqltbN80kRuP5XbKUy9p+/IVh87rUFBdu8=; b=noYCQqvd1z6XEJoEPrQeNVyPo3pBlWV4mEABZmRllx/2bD3iSADBCovxJgjfwT9gcb JhEm1ytApMEhcKtGINstCGtCdRNGt+7dkphl9c0yiRdvPb7pBWoaL3ojMynTHPUvJf0W D7P2aqcBH0XL60PLnYuPJlCLngpyrCs1Y/L4tIFP3jg1+lcZaGVK7nIpgCzUCnG1mw6r fcQI3ivDGOu21wSMg8dQ6k+lJBRu81FikU2eAvJmQdDhB7uJVH7jv5BZHp02AcA5vwp4 hD1nfLcBcpViqkyEcEdXALdVfrDkT+1RGbwhCyilVrQa4nlCeDS65IorUe3/nQI0Hb9E Rx4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YNOJtp95lNqltbN80kRuP5XbKUy9p+/IVh87rUFBdu8=; b=iJvcNuo38F3tHqh72jpl16DaPJf2rCiAUShRn2DISvhcE6xStH6CQykguyl/8mikwS RY4BbAV/IHckf/15BgVFLv1QXD++CuwdyW+wWbRXz19JkCJaK8scam8XszYJUul0qd0M 65kDOnsTsaO8dErAk5zrmt4u4DZhYLNY1QwcVeTGElYQloygjo6dmebNY78HBhTdWRkq oRlPhO9wN6Q07sFbpFFL62rWnTZ55CgoJ2shLeDFF5wYQ6rK860VLYzMrSgWNWSUD0xn 3+P4S8udc6tFBpZ7p2CYofGi96IzUCQJZ9SYzN7kkC36CN2y5qy6s8msXlL08oJ1LGKC cQuw== X-Gm-Message-State: ANoB5pksfUah0aixVpX00FMxgM6fp3YJDGbUwHM7zROm+g4oKuvfFth6 LIh52KQcHe6iHG3jAbuxXMDjZW8If8wRkAQp0RCIl7Ja8JyD X-Received: by 2002:ac8:4696:0:b0:3a7:e50e:3fec with SMTP id g22-20020ac84696000000b003a7e50e3fecmr14403729qto.590.1671126529442; Thu, 15 Dec 2022 09:48:49 -0800 (PST) MIME-Version: 1.0 References: <20221215142759.26327-1-henning.schild@siemens.com> <20221215142759.26327-3-henning.schild@siemens.com> In-Reply-To: <20221215142759.26327-3-henning.schild@siemens.com> From: "Roberto A. Foglietta" Date: Thu, 15 Dec 2022 18:48:12 +0100 Message-ID: Subject: Re: [PATCH v5 2/6] expand-on-first-boot: support resizing a btrfs To: henning.schild@siemens.com Cc: isar-users@googlegroups.com, Joe MacDonald Content-Type: text/plain; charset="UTF-8" X-TUID: ZTxLCH93yCmX On Thu, 15 Dec 2022 at 15:28, wrote: > +MOUNT_POINT=$(mktemp -d --tmpdir "$(basename "$0").XXXXXXXXXX") Good choice to use the long option --tmpdir but it is still less readable than -p "$TMPDIR" > +if [ ! -d "${MOUNT_POINT}" ]; then > + echo "Cannot create temporary mount point ${MOUNT_POINT}." >&2 > + exit 1 > +fi This is useless because set -e detected the failure also in child shells. Just try these two commands: roberto$ set -e roberto$ test=$(false) The terminal / shell will be closed immediately after pressing ENTER > +mount "${LAST_PART}" "${MOUNT_POINT}" If mktemp fails then also the mount will fail so whatever the shell takes in account or not the subshell errors it is useless explicitly check the mount point existence > + > +ret=0 > +# Determine the filesystem type and perform the appropriate resize function > +FS_TYPE=$(findmnt -fno FSTYPE "${MOUNT_POINT}" ) > +case ${FS_TYPE} in > +ext*) Using ext*) seems legit but what about the introduction of extmyfs? A completely different filesystem from ext[234]? I suggest ext[234]), instead. > + # 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}" > + ;; > +btrfs) > + btrfs filesystem resize max "${MOUNT_POINT}"Using ext*) seems legit but what about the introduction of extmyfs? A completely different filesystem from ext[234]? I suggest ext[234]), instead. > + ;; > +*) > + echo "Unrecognized filesystem type ${FS_TYPE} - no resize performed" > + ret=1 Looking at your other patches this script has been added by default in many templates. So, why consider a failure the execution of something that the user might not even choose to use but just accepted by default? Would it not be better to have a simple warning and nothing else? Moreover, if the failure of this script does not deactivate its service [as I hope] this script will run at every boot without any reason. Adding an exit 0 here will also remove the use of ret variable simplifying the code. > + ;; > +esac > > -resize2fs "${LAST_PART}" > +umount "${MOUNT_POINT}" > +rmdir "${MOUNT_POINT}" > +exit $ret > -- > 2.37.4 > Best regards, R-