~cjwatson/partman-auto-lvm/existing-partitions

« back to all changes in this revision

Viewing changes to lib/auto-lvm.sh

  • Committer: Colin Watson
  • Date: 2008-05-25 19:22:50 UTC
  • mfrom: (172.1.501)
  • Revision ID: cjwatson@canonical.com-20080525192250-h1ljc4tkmpge8rgg
merge from Debian 27

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
. /lib/partman/lib/base.sh
2
 
. /lib/partman/lib/recipes.sh
 
1
# base.sh is already sourced through lvm-base.sh
3
2
. /lib/partman/lib/lvm-base.sh
 
3
. /lib/partman/lib/commit.sh
4
4
. /lib/partman/lib/auto-shared.sh
 
5
. /lib/partman/lib/recipes.sh
5
6
 
6
7
bail_out() {
7
8
        db_input critical partman-auto-lvm/$1 || true
44
45
        decode_recipe $recipe lvm
45
46
 
46
47
        # Make sure the recipe contains lvmok tags
47
 
        if ! echo "$scheme" | grep -q "lvmok"; then
 
48
        if ! echo "$scheme" | grep -q lvmok; then
48
49
                bail_out unusable_recipe
49
50
        fi
50
51
 
51
52
        # Make sure a boot partition isn't marked as lvmok
52
 
        if echo "$scheme" | grep "lvmok" | grep -q "[[:space:]]/boot[[:space:]]"; then
 
53
        if echo "$scheme" | grep lvmok | grep -q "[[:space:]]/boot[[:space:]]"; then
53
54
                bail_out unusable_recipe
54
55
        fi
55
56
 
62
63
        ### - recipe 2 everything that can go on lvm and it's calculated in perform_recipe_by_lvm.
63
64
 
64
65
        # Get the scheme of partitions that must be created outside LVM
65
 
        normalscheme=$(echo "$scheme" | grep -v "lvmok")
 
66
        normalscheme=$(echo "$scheme" | grep -v lvmok)
66
67
 
67
68
        # Check if the scheme contains a boot partition; if not warn the user
68
69
        # Except for powerpc/prep as that has the kernel in the prep partition
76
77
            powerpc/prep)
77
78
                : ;;
78
79
            *)
79
 
                if ! echo "$normalscheme" | grep -q "[[:space:]]/boot[[:space:]]"; then
 
80
                # TODO: make check more explicit, mountpoint{ / }?
 
81
                if ! echo "$normalscheme" | grep -q "[[:space:]]/[[:space:]]" && \
 
82
                   ! echo "$normalscheme" | grep -q "[[:space:]]/boot[[:space:]]"; then
80
83
                        db_input critical partman-auto-lvm/no_boot || true
81
84
                        db_go || return 30
82
85
                        db_get partman-auto-lvm/no_boot || true
86
89
        esac
87
90
 
88
91
        # Creating envelope
89
 
        scheme="$normalscheme${NL}100 1000 1000000000 ext3 method{ $method }"
 
92
        scheme="$normalscheme${NL}100 1000 1000000000 ext3 \$primary{ } method{ $method }"
90
93
 
91
94
        expand_scheme
92
95
 
94
97
 
95
98
        clean_method
96
99
 
97
 
        create_primary_partitions
98
 
 
99
100
        # This variable will be used to store the partitions that will be LVM
100
101
        # by create_partitions; zero it to be sure it's not cluttered.
101
102
        # It will be used later to provide real paths to partitions to LVM.
102
103
        # (still one atm)
103
104
        devfspv_devices=''
104
105
 
 
106
        create_primary_partitions
 
107
 
105
108
        create_partitions
106
109
 
107
 
        if ! confirm_changes "partman-lvm"; then
 
110
        if ! confirm_changes partman-lvm; then
108
111
                return 30
109
112
        fi
110
113
 
114
117
        open_dialog COMMIT
115
118
        close_dialog
116
119
 
 
120
        device_cleanup_partitions
117
121
        update_all
118
122
}
119
123
 
120
124
auto_lvm_perform() {
121
125
        # Use hostname as default vg name (if available)
122
 
        local defvgname
 
126
        local defvgname pv
123
127
        db_get partman-auto-lvm/new_vg_name
124
128
        if [ -z "$RET" ]; then
125
129
                if [ -s /etc/hostname ]; then
153
157
        else
154
158
                bail_out vg_create_error
155
159
        fi
 
160
        vg_lock_pvs "$VG_name" $pv_devices
156
161
 
157
162
        # Default to accepting the autopartitioning
158
163
        menudir_default_choice /lib/partman/choose_partition finish finish || true