Browse Source

x230: x230_update.sh: add interactive file select if image not given on commandline

pull/35/head
Martin Kepplinger 6 years ago
parent
commit
4c1bc87833
1 changed files with 25 additions and 4 deletions
  1. +25
    -4
      x230/x230_update.sh

+ 25
- 4
x230/x230_update.sh View File

@ -49,13 +49,34 @@ do
shift
done
if [ ! "$have_input_image" -gt 0 ] ; then
echo "no input image provided"
usage
exit 1
image_available=$(ls -1 | grep x230_coreboot_seabios | grep rom)
if [ -z "${image_available}" ] ; then
echo "No image file found. Please add -i <file>"
echo ""
usage
exit 1
fi
prompt="file not specified. Please select a file to flash:"
options=( $(find -maxdepth 1 -name x230_coreboot_seabios*rom -print0 | xargs -0) )
PS3="$prompt "
select INPUT_IMAGE_PATH in "${options[@]}" "Quit" ; do
if (( REPLY == 1 + ${#options[@]} )) ; then
exit
elif (( REPLY > 0 && REPLY <= ${#options[@]} )) ; then
echo "You picked $INPUT_IMAGE_PATH which is file $REPLY"
break
else
echo "Invalid option. Try another one."
fi
done
fi
OUTPUT_PATH=output
INPUT_IMAGE_NAME=$(basename ${INPUT_IMAGE_PATH})
OUTPUT_IMAGE_NAME=${INPUT_IMAGE_NAME%%.*}_prepared_12mb.rom


Loading…
Cancel
Save