#!/bin/bash

mount -t tmpfs tmpfs /tmp/
mount -t tmpfs dev /dev/
mount -t proc proc /proc/
mount -t sysfs sysfs /sys/

for ((i=0;i<100;i++)); do
	busybox mdev -s
	device=`blkid -L crashdump`
	sleep 2
	[[ -z "$device" ]] && continue
	mount "$device" /mnt/ || break
	cp /proc/vmcore /mnt/vmcore-`date +%Y-%m-%d-%H.%M.%S`
	umount /mnt/
	break
done

reboot -f
