From 94d36b5a5a394c033edb7d2b8c340579d4564aad Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Tue, 9 Dec 2008 18:41:23 +0100 Subject: support for successive infofys + nicer output for disk stuff + stupid fix --- src/core/libs/lib-blockdevices-filesystems.sh | 19 ++++++++++++++----- src/core/libs/lib-ui.sh | 22 ++++++++++++++++++---- 2 files changed, 32 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh index ae40c06..be923a2 100644 --- a/src/core/libs/lib-blockdevices-filesystems.sh +++ b/src/core/libs/lib-blockdevices-filesystems.sh @@ -305,7 +305,6 @@ partition() # invoke sfdisk debug "Partition calls: sfdisk $DEVICE -uM >$LOG 2>&1 <<< $sfdisk_input" printk off - infofy "Partitioning $DEVICE" sfdisk $DEVICE -uM >$LOG 2>&1 </dev/null # could be that it was not swappedon yet. that's not a problem at all. elif [ "$fs_mountpoint" != no_mount ] then + infofy "(Maybe) Umounting $part" disks + debug "Umounting $part" [ "$fs_mount" = target ] && fs_mountpoint=$var_TARGET_DIR$fs_mountpoint umount $part &>/dev/null # could be that this was not mounted yet. no problem. NOTE: umount part, not mountpoint. some other part could be mounted in this place, we don't want to affect that. fi @@ -426,6 +430,7 @@ process_filesystems () real_part=${part/+/} if [ -b "$real_part" ] then + infofy "(Maybe) Destruction of device $part (type $part_type)" disks debug "Attempting destruction of device $part (type $part_type)" [ "$part_type" = lvm-pv ] && ( pvremove $part || show_warning "process_filesystems blockdevice destruction" "Could not pvremove $part") [ "$part_type" = lvm-vg ] && ( vgremove -f $part || show_warning "process_filesystems blockdevice destruction" "Could not vgremove -f $part") @@ -443,6 +448,8 @@ process_filesystems () do if [ -b "$part" -a "$fs_create" = yes ] then + infofy "Making $fs_type filesystem on $part" disks + debug "Making $fs_type filesystem on $part" # don't ask to mount. we take care of all that ourselves in the next phase process_filesystem $part $fs_type $fs_create $fs_mountpoint no_mount $fs_opts $fs_label $fs_params fi @@ -454,12 +461,14 @@ process_filesystems () do if [ "$part_type" = raw ] then - debug "mounting/swaponning $part" + infofy "Mounting/swaponning $part" disks + debug "Mounting/swaponning $part" process_filesystem $part $fs_type no $fs_mountpoint $fs_mount $fs_opts $fs_label $fs_params fi done - + infofy "Done processing filesystems/blockdevices" disks 1 + debug "Done processing filesystems/blockdevices" } @@ -546,7 +555,7 @@ process_filesystem () if [ -n "${_uuid}" ]; then _device="UUID=${_uuid}" fi - if ! grep -q "$part $fs_mountpoint $fs_type defaults 0 " $TMP_FSTAB + if ! grep -q "$part $fs_mountpoint $fs_type defaults 0 " $TMP_FSTAB 2>/dev/null #$TMP_FSTAB may not exist yet then echo -n "$part $fs_mountpoint $fs_type defaults 0 " >> $TMP_FSTAB if [ "$FSTYPE" = "swap" ]; then diff --git a/src/core/libs/lib-ui.sh b/src/core/libs/lib-ui.sh index 6275540..e4d3f4b 100644 --- a/src/core/libs/lib-ui.sh +++ b/src/core/libs/lib-ui.sh @@ -6,7 +6,7 @@ # Taken from setup. we store dialog output in a file. TODO: can't we do this with variables? ASKDEV ANSWER="/home/arch/aif/runtime/.dialog-answer" DIA_MENU_TEXT="Use the UP and DOWN arrows to navigate menus. Use TAB to switch between buttons and ENTER to select." - +DIA_SUCCESSIVE_ITEMS="/home/arch/aif/runtime/.dia-successive-items" ### Functions that your code can use. Cli/dialog mode is fully transparant. This library takes care of it ### @@ -59,14 +59,28 @@ notify () # like notify, but user does not need to confirm explicitly when in dia mode +# $1 str +# $2 0/ this infofy call is part of a successive list of things (eg repeat previous things, keep adding items to a list) (only needed for dia, cli does this by design). +# You can keep several "lists of successive things" by grouping them with +# this is somewhat similar to follow_progress. Note that this list isn't cleared unless you set $3 to 1. default 0. (optional). +# $3 0/1 this is the last one of the group of several things (eg clear buffer). default 0. (optional) infofy () { - debug "infofy: $@" + successive=${2:-0} + succ_last=${3:-0} + debug "infofy: $1" if [ "$var_UI_TYPE" = dia ] then - _dia_DIALOG --infobox "$@" 20 50 + str="$1" + if [ "$successive" != 0 ] + then + echo "$1" >> $DIA_SUCCESSIVE_ITEMS-$successive + str=`cat $DIA_SUCCESSIVE_ITEMS-$successive` + fi + [ "$succ_last" = 1 ] && rm $DIA_SUCCESSIVE_ITEMS-$successive + _dia_DIALOG --infobox "$str" 20 50 else - echo -e "$@" + echo -e "$1" fi } -- cgit v1.2.3-54-g00ecf