summaryrefslogtreecommitdiffstats
path: root/scripts/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/contrib')
-rwxr-xr-xscripts/contrib/mkefidisk.sh63
1 files changed, 58 insertions, 5 deletions
diff --git a/scripts/contrib/mkefidisk.sh b/scripts/contrib/mkefidisk.sh
index 55f72b0f54..cd4de05336 100755
--- a/scripts/contrib/mkefidisk.sh
+++ b/scripts/contrib/mkefidisk.sh
@@ -152,8 +152,55 @@ unmount() {
152# Parse and validate arguments 152# Parse and validate arguments
153# 153#
154if [ $# -lt 3 ] || [ $# -gt 4 ]; then 154if [ $# -lt 3 ] || [ $# -gt 4 ]; then
155 usage 155 if [ $# -eq 1 ]; then
156 exit 1 156 AVAILABLE_DISK=`lsblk | grep "disk" | cut -f 1 -d " "`
157 X=0
158 for disk in `echo $AVAILABLE_DISK`; do
159 mounted=`lsblk /dev/$disk | awk {'print $7'} | sed "s/MOUNTPOINT//"`
160 if [ -z "$mounted" ]; then
161 UNMOUNTED_AVAILABLES="$UNMOUNTED_AVAILABLES /dev/$disk"
162 info "$X - /dev/$disk"
163 X=`expr $X + 1`
164 fi
165 done
166 if [ $X -eq 0 ]; then
167 die "No unmounted device found."
168 fi
169 read -p "Choose unmounted device number: " DISK_NUMBER
170 X=0
171 for line in `echo $UNMOUNTED_AVAILABLES`; do
172 if [ $DISK_NUMBER -eq $X ]; then
173 DISK_TO_BE_FLASHED=$line
174 break
175 else
176 X=`expr $X + 1`
177 fi
178 done
179 if [ -z "$DISK_TO_BE_FLASHED" ]; then
180 die "Option \"$DISK_NUMBER\" is invalid. Choose a valid option"
181 else
182 if [ -z `echo $DISK_TO_BE_FLASHED | grep "mmc"` ]; then
183 TARGET_TO_BE_BOOT="/dev/sda"
184 else
185 TARGET_TO_BE_BOOT="/dev/mmcblk0"
186 fi
187 fi
188 echo ""
189 echo "Choose a name of the device that will be boot from"
190 echo -n "Recommended name is: "
191 info "$TARGET_TO_BE_BOOT"
192 read -p "Is target device okay? [y/N]: " RESPONSE
193 if [ "$RESPONSE" != "y" ]; then
194 read -p "Choose target device name: " TARGET_TO_BE_BOOT
195 fi
196 echo ""
197 if [ -z "$TARGET_TO_BE_BOOT" ]; then
198 die "Error: choose a valid target name"
199 fi
200 else
201 usage
202 exit 1
203 fi
157fi 204fi
158 205
159if [ "$1" = "-v" ]; then 206if [ "$1" = "-v" ]; then
@@ -162,9 +209,15 @@ if [ "$1" = "-v" ]; then
162 shift 209 shift
163fi 210fi
164 211
165DEVICE=$1 212if [ -z "$AVAILABLE_DISK" ]; then
166HDDIMG=$2 213 DEVICE=$1
167TARGET_DEVICE=$3 214 HDDIMG=$2
215 TARGET_DEVICE=$3
216else
217 DEVICE=$DISK_TO_BE_FLASHED
218 HDDIMG=$1
219 TARGET_DEVICE=$TARGET_TO_BE_BOOT
220fi
168 221
169LINK=$(readlink $DEVICE) 222LINK=$(readlink $DEVICE)
170if [ $? -eq 0 ]; then 223if [ $? -eq 0 ]; then