Commit 7ce117f6 authored by Frans Pop's avatar Frans Pop

Major whitespace cleanup and a few minor coding style fixes

Source base.sh from resize.sh instead of the parent script.

r50650
parent a252434d
......@@ -15,44 +15,44 @@ db_get partman-partitioning/confirm_copy
[ "$RET" = 'true' ] || exit 0
ask_for_source () {
local noninteractive
noninteractive=true
while true; do
source_dev=''
source_id=''
while [ ! "$source_id" ]; do
choices=$(partition_tree_choices)
debconf_select critical partman-partitioning/source_partition "$choices" asdfasdfasdf
case $? in
1)
$noninteractive
;;
255)
return 1
;;
esac
noninteractive='return 1'
source_dev=${RET%//*}
source_id=${RET#*//}
local noninteractive
noninteractive=true
while true; do
source_dev=''
source_id=''
while [ ! "$source_id" ]; do
choices=$(partition_tree_choices)
debconf_select critical partman-partitioning/source_partition "$choices" asdfasdfasdf
case $? in
1)
$noninteractive
;;
255)
return 1
;;
esac
noninteractive='return 1'
source_dev=${RET%//*}
source_id=${RET#*//}
done
source_dev=${source_dev##*/}
if perform_copying; then break; fi
done
source_dev=${source_dev##*/}
if perform_copying; then break; fi
done
return 0
return 0
}
perform_copying () {
commit_changes partman-partitioning/copy_commit_failed || exit 0
commit_changes partman-partitioning/copy_commit_failed || exit 0
name_progress_bar partman-partitioning/progress_copying
open_dialog COPY_PARTITION $id $source_dev $source_id
close_dialog
name_progress_bar partman-partitioning/progress_copying
open_dialog COPY_PARTITION $id $source_dev $source_id
close_dialog
for s in /lib/partman/init.d/*; do
if [ -x $s ]; then
$s || exit 0
fi
done
for s in /lib/partman/init.d/*; do
if [ -x $s ]; then
$s || exit 0
fi
done
}
ask_for_source
#!/bin/sh
. /lib/partman/lib/base.sh
. /lib/partman/lib/resize.sh
dev=$2
......@@ -12,23 +11,23 @@ check_virtual
if [ "$virtual" = no ] && [ -f $oldid/detected_filesystem ]; then
case "$(cat $oldid/detected_filesystem)" in
ntfs)
if ! get_ntfs_resize_range; then
db_input critical partman-partitioning/impossible_resize || true
db_go || true
exit 1
fi
;;
ext2|ext3)
if ! get_ext2_resize_range; then
db_input critical partman-partitioning/impossible_resize || true
db_go || true
exit 1
fi
;;
*)
get_resize_range
;;
ntfs)
if ! get_ntfs_resize_range; then
db_input critical partman-partitioning/impossible_resize || true
db_go || true
exit 1
fi
;;
ext2|ext3)
if ! get_ext2_resize_range; then
db_input critical partman-partitioning/impossible_resize || true
db_go || true
exit 1
fi
;;
*)
get_resize_range
;;
esac
else
get_resize_range
......
partman-partitioning (55) UNRELEASED; urgency=low
* Major whitespace cleanup and a few minor coding style fixes.
* Source base.sh from resize.sh instead of the parent script.
-- Frans Pop <fjp@debian.org> Thu, 27 Dec 2007 13:28:08 +0100
partman-partitioning (54) unstable; urgency=low
[ Frans Pop ]
......
......@@ -19,4 +19,3 @@ case "$type" in
printf "new\t${RET}\n"
;;
esac
......@@ -18,52 +18,52 @@ close_dialog
freehsize=$(longint2human $freesize)
ask_for_size () {
local noninteractive
noninteractive=true
while true; do
size=''
while [ ! "$size" ]; do
db_set partman-partitioning/new_partition_size "$freehsize"
db_subst partman-partitioning/new_partition_size MAXSIZE "$freehsize"
db_input critical partman-partitioning/new_partition_size ||
$noninteractive
noninteractive="return 1"
db_go || return 1
db_get partman-partitioning/new_partition_size
case "$RET" in
max)
size=$freesize
hsize="$freehsize"
;;
*%)
digits=$(expr "$RET" : '\([1-9][0-9]*\) *%$')
if [ "$digits" ]; then
maxmb=$(expr 0000000"$freesize" : '0*\(..*\)......$')
size=$(($digits * $maxmb / 100))000000
fi
if [ "$digits" = 100 ]; then
hsize="$freehsize"
else
hsize=some_number
fi
;;
*)
if valid_human "$RET"; then
size=$(human2longint "$RET")
fi
hsize="$RET"
;;
esac
if [ -z "$size" ]; then
db_input high partman-partitioning/bad_new_partition_size || true
db_go || true
fi
local noninteractive
noninteractive=true
while true; do
size=''
while [ ! "$size" ]; do
db_set partman-partitioning/new_partition_size "$freehsize"
db_subst partman-partitioning/new_partition_size MAXSIZE "$freehsize"
db_input critical partman-partitioning/new_partition_size ||
$noninteractive
noninteractive="return 1"
db_go || return 1
db_get partman-partitioning/new_partition_size
case "$RET" in
max)
size=$freesize
hsize="$freehsize"
;;
*%)
digits=$(expr "$RET" : '\([1-9][0-9]*\) *%$')
if [ "$digits" ]; then
maxmb=$(expr 0000000"$freesize" : '0*\(..*\)......$')
size=$(($digits * $maxmb / 100))000000
fi
if [ "$digits" = 100 ]; then
hsize="$freehsize"
else
hsize=some_number
fi
;;
*)
if valid_human "$RET"; then
size=$(human2longint "$RET")
fi
hsize="$RET"
;;
esac
if [ -z "$size" ]; then
db_input high partman-partitioning/bad_new_partition_size || true
db_go || true
fi
done
if ask_for_type; then break; fi
done
if ask_for_type; then break; fi
done
return 0
return 0
}
ask_for_type () {
......@@ -71,28 +71,28 @@ ask_for_type () {
has_extended=no
open_dialog PARTITIONS
while { read_line x1 x2 x3 parttype x5 x6 x7; [ "$parttype" ]; }; do
if [ "$parttype" = logical ]; then
has_extended=yes
fi
if [ "$parttype" = logical ]; then
has_extended=yes
fi
done
close_dialog
noninteractive=true
while true; do
case "$freetype" in
primary)
primary)
$noninteractive
type=Primary
;;
logical)
logical)
$noninteractive
type=Logical
;;
pri/log)
pri/log)
if [ "$has_extended" = yes ]; then
db_set partman-partitioning/new_partition_type Logical
db_set partman-partitioning/new_partition_type Logical
else
db_set partman-partitioning/new_partition_type Primary
db_set partman-partitioning/new_partition_type Primary
fi
db_input critical partman-partitioning/new_partition_type ||
$noninteractive
......@@ -135,8 +135,8 @@ create_new_partition () {
numparts=1
open_dialog PARTITIONS
while { read_line x1 part x3 x4 x5 x6 x7; [ "$part" ]; }; do
partitions="$partitions $part"
numparts=$(($numparts + 1))
partitions="$partitions $part"
numparts=$(($numparts + 1))
done
close_dialog
......@@ -146,80 +146,79 @@ create_new_partition () {
# Cannot set "Use as" for SATA RAID partitions under the parent device
if [ -f sataraid ]; then
:
elif [ -n "$id" -a -f ../../ext3 ]; then
# make better defaults for the new partition
mkdir -p $id
echo format >$id/method
>$id/format
>$id/use_filesystem
echo ext3 >$id/filesystem
mkdir $id/options
mplist='/ /home /usr /var /tmp /usr/local /opt /srv /boot'
mpcurrent=$(
for dev in $DEVICES/*; do
[ -d $dev ] || continue
cd $dev
open_dialog PARTITIONS
while { read_line num id size type fs path name; [ "$id" ]; }; do
[ $fs != free ] || continue
[ -f "$id/method" ] || continue
[ -f "$id/acting_filesystem" ] || continue
[ -f "$id/use_filesystem" ] || continue
[ -f "$id/mountpoint" ] || continue
echo $(cat $id/mountpoint) # echo ensures 1 line
done
close_dialog
elif [ "$id" ] && [ -f ../../ext3 ]; then
# make better defaults for the new partition
mkdir -p $id
echo format >$id/method
>$id/format
>$id/use_filesystem
echo ext3 >$id/filesystem
mkdir $id/options
mplist='/ /home /usr /var /tmp /usr/local /opt /srv /boot'
mpcurrent=$(
for dev in $DEVICES/*; do
[ -d $dev ] || continue
cd $dev
open_dialog PARTITIONS
while { read_line num id size type fs path name; [ "$id" ]; }; do
[ $fs != free ] || continue
[ -f "$id/method" ] || continue
[ -f "$id/acting_filesystem" ] || continue
[ -f "$id/use_filesystem" ] || continue
[ -f "$id/mountpoint" ] || continue
echo $(cat $id/mountpoint) # echo ensures 1 line
done
close_dialog
done
)
for mp in $mpcurrent; do
mplist=$(echo $mplist | sed "s,$mp,,")
done
mp=''
for mp in $mplist; do
break
done
)
for mp in $mpcurrent; do
mplist=$(echo $mplist | sed "s,$mp,,")
done
mp=''
for mp in $mplist; do
break
done
if [ "$mp" ]; then
echo $mp >$id/mountpoint
fi
menudir_default_choice /lib/partman/active_partition ext3 mountpoint || true
menudir_default_choice /lib/partman/choose_partition partition_tree $dev//$id || true
# setting the bootable flag is too much unnecessary work:
# 1. check if the disk label supports bootable flag
# 2. check if the mount point is / or /boot and the partition
# type is `primary'
# 3. get the current flags
# 4. add `boot' and set the new flags
# 5. moreover, when the boot loader is installed in MBR
# no bootable flag is necessary
if [ "$mp" ]; then
echo $mp >$id/mountpoint
fi
menudir_default_choice /lib/partman/active_partition ext3 mountpoint || true
menudir_default_choice /lib/partman/choose_partition partition_tree $dev//$id || true
# setting the bootable flag is too much unnecessary work:
# 1. check if the disk label supports bootable flag
# 2. check if the mount point is / or /boot and the partition
# type is `primary'
# 3. get the current flags
# 4. add `boot' and set the new flags
# 5. moreover, when the boot loader is installed in MBR
# no bootable flag is necessary
fi
db_progress STEP 1
for part in $partitions; do
update_partition $dev $part
db_progress STEP 1
update_partition $dev $part
db_progress STEP 1
done
db_progress STOP
if [ "$id" ]; then
while true; do
set +e
device="$(humandev $(cat device))"
db_subst partman/active_partition DEVICE "$device"
db_subst partman/active_partition PARTITION "$num"
db_metaget partman/text/none_detected description
db_subst partman/active_partition OTHERINFO "${RET}"
ask_user /lib/partman/active_partition "$dev" "$id"
exitcode="$?"
if [ "$exitcode" -ge 100 ]; then
break
fi
set -e
done
while true; do
set +e
device="$(humandev $(cat device))"
db_subst partman/active_partition DEVICE "$device"
db_subst partman/active_partition PARTITION "$num"
db_metaget partman/text/none_detected description
db_subst partman/active_partition OTHERINFO "${RET}"
ask_user /lib/partman/active_partition "$dev" "$id"
exitcode="$?"
if [ "$exitcode" -ge 100 ]; then
break
fi
set -e
done
fi
}
ask_for_size || exit $?
exit 0
#!/bin/sh
if [ -f /var/lib/partman/supported ]; then
exit 0
exit 0
fi
. /lib/partman/lib/disk-label.sh
......@@ -17,8 +17,8 @@ case "$default_label" in
db_go || exit 10
db_get partman-partitioning/unknown_label
if [ "$RET" = false ]; then
db_reset partman-partitioning/unknown_label
exit 10
db_reset partman-partitioning/unknown_label
exit 10
fi
db_reset partman-partitioning/unknown_label
exit 0
......@@ -28,8 +28,8 @@ case "$default_label" in
db_go || exit 10
db_get partman-partitioning/unsupported_label
if [ "$RET" = false ]; then
db_reset partman-partitioning/unsupported_label
exit 10
db_reset partman-partitioning/unsupported_label
exit 10
fi
db_reset partman-partitioning/unsupported_label
exit 0
......
......@@ -17,7 +17,7 @@ default_disk_label () {
echo bsd
else
echo msdos
fi;;
fi;;
arm|armel)
case "$sub" in
iop32x)
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment