mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-19 11:30:37 +02:00
add clean-blockdevice script
This commit is contained in:
parent
6420f280e1
commit
465bd8e38a
5 changed files with 35 additions and 2 deletions
|
@ -2,6 +2,7 @@ On the road to 2024.08:
|
||||||
---
|
---
|
||||||
Environment:
|
Environment:
|
||||||
- updated and unified usage information in all scripts
|
- updated and unified usage information in all scripts
|
||||||
|
- added clean-blockdevice script
|
||||||
---
|
---
|
||||||
Highlights 2024.07:
|
Highlights 2024.07:
|
||||||
- kernel 6.10.x
|
- kernel 6.10.x
|
||||||
|
|
31
usr/bin/archboot-clean-blockdevice.sh
Executable file
31
usr/bin/archboot-clean-blockdevice.sh
Executable file
|
@ -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 <tpowa@archlinux.org>
|
||||||
|
. /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} <device>\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"
|
|
@ -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 --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
|
iwctl station wlan1 disconnect || echo "Wi-Fi iwctl disconnect error" >> iwctl-error.log
|
||||||
else
|
else
|
||||||
echo "Hwsim failed." >> iwctl-error.log
|
echo "Hwsim setup failed." >> iwctl-error.log
|
||||||
fi
|
fi
|
||||||
_result iwctl-error.log
|
_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."
|
echo -e "Starting none tracked files in \e[1m10\e[m seconds... \e[1;92mCTRL-C\e[m to stop now."
|
||||||
|
|
|
@ -15,6 +15,7 @@ _run ()
|
||||||
_file_rename /usr/bin/archboot-copy-mountpoint.sh /usr/bin/copy-mountpoint.sh
|
_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-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-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
|
_file_rename /usr/bin/archboot-testsuite.sh /usr/bin/testsuite
|
||||||
_full_dir /usr/lib/archboot/installer
|
_full_dir /usr/lib/archboot/installer
|
||||||
_file /etc/archboot/defaults
|
_file /etc/archboot/defaults
|
||||||
|
|
|
@ -151,7 +151,7 @@ _download_latest_task() {
|
||||||
${_DLPROG} -o "${_ETC}/defaults" "${_SOURCE}${_ETC}/defaults?inline=false"
|
${_DLPROG} -o "${_ETC}/defaults" "${_SOURCE}${_ETC}/defaults?inline=false"
|
||||||
# helper binaries
|
# helper binaries
|
||||||
# main 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
|
for i in ${_SCRIPTS}; do
|
||||||
[[ -e "${_BIN}/${i}" ]] && ${_DLPROG} -o "${_BIN}/${i}" "${_SOURCE}${_BIN}/archboot-${i}.sh?inline=false"
|
[[ -e "${_BIN}/${i}" ]] && ${_DLPROG} -o "${_BIN}/${i}" "${_SOURCE}${_BIN}/archboot-${i}.sh?inline=false"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue