diff --git a/CHANGELOG b/CHANGELOG index beb501b9c..54c1c4a59 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,7 @@ On the road to 2024.08: --- Environment: - updated and unified usage information in all scripts +- added clean-blockdevice script --- Highlights 2024.07: - kernel 6.10.x diff --git a/usr/bin/archboot-clean-blockdevice.sh b/usr/bin/archboot-clean-blockdevice.sh new file mode 100755 index 000000000..889c04c5c --- /dev/null +++ b/usr/bin/archboot-clean-blockdevice.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-3.0-or-later +# archboot-restore-usbstick.sh - restore usbstick to FAT32 +# by Tobias Powalowski +. /usr/lib/archboot/common.sh +_usage() +{ + echo -e "\e[1m\e[36mARCHBOOT\e[m \e[1m- Clean blockdevice\e[m" + echo -e "\e[1m----------------------------\e[m" + echo -e "This script removes all filesystem signatures" + echo -e "and partitiontable from the device." + echo -e "\e[1m\e[91mWARNING: ALL DATA WILL BE LOST ON THE DEVICE! \e[m" + echo "" + echo -e "Usage: \e[1m${_BASENAME} \e[m" + exit 0 +} +################################################## +[[ -z "${1}" ]] && _usage "$@" +### check for root +if ! [[ ${UID} -eq 0 ]]; then + echo "ERROR: Please run as root user!" + exit 1 +fi +echo -e "\e[1mCleaning blockdevice ${1}...\e[m" +echo -e "\e[91mWARNING: 10 seconds for hitting CTRL+C to stop the process on ${1} now! \e[m" +sleep 10 +echo -e "\e[1mSTEP 1/2:\e[m Cleaning filesystem signatures..." +wipefs -f -a "${1}" +echo -e "\e[1mSTEP 2/2:\e[m Cleaning partition table..." +dd if=/dev/zero of="${1}" bs=1M count=10 +echo -e "\e[1mFinished.\e[m" diff --git a/usr/bin/archboot-testsuite.sh b/usr/bin/archboot-testsuite.sh index 438c8c933..c4edda554 100755 --- a/usr/bin/archboot-testsuite.sh +++ b/usr/bin/archboot-testsuite.sh @@ -157,7 +157,7 @@ if archboot-hwsim.sh test &>"${_LOG}"; then iwctl --passphrase=12345678 station wlan1 connect test || echo "Wi-Fi connect error" >> iwctl-error.log iwctl station wlan1 disconnect || echo "Wi-Fi iwctl disconnect error" >> iwctl-error.log else - echo "Hwsim failed." >> iwctl-error.log + echo "Hwsim setup failed." >> iwctl-error.log fi _result iwctl-error.log echo -e "Starting none tracked files in \e[1m10\e[m seconds... \e[1;92mCTRL-C\e[m to stop now." diff --git a/usr/lib/archboot/cpio/hooks/installer b/usr/lib/archboot/cpio/hooks/installer index 9f9d0f7c7..249d375a9 100644 --- a/usr/lib/archboot/cpio/hooks/installer +++ b/usr/lib/archboot/cpio/hooks/installer @@ -15,6 +15,7 @@ _run () _file_rename /usr/bin/archboot-copy-mountpoint.sh /usr/bin/copy-mountpoint.sh _file_rename /usr/bin/archboot-rsync-backup.sh /usr/bin/rsync-backup.sh _file_rename /usr/bin/archboot-restore-usbstick.sh /usr/bin/restore-usbstick.sh + _file_rename /usr/bin/archboot-clean-blockdevice.sh /usr/bin/clean-blockdevice _file_rename /usr/bin/archboot-testsuite.sh /usr/bin/testsuite _full_dir /usr/lib/archboot/installer _file /etc/archboot/defaults diff --git a/usr/lib/archboot/update/manage.sh b/usr/lib/archboot/update/manage.sh index 8028fb4c9..ce3a85933 100644 --- a/usr/lib/archboot/update/manage.sh +++ b/usr/lib/archboot/update/manage.sh @@ -151,7 +151,7 @@ _download_latest_task() { ${_DLPROG} -o "${_ETC}/defaults" "${_SOURCE}${_ETC}/defaults?inline=false" # helper binaries # main binaries - _SCRIPTS="quickinst setup clock launcher localize network pacsetup update testsuite" + _SCRIPTS="quickinst setup clock clean-blockdevice launcher localize network pacsetup update testsuite" for i in ${_SCRIPTS}; do [[ -e "${_BIN}/${i}" ]] && ${_DLPROG} -o "${_BIN}/${i}" "${_SOURCE}${_BIN}/archboot-${i}.sh?inline=false" done