[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#249755: doesn't detect ext2 revision 0 file system



On Fri, Jan 13, 2006 at 12:12:17PM +0000, Martin Michlmayr wrote:
> 
> Anton, do you have a more elegant way or is it okay to apply the patch
> I proposed?

I think it is better to move the code from this patch to
partman-ext2r0.  For example a script update.d/21detected_ext2r0 with
the following contents:

dev=$1
num=$2
id=$3
size=$4
type=$5
fs=$6
path=$7
name=$8

cd $dev

if \
    [ -f $id/detected_filesystem ] \
    && [ "$(cat $id/detected_filesystem)" = ext2 ] \
    && $(tune2fs -l $path | grep -q '^Filesystem revision #: \+0 (original)$')
then
    echo ext2r0 >$id/detected_filesystem
fi

The disadvantage of this solution is that it cheats the rest of
partman that parted has not detected ext2 file system in the
partition.  The following seems to me a more correct solution:

1. Change the number of partman-base/update.d/default_visuals from 59
   to 58.

2. Script update.d/59ext2r0_default_visual in partman-ext2r0:

# The purpose of this preliminary code is execute only once the time
# consuming file system detection.  The second part of the script does
# not run tune2fs, it only checks for the existence of
# detected_ext2r0.
if \
    [ ! -f /var/lib/partman/filesystems_detected ] \
    && [ -f $id/detected_filesystem ] \
    && [ "$(cat $id/detected_filesystem)" = ext2 ]
then
    if \
	$(tune2fs -l $path | grep -q '^Filesystem revision #: \+0 (original)$')
    then
	>$id/detected_ext2r0
    else
	[ ! -f $id/detected_ext2r0 ] || rm $id/detected_ext2r0
    fi
fi

. /usr/share/debconf/confmodule

dev=$1
num=$2
id=$3
size=$4
type=$5
fs=$6
path=$7
name=$8

cd $dev

# List the ext2r0 partition as ext2r0 in the main partman screen
if \
    [ "$fs" != free -a -f $id/detected_filesystem -a ! -f $id/method ] \
    && [ "$(cat $id/detected_filesystem)" = ext2 -a -f $id/detected_ext2r0 ]
then
    db_metaget partman/filesystem_short/ext2r0 description || RET=''
    RET="${RET:-ext2r0}"
    printf "$RET" >$id/visual_filesystem
fi

3. Change partman-ext2r0/valid_filesystems/ext2r0 to expect ext2
   instead of ext2r0 in $id/detected_filesystem:

#!/bin/sh

dev=$1
id=$2
property=$3

[ -f /var/lib/partman/ext2r0 ] || exit 0

case $property in
    formatable)
        echo ext2r0
        ;;
    existing)
	if \
	    [ -f $id/detected_filesystem -a -f $id/detected_ext2r0 ] \
	    && [ "$(cat $id/detected_filesystem)" = ext2 ]
	then
	    echo ext2r0
	fi
	;;
esac

Anton Zinoviev



Reply to: