X-Git-Url: https://git.archive.openwrt.org/?a=blobdiff_plain;f=scripts%2Fubinize-image.sh;h=b87cbb48dc8cc004d754e3b9c8001beb5f111393;hb=beff7e61f2935a447522bc3057c51a0ef828be60;hp=1058aba812699cb1ef243bea03056e4161b3617a;hpb=c15a8bc95929dc527e605ee9043e8fc19be16aa4;p=openwrt.git diff --git a/scripts/ubinize-image.sh b/scripts/ubinize-image.sh index 1058aba812..b87cbb48dc 100755 --- a/scripts/ubinize-image.sh +++ b/scripts/ubinize-image.sh @@ -1,7 +1,6 @@ #!/bin/sh ubootenv="" -nokernel="" ubinize_param="" kernel="" rootfs="" @@ -57,40 +56,39 @@ ubilayout() { } while [ "$1" ]; do - if [ "$1" = "--uboot-env" ]; then + case "$1" in + "--uboot-env") ubootenv="ubootenv" shift continue - fi - if [ "$1" = "--no-kernel" ]; then - nokernel="nokernel" - shift - continue - fi - if [ ! "$kernel" -a ! "$nokernel" ]; then - [ "${1:0:1}" = "-" ] && break - kernel=$1 - shift - continue - fi - if [ ! "$rootfs" ]; then - [ "${1:0:1}" = "-" ] && break - rootfs=$1 + ;; + "--kernel") + kernel="$2" shift - continue - fi - if [ ! "$outfile" ]; then - [ "${1:0:1}" = "-" ] && break - outfile=$1 shift continue - fi - ubinize_param="$@" - break + ;; + "-"*) + ubinize_param="$@" + break + ;; + *) + if [ ! "$rootfs" ]; then + rootfs=$1 + shift + continue + fi + if [ ! "$outfile" ]; then + outfile=$1 + shift + continue + fi + ;; + esac done -if [ ! -r "$rootfs" -o ! -r "$kernel" -a ! "$nokernel" -o ! "$outfile" ]; then - echo "syntax: $0 [--no-kernel] [--uboot-env] rootfs [kernel] out [ubinize opts]" +if [ ! -r "$rootfs" -o ! -r "$kernel" -a ! "$outfile" ]; then + echo "syntax: $0 [--uboot-env] [--kernel kernelimage] rootfs out [ubinize opts]" exit 1 fi @@ -100,7 +98,11 @@ if [ ! -x "$ubinize" ]; then exit 1 fi -ubinizecfg="$( mktemp )" +ubinizecfg="$( mktemp 2> /dev/null )" +if [ -z "$ubinizecfg" ]; then + # try OSX signature + ubinizecfg="$( mktemp -t 'ubitmp' )" +fi ubilayout "$ubootenv" "$rootfs" "$kernel" > "$ubinizecfg" cat "$ubinizecfg" @@ -110,4 +112,3 @@ err="$?" rm "$ubinizecfg" exit $err -