12345678910111213141516171819202122232425262728293031 |
- #! /usr/bin/env sh
-
- if [ $# -ne 1 ]
- then
- echo "Usage: $0 sdx" >&2
- exit 64
- fi
-
- disk="/dev/$1"
- partition=2
-
- if [ ! -b "${disk}" ]
- then
- echo "${disk} does not exists or is not a valid device" >&2
- exit 1
- fi
-
- dir=$(mktemp -d)
-
- echo "Mounting partition..."
- mount "${disk}${partition}" "${dir}" || {
- echo "Failed to mount partition" >&2
- exit 2
- }
-
- echo "Removing files..."
- rm ${dir}/* -rf
-
- echo "Unmounting partition..."
- umount "${dir}"
|