Cache calls to tune2fs and ntfsresize, to make navigating through the resize UI a little faster.
Colin Watson
9 years ago
9 | 9 |
check_virtual
|
10 | 10 |
|
11 | 11 |
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
|
31 | 18 |
else
|
32 | 19 |
get_resize_range
|
33 | 20 |
fi
|
1 | 1 |
|
2 | 2 |
* Restore sensible architecture sorting in default_disk_label.
|
3 | 3 |
* 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.
|
4 | 6 |
|
5 | 7 |
-- Colin Watson <cjwatson@debian.org> Sat, 30 Aug 2014 22:43:04 +0100
|
6 | 8 |
|
97 | 97 |
open_dialog GET_RESIZE_RANGE $oldid
|
98 | 98 |
read_line minsize cursize maxsize
|
99 | 99 |
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
|
100 | 128 |
}
|
101 | 129 |
|
102 | 130 |
human_resize_range () {
|
|
0 |
01 real_resize_range_cache
|
0 | 1 |
21 biosgrub_sync_flag
|
1 | 2 |
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"
|