Text only
01 Apr 2010
 
 
Tools: wrap/unwrap  
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh
first() {
echo "$1"
}
mountpoint_device() {
grep "$1" /etc/fstab | awk '{print $1}'
}
check_repair_fs() {
DEVICE="$1"
MOUNTPOINT="$2"
NAME="$3"
if ! [ -e "$DEVICE" ]; then
return 0
fi
mount -o remount,ro "$DEVICE"
fsck.vfat -y "$DEVICE"
if [ $? -le 3 ]; then
mount -o remount,rw "$DEVICE"
else
return $?
fi
}
# FIXME: a bit more flexible
if ! check_repair_fs $(first /dev/mmcblk*) /media/sd "SD card"; then
emessage "Filesystem on SD card is damaged. Please reformat or repair it."
fi
if ! check_repair_fs $(mountpoint_device /mnt/storage) /mnt/storage "Internal storage"; then
emessage "Internal storage filesystem is damaged. Please attach device to computer and reformat or repair it."&
usbwatcher&
while true; do sleep 10000; done
fi