public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Jan Kiszka' via isar-users" <isar-users@googlegroups.com>
To: Uladzimir Bely <ubely@ilbers.de>,
	"Moessbauer, Felix (T CED OES-DE)" <felix.moessbauer@siemens.com>,
	"isar-users@googlegroups.com" <isar-users@googlegroups.com>
Cc: "Gylstorff, Quirin (T CED OES-DE)" <quirin.gylstorff@siemens.com>
Subject: Re: [PATCH 10/17] meta-isar: deploy-image: Warn if overwriting a non-empty disk
Date: Fri, 19 Jul 2024 07:44:10 +0200	[thread overview]
Message-ID: <1afe40ab-4028-426b-8494-03c8302ecd3f@siemens.com> (raw)
In-Reply-To: <8ee5a7a2efc86e7b733c52fb28ccc3586ebf0132.camel@ilbers.de>

On 19.07.24 07:33, Uladzimir Bely wrote:
> On Wed, 2024-07-03 at 17:55 +0200, 'Jan Kiszka' via isar-users wrote:
>> On 03.07.24 17:53, Moessbauer, Felix (T CED OES-DE) wrote:
>>> On Tue, 2024-07-02 at 15:38 +0200, 'Jan Kiszka' via isar-users
>>> wrote:
>>>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>>>
>>>> Check of the first MB of the target device is only containing
>>>> zero
>>> -------^ typo: if
>>>
>>>> and
>>>> warn otherwise before overwriting potentially valuable data.
>>>> Looking
>>>> at the first MB should cover enough partition table and file
>>>> system
>>>> structures to detect a valid disk.
>>>>
>>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>>> ---
>>>>  .../deploy-image/files/deploy-image-wic.sh                  | 6
>>>> ++++++
>>>>  1 file changed, 6 insertions(+)
>>>>
>>>> diff --git a/meta-isar/recipes-installer/deploy-
>>>> image/files/deploy-
>>>> image-wic.sh b/meta-isar/recipes-installer/deploy-
>>>> image/files/deploy-
>>>> image-wic.sh
>>>> index 09d6cc11..81a006ce 100644
>>>> --- a/meta-isar/recipes-installer/deploy-image/files/deploy-
>>>> image-
>>>> wic.sh
>>>> +++ b/meta-isar/recipes-installer/deploy-image/files/deploy-
>>>> image-
>>>> wic.sh
>>>> @@ -96,6 +96,12 @@ if ! dialog --yes-label Ok --no-label Cancel \
>>>>      exit 0
>>>>  fi
>>>>  
>>>> +if ! cmp /dev/zero "$TARGET_DEVICE" -n 1M && \
>>>> +   ! dialog --defaultno \
>>>> +            --yesno "WARNING: Target device is not empty!
>>>> Continue
>>>
>>> Ok, but I'm sure this will almost always fire.
>>> Even fresh devices are not necessarily zeroed.
>>
>> Flash drives are generally by design. But if you have a concrete
>> proposal how to improve the heuristics, I'm all ears.
>>
>> Jan
>>
> 
> What about simply checking the device for partitions?
> 
> `lsblk -n "$TARGET_DEVICE" -o TYPE | grep part >/dev/null`
> 
> This should fit our needs.

Could still select an unpartitioned device with a valid filesystem.

Jan

-- 
Siemens AG, Technology
Linux Expert Center

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/isar-users/1afe40ab-4028-426b-8494-03c8302ecd3f%40siemens.com.

  reply	other threads:[~2024-07-19  5:44 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-02 13:38 [PATCH 00/17] Reworks, fixes and unattended mode for image installer Jan Kiszka
2024-07-02 13:38 ` [PATCH 01/17] Kconfig: Rework installer image submenu Jan Kiszka
2024-07-02 13:38 ` [PATCH 02/17] installer: Do not show systemd boot menu Jan Kiszka
2024-07-02 13:38 ` [PATCH 03/17] meta-isar: deploy-image: Change reboot logic Jan Kiszka
2025-03-13 13:10   ` Uladzimir Bely
2025-03-14  5:54     ` 'Jan Kiszka' via isar-users
2025-03-14  6:25       ` Uladzimir Bely
2025-03-14 14:25         ` 'Heinisch, Alexander' via isar-users
2025-03-14 15:04           ` Uladzimir Bely
2024-07-02 13:38 ` [PATCH 04/17] meta-isar: deploy-image: Drop umount attempt after installation Jan Kiszka
2024-07-02 13:38 ` [PATCH 05/17] meta-isar: deploy-image: Fix bmap support Jan Kiszka
2024-07-02 13:38 ` [PATCH 06/17] meta-isar: deploy-image: Improve root mountpoint discovery Jan Kiszka
2024-07-02 13:38 ` [PATCH 07/17] meta-isar: deploy-image: Make TARGET_DEVICE a complete path Jan Kiszka
2024-07-02 13:38 ` [PATCH 08/17] meta-isar: deploy-image: Drop pointless --clear options from dialog Jan Kiszka
2024-07-02 13:38 ` [PATCH 09/17] meta-isar: deploy-image: Allow to cancel installation Jan Kiszka
2024-07-02 13:38 ` [PATCH 10/17] meta-isar: deploy-image: Warn if overwriting a non-empty disk Jan Kiszka
2024-07-03 15:53   ` 'MOESSBAUER, Felix' via isar-users
2024-07-03 15:55     ` 'Jan Kiszka' via isar-users
2024-07-19  5:33       ` Uladzimir Bely
2024-07-19  5:44         ` 'Jan Kiszka' via isar-users [this message]
2024-07-02 13:38 ` [PATCH 11/17] meta-isar: deploy-image: Fix and enhance image selection dialog Jan Kiszka
2024-07-02 13:38 ` [PATCH 12/17] meta-isar: deploy-image: Improve target device list dialog Jan Kiszka
2024-07-02 13:38 ` [PATCH 13/17] meta-isar: deploy-image: Polish some dialogs Jan Kiszka
2024-07-02 13:38 ` [PATCH 14/17] meta-isar: deploy-image: Re-indent Jan Kiszka
2024-07-02 13:38 ` [PATCH 15/17] meta-isar: deploy-image: Prepare for auto-installation mode Jan Kiszka
2024-07-02 13:38 ` [PATCH 16/17] meta-isar: deploy-image: Introduce " Jan Kiszka
2024-07-03 15:56   ` 'MOESSBAUER, Felix' via isar-users
2024-07-03 16:08     ` 'Jan Kiszka' via isar-users
2024-07-02 13:38 ` [PATCH 17/17] meta-isar: deploy-image: Polish recipe Jan Kiszka
2024-07-23  7:40 ` [PATCH 00/17] Reworks, fixes and unattended mode for image installer Uladzimir Bely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1afe40ab-4028-426b-8494-03c8302ecd3f@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=felix.moessbauer@siemens.com \
    --cc=jan.kiszka@siemens.com \
    --cc=quirin.gylstorff@siemens.com \
    --cc=ubely@ilbers.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox