Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit 2cb8ce2

Browse files
committed
v1.2.1
1 parent d1dd1b8 commit 2cb8ce2

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

bootiso

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Author: jules randolph <[email protected]> https://github.com/jsamr
44
# License: MIT
5-
# Version 1.2
5+
# Version v1.2.1
66
#
77
# Usage: [<options>...] <file.iso>
88
#
@@ -188,15 +188,18 @@ parseOptions() {
188188
display_help
189189
exit 1
190190
fi
191+
if [ -d "$selectedIsoFile" ]; then
192+
failAndExit "Provided file \`$selectedIsoFile' is a directory."
193+
fi
191194
if [ ! -f "$selectedIsoFile" ]; then
192-
failAndExit "Provided iso file \`$selectedIsoFile' does not exists or is a directory."
195+
failAndExit "Provided iso file \`$selectedIsoFile' does not exists."
193196
fi
194197
}
195198

196199
checkPackages() (
197200
checkpkg() {
198201
if [[ $(which "$1") == "" ]]; then
199-
echo -n "Package '$1' not found!"
202+
echowarn -n "Package '$1' not found!"
200203
if [[ ! $pkgmgr == "" ]]; then
201204
read -r -n1 -p "Attempt installation? (y/n)>" answer
202205
echo
@@ -206,7 +209,7 @@ checkPackages() (
206209
n)
207210
read -r -n1 -p "Proceed anyway? (y/n)>" answer2
208211
echo
209-
if [[ "$answer2" == "n" ]] ; then exit
212+
if [[ "$answer2" == "n" ]] ; then exit 1
210213
fi
211214
;;
212215
esac
@@ -265,7 +268,7 @@ selectDrive() {
265268
}
266269
chooseDrive() {
267270
echo "Select the device corresponding to the USB device you want to make bootable (${drives[*]}). Type exit to quit."
268-
read -r -p "Select device name>" _selectedDrive
271+
read -r -p "Select device id>" _selectedDrive
269272
if containsElement "$_selectedDrive" "${drives[@]}"; then
270273
selectedDrive="/dev/$_selectedDrive"
271274
else
@@ -284,16 +287,14 @@ selectDrive() {
284287
lsblk | grep --color=never -e '^[sh]'
285288
chooseDrive
286289
else
287-
if [[ "$selectedDrive" =~ "/dev" ]]; then
288-
if [ -e "$selectedDrive" ]; then
289-
if [[ "$selectedDrive" =~ /dev/[a-zA-Z]+[0-9]+ ]]; then
290-
failAndExit "\`$selectedDrive' is a partition. Select a drive instead."
291-
fi
292-
else
293-
failAndExit "The device $selectedDrive does not exists"
294-
fi
295-
else
296-
failAndExit "The selected device is not a valid posix device file (should start with \`/dev')"
290+
if [ ! -e "$selectedDrive" ]; then
291+
failAndExit "The device $selectedDrive does not exists"
292+
fi
293+
if [ ! -b "$selectedDrive" ]; then
294+
failAndExit "The selected device \`$selectedDrive' is not a valid block file."
295+
fi
296+
if [[ "$selectedDrive" =~ [a-zA-Z]+[0-9]+$ ]]; then
297+
failAndExit "\`$selectedDrive' is a partition. Select a drive instead."
297298
fi
298299
fi
299300
}

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
2-
[![Version](https://img.shields.io/badge/version-v1.2-green.svg)](#)
2+
[![Version](https://img.shields.io/badge/version-v1.2.1-green.svg)](#)
33
[![GitHub issues open](https://img.shields.io/github/issues/jsamr/bootiso.svg?maxAge=2592000)](https://github.com/jsamr/bootiso/issues)
44
[![Build Status](https://travis-ci.org/jsamr/bootiso.svg?branch=master)](https://travis-ci.org/jsamr/bootiso)
55

0 commit comments

Comments
 (0)