diff options
author | Dieter Plaetinck <dieter@plaetinck.be> | 2008-12-09 18:41:23 +0100 |
---|---|---|
committer | Dieter Plaetinck <dieter@plaetinck.be> | 2008-12-09 18:41:23 +0100 |
commit | 94d36b5a5a394c033edb7d2b8c340579d4564aad (patch) | |
tree | 515801682bd7a89e909e2aa15bf29f2ac39dda81 | |
parent | a87d6a70abdb462ee1f9b6f5d65b966d1d8d3763 (diff) |
support for successive infofys + nicer output for disk stuff + stupid fix
-rw-r--r-- | src/core/libs/lib-blockdevices-filesystems.sh | 19 | ||||
-rw-r--r-- | src/core/libs/lib-ui.sh | 22 |
2 files changed, 32 insertions, 9 deletions
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 <<EOF $sfdisk_input EOF @@ -336,6 +335,7 @@ process_disks () process_disk () { + infofy "Partitioning $DEVICE" disks partition $1 "$2" } @@ -377,12 +377,16 @@ process_filesystems () sort -t \ -k 2 $TMP_FILESYSTEMS | tac | while read part part_type part_label fs_type fs_create fs_mountpoint fs_mount fs_opts fs_label fs_params do - debug "umounting/swapoffing $part" if [ "$fs_type" = swap ] then + infofy "(Maybe) Swapoffing $part" disks + debug "Swapoffing $part" + swapoff $part &>/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/<listname> 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 <listname> +# 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 } |