mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 13:46:49 +00:00
emmctool: check file exists before writing and error on box images
This commit is contained in:
parent
870d6d93ab
commit
585c672686
@ -148,19 +148,31 @@ do_write(){
|
|||||||
do_umount
|
do_umount
|
||||||
|
|
||||||
case $(dtname) in
|
case $(dtname) in
|
||||||
radxa,zero)
|
radxa,zero*)
|
||||||
do_writeprotect
|
do_writeprotect
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ "${2: -7}" == ".img.gz" ]; then
|
if [ -e "${2}" ]; then
|
||||||
echo "info: writing ${2} to ${EMMC}"
|
case "${2}" in
|
||||||
gunzip -c "${2}" | dd of="${EMMC}" bs=1M
|
*box.img.gz|*box.img)
|
||||||
elif [ "${2: -4}" == ".img" ]; then
|
echo "error: ${2} is not a bootable image, aborting!"
|
||||||
echo "info: writing ${2} to ${EMMC}"
|
exit 1
|
||||||
dd if="${2}" of="${EMMC}" bs=1M
|
;;
|
||||||
|
*.img.gz)
|
||||||
|
echo "info: writing ${2} to ${EMMC}"
|
||||||
|
gunzip -c "${2}" | dd of="${EMMC}" bs=1M
|
||||||
|
;;
|
||||||
|
*.img)
|
||||||
|
echo "info: writing ${2} to ${EMMC}"
|
||||||
|
dd if="${2}" of="${EMMC}" bs=1M
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "error: ${2} is not a valid image file!"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
else
|
else
|
||||||
echo "error: ${2} is not a valid image file!"
|
echo "error: ${2} not found!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user