diff options
author | Dieter Plaetinck <dieter@plaetinck.be> | 2009-07-26 16:07:59 +0200 |
---|---|---|
committer | Dieter Plaetinck <dieter@plaetinck.be> | 2009-07-26 16:07:59 +0200 |
commit | 5fe9c9f753a9ad40e17cc5647e07ae7c4df2ac26 (patch) | |
tree | 842f3fb75dc815f8e773815edb57b1ff02cd6675 /src/core/libs | |
parent | d1325ad96fa3ae27e74c192b36d858353f751d0c (diff) |
cleaner separation of concerns: remove $PART_ROOT hack in favor of more useful partion finding function
Diffstat (limited to 'src/core/libs')
-rw-r--r-- | src/core/libs/lib-blockdevices-filesystems.sh | 19 | ||||
-rw-r--r-- | src/core/libs/lib-ui-interactive.sh | 5 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh index a8a7dcf..abf728f 100644 --- a/src/core/libs/lib-blockdevices-filesystems.sh +++ b/src/core/libs/lib-blockdevices-filesystems.sh @@ -4,6 +4,8 @@ # FORMAT DEFINITIONS: # -- formats used to interface with this library -- +# these files will persist during the entire aif session (and even after stopping aif) +# so you can use them to retrieve data from them (or use functions in this library to do that for you) # $TMP_PARTITIONS # one line per partition, blockdevice + partioning string for sfdisk. See docs for function partition for more info. # $TMP_BLOCKDEVICES @@ -76,6 +78,13 @@ target_umountall() done } +# tells you which blockdevice is configured for the specific mountpoint +# $1 mountpoint +get_device_with_mount () { + ANSWER_DEVICE=`grep ";$1;" $TMP_BLOCKDEVICES 2>/dev/null | cut -d ' ' -f1` + [ -n "$ANSWER_DEVICE" ] # set correct exit code +} + # taken from setup script, modified for separator control # $1 set to 1 to echo a newline after device instead of a space (optional) @@ -487,11 +496,6 @@ rollback_filesystems () if umount $part_real >$LOG then done_umounts+=("$part_real") - if [ "$fs_mount" = target -a "$fs_mountpoint" = '/' ] - then - debug FS "clearing \$PART_ROOT (was: $PART_ROOT)" - PART_ROOT= - fi else warnings="$warnings\nCould not umount umount $part_real . Probably device is still busy. See $LOG" show_warning "Umount failure" "Could not umount umount $part_real . Probably device is still busy. See $LOG" #TODO: fix device busy things @@ -706,11 +710,6 @@ process_filesystem () debug 'FS' "mounting $part on $dst" mkdir -p $dst &>/dev/null # directories may or may not already exist mount -t $fs_type $part $dst >$LOG 2>&1 || ( show_warning 'Mount' "Error mounting $part on $dst" ; return 1 ) - if [ "$fs_mount" = target -a $fs_mountpoint = '/' ] - then - debug FS "setting \$PART_ROOT to $part" - PART_ROOT=$part - fi fi fi diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index 6dd8e71..a7681e3 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -841,8 +841,9 @@ interactive_install_grub() { # try to auto-configure GRUB... debug 'UI-INTERACTIVE' "install_grub \$PART_ROOT $PART_ROOT \$GRUB_OK $GRUB_OK" - if [ -n "$PART_ROOT" -a "$GRUB_OK" != '1' ] ; then - GRUB_OK=0 + if get_device_with_mount '/' && [ "$GRUB_OK" != '1' ] ; then + GRUB_OK=0 + PART_ROOT=$ANSWER_DEVICE grubdev=$(mapdev $PART_ROOT) local _rootpart="${PART_ROOT}" local _uuid="$(getuuid ${PART_ROOT})" |