diff options
-rwxr-xr-x | dracut/driver-updates.sh | 70 |
1 files changed, 23 insertions, 47 deletions
diff --git a/dracut/driver-updates.sh b/dracut/driver-updates.sh index e273ff18e..c67c7a7f2 100755 --- a/dracut/driver-updates.sh +++ b/dracut/driver-updates.sh @@ -115,7 +115,7 @@ function dud_select() local DEFAULT=${3:-"."} local MODE=${4:-"interactive"} - + local L dud_parse $DEFAULT <$2 @@ -173,7 +173,7 @@ function driverupdatedisc() echo "Checking Driver Update Disc $device..." DUD="/media/dud" - if [ "x$mount" != "xnomount" ]; then + if [ "x$mount" != "xnomount" ]; then mkdir -p "$DUD" mount $device "$DUD" || return dud_check "$DUD" $arch || umount /media/dud || return @@ -205,13 +205,11 @@ function driverupdatedisc() cp -r /tmp/duds/DD-$num/lib/firmware/* /lib/firmware/ # copy binaries and libraries to / directory - # TODO - + # TODO the installer-enhancement feature + # save the list of extracted modules for later use in anaconda cat /tmp/dud_extract.txt >>/tmp/dud_extracted.txt - # TODO add DD-X as a Yum repository - # release the DUD [ "x$mount" != "xnomount" ] && umount "$DUD" @@ -248,13 +246,20 @@ function driverupdatedisc() udevadm trigger } -function partition_select() +# +# value_select is the generic selector +# It accepts arbitrary command (with arguments) much like +# watch does and allows the user to select one line from +# the lines rendered by it's stdout. +# It then prints the selected line to the 3rd filedes. +# +function value_select() { local OLDIFS i available line selection count OLDIFS=$IFS IFS=$'\n' - available=($(blkid)) + available=($("$@")) IFS=$OLDIFS while [ ${#available[*]} -gt 0 -a "x$selection" == "x" ]; do @@ -281,47 +286,18 @@ function partition_select() echo $selection 1>&3 } -function file_select() -{ - local i available line selection count - available=() - selection="" - - OLDIFS=$IFS - IFS=$'\n' - available=($(ls -1)) - IFS=$OLDIFS - - while [ ${#available[*]} -gt 0 -a "x$selection" == "x" ]; do - clear - echo $PWD - echo - - for i in "${!available[@]}"; do - echo $i ${available[$i]} - done - - echo - echo "Select a file:" - - read i - - if [[ "$i" =~ ^[0-9]+$ ]]; then - if [ $i -ge 0 -a $i -lt ${#available[*]} ]; then - selection=$(echo ${available[$i]}) - fi - elif [ "x$i" == "xexit" ]; then - break - fi - done - - echo $selection 1>&3 -} - +# +# This method asks the user for a disc/partition (blkid is +# used to prepare the list) and follows with directory +# browser. +# Once the user selects a path that contains rhdd3 file +# or select a file (DUD image) it is used as a possible +# driverdisc (checked, unpacked, filtered, installed..) +# function driver_disc_select() { local selection partition mountpoint - partition_select 3>/tmp/dud_partition + value_select blkid 3>/tmp/dud_partition partition=$(cat /tmp/dud_partition) if [ "x$partition" = "x" ]; then return @@ -342,7 +318,7 @@ function driver_disc_select() fi while [ "x$selection" != "x" ]; do - file_select 3>/tmp/dud_file_selection + value_select ls -1 3>/tmp/dud_file_selection selection=$(cat /tmp/dud_file_selection) if [ -d "$selection" ]; then pushd $selection |