diff options
-rwxr-xr-x | sd_fuse/sd_fusing.sh | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/sd_fuse/sd_fusing.sh b/sd_fuse/sd_fusing.sh index 451013f119..8698294127 100755 --- a/sd_fuse/sd_fusing.sh +++ b/sd_fuse/sd_fusing.sh @@ -7,17 +7,20 @@ # abort() { - echo $1 + echo "$1" exit 1 } -[ -z $1 ] && abort "usage: $0 <your/memory/card/device>" -[ -z ${UBOOT} ] && UBOOT=${PWD}/u-boot.bin -[ ! -f ${UBOOT} ] && abort "error: ${UBOOT} is not exist" +[ -z "$1" ] && abort "usage: $0 <your/memory/card/device>" +[ -z "$UBOOT" ] && UBOOT="${PWD}/u-boot.bin" +if [ ! -f "$UBOOT" ] ; then + UBOOT="$(echo "$0" | perl -pe 's/[^\/]*$//g')u-boot.bin" +fi +[ ! -f "$UBOOT" ] && abort "error: $UBOOT is not exist" -sudo dd if=$UBOOT of=$1 conv=fsync,notrunc bs=512 seek=1 +sudo dd if="$UBOOT" of="$1" conv=fsync,notrunc bs=512 seek=1 sync -sudo eject $1 -echo Finished. +sudo eject "$1" +echo "Finished." |