| OPT=$(getopt -n "$0" -o er -l i-really-mean-it,erase-backups -- "$@") |
| -r|--i-really-mean-it ) ireallymeanit=1 ;; |
| -e|--erase-backups ) erasebackups=1 ;; |
| * ) echo "***Illegal option: $1" >&2; exit 1 ;; |
| if [ $ireallymeanit -eq 0 ]; then |
| echo "THIS PROGRAM WILL WIPE ALL DATA IN THE FLASH PARTITIONS!" |
| echo -n "Are you sure (y/n)? " |
| [ "$yesno" = "y" ] || exit 1 |
| # convert 'mtdxx:' to 'xx' |
| [ $d = $1 ] && echo "${e#mtd}" |
| leds 0 15 0 15 0 15 # noisy leds as we wipe things |
| # try to umount what we can |
| mtd_no=$(check_mtd '"config"') |
| echo "formating '$device' for jffs2 from factory reset cmd" |
| flash_erase --jffs $device 0 0 |
| echo "Rebooting in 10 seconds..." |