Add startup confirmation to disk utilities

This commit is contained in:
dido committed 2026-09-27 12:53:24 +03:00
1 parent c777cf115b
commit 33c4229848
5 files changed
+48 -1

No files matched your search

+5
View File
@@ -16,6 +16,8 @@ Usage: sudo ./HDD/repair-hdd.sh DEVICE [zero|null|random]
Overwrites the selected disk, then runs a SMART extended self-test. This
destroys all data on DEVICE. Use only with a directly connected SATA disk;
USB adapters may require adding -d sat to the smartctl calls.
At startup, asks you to confirm that you can keep the computer and drive
powered and connected for the hours this operation may take.
Arguments:
DEVICE Whole-disk block device, for example /dev/sdX
@@ -55,6 +57,9 @@ case "$FILL_MODE" in
;;
esac
common::log "WARNING: This operation may take hours. Do not power off, reboot, or suspend the computer, or disconnect power or the drive."
common::confirm "Can the computer and drive remain powered and connected until this operation finishes?" || exit 0
for required_command in findmnt lsblk readlink swapon mkdir date tee smartctl grep umount dd sync sleep head base64; do
common::require_cmd "$required_command"
done