Scripts: Add erase-disk.sh

This commit is contained in:
the_4n0nym0u53 2022-02-24 13:07:09 +01:00
parent 7e8a59ae9c
commit 332473358f
No known key found for this signature in database
GPG key ID: 35EE09F5481049BB
3 changed files with 21 additions and 0 deletions

View file

@ -24,6 +24,7 @@ sleep 0.4
echo "Making scripts executable..." echo "Making scripts executable..."
chmod +x scripts/.local/bin/clear-clipboard.sh chmod +x scripts/.local/bin/clear-clipboard.sh
chmod +x scripts/.local/bin/erase-disk.sh
chmod +x scripts/.local/bin/update.sh chmod +x scripts/.local/bin/update.sh
chmod +x sway/.config/sway/autostart.sh chmod +x sway/.config/sway/autostart.sh
chmod +x waybar/.config/waybar/ivpn-reconnect.sh chmod +x waybar/.config/waybar/ivpn-reconnect.sh

View file

@ -24,6 +24,7 @@ sleep 0.4
echo "Making scripts executable..." echo "Making scripts executable..."
chmod +x scripts/.local/bin/clear-clipboard.sh chmod +x scripts/.local/bin/clear-clipboard.sh
chmod +x scripts/.local/bin/erase-disk.sh
chmod +x scripts/.local/bin/update.sh chmod +x scripts/.local/bin/update.sh
sleep 0.5 sleep 0.5

View file

@ -0,0 +1,19 @@
#!/bin/dash
# USAGE: erase-disk.sh <passes> <device>
# Must be run as root
echo "# Securely erasing the disk device $2"
i=1
while [ $i -le $1 ]; do
[ $i -eq 1 ] && if="/dev/urandom" || if="/dev/zero"
echo "\n- Begin pass $i with $if"
dd if="$if" of="$2" status="progress"
echo "- Syncing I/O"
sync
i=$(( i + 1 ))
done