Codebase list partman-partitioning / 7e0e4af
Cache calls to tune2fs and ntfsresize, to make navigating through the resize UI a little faster. Colin Watson 9 years ago
5 changed file(s) with 51 addition(s) and 19 deletion(s). Raw diff Collapse all Expand all
99 check_virtual
1010
1111 if [ "$virtual" = no ] && [ -f $oldid/detected_filesystem ]; then
12 case "$(cat $oldid/detected_filesystem)" in
13 ntfs)
14 if ! get_ntfs_resize_range; then
15 db_input critical partman-partitioning/impossible_resize || true
16 db_go || true
17 exit 1
18 fi
19 ;;
20 ext2|ext3|ext4)
21 if ! get_ext2_resize_range; then
22 db_input critical partman-partitioning/impossible_resize || true
23 db_go || true
24 exit 1
25 fi
26 ;;
27 *)
28 get_resize_range
29 ;;
30 esac
12 if ! get_real_resize_range "$oldid" \
13 "$(cat "$oldid/detected_filesystem")"; then
14 db_input critical partman-partitioning/impossible_resize || true
15 db_go || true
16 exit 1
17 fi
3118 else
3219 get_resize_range
3320 fi
11
22 * Restore sensible architecture sorting in default_disk_label.
33 * Depend on ntfs-3g-udeb rather than ntfsprogs-udeb.
4 * Cache calls to tune2fs and ntfsresize, to make navigating through the
5 resize UI a little faster.
46
57 -- Colin Watson <cjwatson@debian.org> Sat, 30 Aug 2014 22:43:04 +0100
68
9797 open_dialog GET_RESIZE_RANGE $oldid
9898 read_line minsize cursize maxsize
9999 close_dialog
100 }
101
102 # This function works only on non-virtual (i.e. committed) filesystems. It
103 # calls some external programs to discover the size, so caches for
104 # efficiency.
105 get_real_resize_range () {
106 # Keep this variable name in sync with other functions above.
107 local oldid="$1"
108 local fs="$2"
109
110 if [ -f "$oldid/real_resize_range_cache" ]; then
111 read minsize cursize maxsize prefsize \
112 < "$oldid/real_resize_range_cache"
113 else
114 local CODE=0
115 case $fs in
116 ntfs) get_ntfs_resize_range || CODE=$? ;;
117 ext2|ext3|ext4) get_ext2_resize_range || CODE=$? ;;
118 *) get_resize_range ;;
119 esac
120 case $CODE in
121 0)
122 echo "$minsize $cursize $maxsize $prefsize" \
123 > "$oldid/real_resize_range_cache"
124 ;;
125 esac
126 return $CODE
127 fi
100128 }
101129
102130 human_resize_range () {
0 01 real_resize_range_cache
01 21 biosgrub_sync_flag
12 60 biosgrub_visuals
0 #! /bin/sh
1
2 dev=$1
3 num=$2
4 id=$3
5 size=$4
6 type=$5
7 fs=$6
8 path=$7
9 name=$8
10
11 cd $dev
12
13 rm -f "$id/real_resize_range_cache"