Changeset 3935

Show
Ignore:
Timestamp:
03/06/10 20:25:38 (2 years ago)
Author:
tg
Message:

check the filesystem magic before attempting an e2fsck; from
discussion in #FreeWRT on OPN; agreed by sum; he’ll test it too

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/freewrt/package/base-files/Makefile

    r3934 r3935  
    1010PKG_NAME:=              base-files 
    1111PKG_VERSION:=           1.1 
    12 PKG_RELEASE:=           38 
     12PKG_RELEASE:=           39 
    1313WRKDIST=                ${WRKDIR}/base-files 
    1414NO_DISTFILES:=          1 
  • trunk/freewrt/package/base-files/files/etc/hotplug.d/usb/01-mount

    r3934 r3935  
    1313                                        [[ -e $part ]] || continue 
    1414                                        path=/mnt/${dev}_${part##*part} 
    15                                         if [ -x /usr/sbin/e2fsck ]; then 
    16                                                 logger -p syslog.notice -s "Checking filesystem on ${part} ... " 
    17                                                 /usr/sbin/e2fsck -p -v /dev/discs/${dev}/${part} 2>&1 | logger -p syslog.notice -s 
    18                                                 logger -p syslog.notice -s "Filesystem on ${part} checked." 
     15                                        part=/dev/discs/$dev/$path 
     16                                        e2fs=$(dd if=$part bs=1 count=2 skip=1080 | hexdump -e '"%04X"') 
     17                                        if [[ $e2fs != EF53 ]]; then 
     18                                                : # not an ext{,2,3,4} filesystem 
     19                                        elif [[ -x /usr/sbin/e2fsck ]]; then 
     20                                                logger -p syslog.notice -s "Checking filesystem on $part" 
     21                                                /usr/sbin/e2fsck -pv $part 2>&1 | logger -p syslog.notice -s 
     22                                                logger -p syslog.notice -s "Filesystem on $part checked." 
    1923                                        else 
    2024                                                logger -p syslog.warn -s "Not checking filesystem on ${part}, no filesystem checker found."