~ubuntu-branches/ubuntu/maverick/partman-basicfilesystems/maverick

« back to all changes in this revision

Viewing changes to fstab.d/basic

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2008-05-07 13:02:37 UTC
  • Revision ID: james.westby@ubuntu.com-20080507130237-xvhlqmsl5k0i3jdr
Tags: 59ubuntu1
* Resynchronise with Debian. Remaining changes:
  - If partman/automount is preseeded to true, automatically mount
    partitions with usefully-mountable filesystems on subdirectories of
    /media.
  - Add minimal support for NTFS partitions using ntfs-3g.
  - Mount FAT and NTFS filesystems at boot (fstab pass 1).
  - Mount FAT and NTFS with umask=007,gid=46 (static group plugdev).
  - When formatting over the top of an existing swap partition, preserve
    its UUID to avoid leaving systems that use UUIDs in /etc/fstab without
    swap.
  - mount.d/basic: Close mount's fd 3 so that it doesn't inherit a debconf
    file descriptor, to prevent log-output hanging when ntfs-3g is in use.
  - Special case loopmounted filesystems as it's safer to format the
    underlying file, not the device.
  - Default to mounting ext2 with relatime.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
2
 
3
 
. /lib/partman/definitions.sh
 
3
. /lib/partman/lib/base.sh
4
4
 
5
5
utf8=
6
6
if db_get debian-installer/locale; then
7
 
    # TODO: This check breaks for locales that use the UTF-8 encoding but
8
 
    # whose names don't include ".UTF-8". This is difficult to fix without
9
 
    # adding more encoding intelligence to localechooser. In the meantime,
10
 
    # we hardcode certain such non-obvious UTF-8 locales known to be used in
11
 
    # localechooser.
12
 
    case $RET in
13
 
        *.UTF-8|bn_BD|dz_BT|gu_IN|hi_IN|km_KH|ml_IN|ne_NP|pa_IN|se_NO|ta_IN|vi_VN|wo_SN)
14
 
            utf8=1
15
 
            ;;
16
 
    esac
 
7
        # TODO: This check breaks for locales that use the UTF-8 encoding but
 
8
        # whose names don't include ".UTF-8". This is difficult to fix without
 
9
        # adding more encoding intelligence to localechooser. In the meantime,
 
10
        # we hardcode certain such non-obvious UTF-8 locales known to be used in
 
11
        # localechooser.
 
12
        case $RET in
 
13
            *.UTF-8|bn_BD|dz_BT|gu_IN|hi_IN|km_KH|ml_IN|ne_NP|pa_IN|se_NO|ta_IN|vi_VN|wo_SN)
 
14
                utf8=1
 
15
                ;;
 
16
        esac
17
17
fi
18
18
 
19
19
for dev in $DEVICES/*; do
21
21
        cd $dev
22
22
        open_dialog PARTITIONS
23
23
        while { read_line num id size type fs path name; [ "$id" ]; }; do
24
 
            [ $fs != free ] || continue
25
 
            [ -f "$id/method" ] || continue
26
 
            method=$(cat $id/method)
27
 
            if [ "$method" = swap ]; then
28
 
                echo "$path" none swap sw 0 0
29
 
            fi
30
 
            [ -f "$id/acting_filesystem" ] || continue
31
 
            filesystem=$(cat $id/acting_filesystem)
32
 
            case "$filesystem" in
33
 
                ext2)
34
 
                    [ -f "$id/mountpoint" ] || continue
35
 
                    mountpoint=$(cat $id/mountpoint)
36
 
                    # due to #249322, #255135, #258117:
37
 
                    if [ "$mountpoint" = /tmp ]; then
38
 
                        rm -f $id/options/noexec
39
 
                    fi
40
 
                    options=$(get_mountoptions $dev $id)
41
 
                    if [ "$mountpoint" = / ]; then
42
 
                        if [ "$options" = defaults ]; then
43
 
                            options="errors=remount-ro"
44
 
                        else
45
 
                            options="${options},errors=remount-ro"
46
 
                        fi
47
 
                        pass=1
48
 
                    else
49
 
                        pass=2
50
 
                    fi
51
 
                    echo "$path" "$mountpoint" ext2 $options 0 $pass
52
 
                    ;;
53
 
                fat16|fat32)
54
 
                    [ -f "$id/mountpoint" ] || continue
55
 
                    mountpoint=$(cat $id/mountpoint)
56
 
                    options=$(get_mountoptions $dev $id)
57
 
                    if [ "$utf8" ]; then
58
 
                        if [ "$options" = defaults ]; then
59
 
                            options="utf8"
60
 
                        else
61
 
                            options="$options,utf8"
62
 
                        fi
63
 
                    fi
64
 
                    # base-passwd defines gid 46 as group plugdev
65
 
                    echo "$path" "$mountpoint" vfat $options,umask=007,gid=46 0 1
66
 
                    ;;
67
 
                ntfs)
68
 
                    [ -f "$id/mountpoint" ] || continue
69
 
                    mountpoint=$(cat $id/mountpoint)
70
 
                    options=$(get_mountoptions $dev $id)
71
 
                    if [ "$utf8" ] && [ ! -f /var/lib/partman/ntfs-3g ]; then
72
 
                        options="$options,nls=utf8"
73
 
                    fi
74
 
                    # base-passwd defines gid 46 as group plugdev
75
 
                    echo "$path" "$mountpoint" ntfs $options,umask=007,gid=46 0 1
76
 
                    ;;
77
 
            esac
 
24
                [ $fs != free ] || continue
 
25
                [ -f "$id/method" ] || continue
 
26
                method=$(cat $id/method)
 
27
                if [ "$method" = swap ]; then
 
28
                        echo "$path" none swap sw 0 0
 
29
                fi
 
30
                [ -f "$id/acting_filesystem" ] || continue
 
31
                filesystem=$(cat $id/acting_filesystem)
 
32
                case "$filesystem" in
 
33
                    ext2)
 
34
                        [ -f "$id/mountpoint" ] || continue
 
35
                        mountpoint=$(cat $id/mountpoint)
 
36
                        # due to #249322, #255135, #258117:
 
37
                        if [ "$mountpoint" = /tmp ]; then
 
38
                                rm -f $id/options/noexec
 
39
                        fi
 
40
                        options=$(get_mountoptions $dev $id)
 
41
                        if [ "$mountpoint" = / ]; then
 
42
                                if [ "$options" = defaults ]; then
 
43
                                        options="errors=remount-ro"
 
44
                                else
 
45
                                        options="${options},errors=remount-ro"
 
46
                                fi
 
47
                                pass=1
 
48
                        else
 
49
                                pass=2
 
50
                        fi
 
51
                        echo "$path" "$mountpoint" ext2 $options 0 $pass
 
52
                        ;;
 
53
                    fat16|fat32)
 
54
                        [ -f "$id/mountpoint" ] || continue
 
55
                        mountpoint=$(cat $id/mountpoint)
 
56
                        options=$(get_mountoptions $dev $id)
 
57
                        if [ "$utf8" ]; then
 
58
                                if [ "$options" = defaults ]; then
 
59
                                        options="utf8"
 
60
                                else
 
61
                                        options="$options,utf8"
 
62
                                fi
 
63
                        fi
 
64
                        # base-passwd defines gid 46 as group plugdev
 
65
                        echo "$path" "$mountpoint" vfat $options,umask=007,gid=46 0 1
 
66
                        ;;
 
67
                    ntfs)
 
68
                        [ -f "$id/mountpoint" ] || continue
 
69
                        mountpoint=$(cat $id/mountpoint)
 
70
                        options=$(get_mountoptions $dev $id)
 
71
                        if [ "$utf8" ] && [ ! -f /var/lib/partman/ntfs-3g ]; then
 
72
                                options="$options,nls=utf8"
 
73
                        fi
 
74
                        # base-passwd defines gid 46 as group plugdev
 
75
                        echo "$path" "$mountpoint" ntfs $options,umask=007,gid=46 0 1
 
76
                        ;;
 
77
                esac
78
78
        done
79
79
        close_dialog
80
80
done
81