summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO1
-rw-r--r--src/core/libs/lib-ui-interactive.sh24
-rw-r--r--src/core/libs/lib-ui.sh14
3 files changed, 17 insertions, 22 deletions
diff --git a/TODO b/TODO
index 9953e3a..6efe0c4 100644
--- a/TODO
+++ b/TODO
@@ -11,7 +11,6 @@ CURRENT ISSUES:
* add /var/lib/aif/profiles directory to packages and document it.
* check the existence of /src/core/pkg and based on that set a different default value. in interactive_select_source
* > It displays the current time in UTC (if utc selected) not the users localtime (UTC +- TIMEZONE)
-* interactive_autoprepare: merge _getavaildisks( and finddisks calls
* more vars for automatic profile: hostname (check that adding to /etc/hosts can be done procedure-independently),
LOCALE, HARDWARECLOCK, TIMEZONE, KEYMAP, MODULES, DAEMONS, network config? (or take the config from runtime)
* what to do with /etc/groups, passwd, modprobe.conf, mkinitcpio.conf, rc.local etc with automatic procedure? configure through automatic profile or let user check out files from svn or so?
diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh
index eae4029..6f79b33 100644
--- a/src/core/libs/lib-ui-interactive.sh
+++ b/src/core/libs/lib-ui-interactive.sh
@@ -247,20 +247,17 @@ interactive_prepare_disks ()
interactive_autoprepare()
{
- DISCS=$(finddisks)
- if [ $(echo $DISCS | wc -w) -gt 1 ]
+ listblockfriendly
+ if [ $(echo $BLOCKFRIENDLY | wc -w) -gt 1 ]
then
- notify "Available Disks:\n\n$(_getavaildisks)\n"
- ask_option no 'Harddrive selection' "Select the hard drive to use" required $(finddisks 1 _) || return 1
+ ask_option no 'Harddrive selection' "Select the hard drive to use" required $BLOCKFRIENDLY || return 1
DISC=$ANSWER_OPTION
- elif [ -z "$DISCS" ]; then
- ask_string "Could not find disk. Please enter path of devicefile manually" "" || return 1
- DISC=$ANSWER_STRING
+ elif [ -z "$BLOCKFRIENDLY" ]; then
+ ask_string "Could not find disk. Please enter path of devicefile manually" "" || return 1
+ DISC=${ANSWER_STRING// /} # TODO : some checks if $DISC is really a blockdevice is probably a good idea
else
- DISC=$DISCS
+ DISC=$(echo $BLOCKFRIENDLY | cut -d ' ' -f 1)
fi
- # TODO : some checks if $DISC is really a blockdevice is probably a good idea
- DISC=${DISC// /} # strip all whitespace. we need this for some reason.TODO: find out why
get_blockdevice_size $DISC MiB
FSOPTS=()
@@ -334,10 +331,9 @@ interactive_partition() {
fi
# Select disk to partition
- DISCS=$(finddisks 1 _)
- DISCS="$DISCS OTHER - DONE +"
- notify "Available Disks:\n\n$(_getavaildisks)\n"
- DISC=""
+ listblockfriendly
+ DISCS="$BLOCKFRIENDLY OTHER OTHER DONE DONE"
+ DISC=
while true; do
# Prompt the user with a list of known disks
ask_option no 'Disc selection' "$question_text (select DONE when finished)" required $DISCS || return 1
diff --git a/src/core/libs/lib-ui.sh b/src/core/libs/lib-ui.sh
index 8b886fe..f31031a 100644
--- a/src/core/libs/lib-ui.sh
+++ b/src/core/libs/lib-ui.sh
@@ -37,17 +37,17 @@ printk()
}
-# TODO: pass disks as argument to decouple backend logic
-# Get a list of available disks for use in the "Available disks" dialogs.
-# Something like:
-# /dev/sda: 640133 MiB (640 GiB)
-# /dev/sdb: 640135 MiB (640 GiB)
-_getavaildisks()
+# Get a list of available partionable blockdevices for use in ask_option
+# populates $BLOCKFRIENDLY with entries like:
+# /dev/sda /dev/sda_640133_MiB_(640_GiB)
+listblockfriendly()
{
+ BLOCKFRIENDLY=
for i in $(finddisks)
do
get_blockdevice_size $i MiB
- echo "$i: $BLOCKDEVICE_SIZE MiB ($(($BLOCKDEVICE_SIZE/2**10)) GiB)\n"
+ [ -n "$BLOCKFRIENDLY" ] && BLOCKFRIENDLY="$BLOCKFRIENDLY "
+ BLOCKFRIENDLY="$BLOCKFRIENDLY$i ${i}_${BLOCKDEVICE_SIZE}_MiB_($(($BLOCKDEVICE_SIZE/2**10))_GiB)"
done
}