You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
627 B
23 lines
627 B
#!/bin/bash
|
|
|
|
false
|
|
while [ $? -ne 0 ]; do sudo true; done
|
|
|
|
SEC=false
|
|
|
|
for ARG in "$@"; do
|
|
case "${ARG}" in
|
|
"--secure") SEC=true ;;
|
|
*) [[ -b "${ARG}" ]] && DVC+=("${ARG}") || ( echo "${ARG} is not a block device"; exit 1 ) ;;
|
|
esac
|
|
done
|
|
|
|
echo -n "Filling ${DVC[@]} with "
|
|
${SEC} && echo "random data" || echo "zeros"
|
|
|
|
for DEV in "${DVC[@]}"; do
|
|
echo "${DEV}:"
|
|
${SEC} && openssl enc -aes-256-ctr -pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" -nosalt </dev/zero | sudo dd of=${DEV} bs=4M status=progress
|
|
${SEC} || sudo dd if=/dev/zero of=${DEV} bs=4M status=progress
|
|
done
|