mirror of
https://github.com/ValdikSS/windows2usb.git
synced 2023-08-10 21:13:16 +03:00
Check that ISO file and device exist
This commit is contained in:
parent
1821638f34
commit
86bfabe76f
17
windows2usb
17
windows2usb
@ -24,6 +24,20 @@ function check_requirements() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function check_iso_and_device() {
|
||||||
|
if [ ! -f "$1" ]
|
||||||
|
then
|
||||||
|
echo "${bold} == ERROR: ISO file not found! ==${normal}"
|
||||||
|
exit 106
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -b "$2" ]
|
||||||
|
then
|
||||||
|
echo "${bold} == ERROR: Device file not found! ==${normal}"
|
||||||
|
exit 107
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function list_removable_drives() {
|
function list_removable_drives() {
|
||||||
lsblk -d -I 8 -o RM,NAME,SIZE,MODEL | \
|
lsblk -d -I 8 -o RM,NAME,SIZE,MODEL | \
|
||||||
awk '($1 == 1) {print "/dev/" substr($0, index($0, $2))}'
|
awk '($1 == 1) {print "/dev/" substr($0, index($0, $2))}'
|
||||||
@ -149,9 +163,9 @@ then
|
|||||||
uefimode=
|
uefimode=
|
||||||
[[ "$labeltype" == "gpt" ]] && uefimode=1
|
[[ "$labeltype" == "gpt" ]] && uefimode=1
|
||||||
[[ "$labeltype" == "gptntfs" ]] && uefimode=1
|
[[ "$labeltype" == "gptntfs" ]] && uefimode=1
|
||||||
partpath="$(mktemp -d /run/windows2usb.XXXXXXXXXX)"
|
|
||||||
|
|
||||||
check_requirements
|
check_requirements
|
||||||
|
check_iso_and_device "$isopath" "$dev"
|
||||||
|
|
||||||
isolabel="$(get_iso_name "$isopath")"
|
isolabel="$(get_iso_name "$isopath")"
|
||||||
if [ $? -ne 0 ]
|
if [ $? -ne 0 ]
|
||||||
@ -160,6 +174,7 @@ then
|
|||||||
fi
|
fi
|
||||||
echo "${bold} == Working with ISO $isolabel ==${normal}"
|
echo "${bold} == Working with ISO $isolabel ==${normal}"
|
||||||
|
|
||||||
|
partpath="$(mktemp -d /run/windows2usb.XXXXXXXXXX)"
|
||||||
trap sigint_handler INT EXIT
|
trap sigint_handler INT EXIT
|
||||||
|
|
||||||
# MBR
|
# MBR
|
||||||
|
Loading…
x
Reference in New Issue
Block a user