diff --git a/chip-fel-flash.sh b/chip-fel-flash.sh index 7f179af..6ba5ddb 100755 --- a/chip-fel-flash.sh +++ b/chip-fel-flash.sh @@ -2,21 +2,7 @@ SCRIPTDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -onMac() { - if [ "$(uname)" == "Darwin" ]; then - return 0; - else - return 1; - fi -} - -filesize() { - if onMac; then - stat -f%z $0 - else - stat --printf="%s" $0 - fi -} +source $SCRIPTDIR/common.sh FEL=fel diff --git a/common.sh b/common.sh new file mode 100644 index 0000000..298c115 --- /dev/null +++ b/common.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +onMac() { + if [ "$(uname)" == "Darwin" ]; then + return 0; + else + return 1; + fi +} + +filesize() { + if onMac; then + stat -f%z $0 + else + stat --printf="%s" $0 + fi +}