changed buildscript usage-messages to docopt standard.

Signed-off-by: Alexander Wunschik <freifunk@wunschik.net>
Reviewed-by: Tim Niemeyer <tim.niemeyer@mastersword.de>
Reviewed-by: Steffen Pankratz <kratz00@gmx.de>
This commit is contained in:
Alexander Wunschik 2016-01-28 00:30:56 +01:00 committed by Tobias Klaus
parent 6e4ca690f0
commit f6bd067db4
1 changed files with 26 additions and 13 deletions

View File

@ -158,7 +158,7 @@ prepare() {
done done
# todo evaluate this with the new openwrt # todo evaluate this with the new openwrt
# This changes the default behavior of sysupgrade to not save the config # This changes the default behavior of sysupgrade to not save the config
patch -p0 -d "$target" -i "$PWD"/build_patches/sysupgrade_no_config_save.patch patch -p0 -d "$target" -i "$PWD"/build_patches/sysupgrade_no_config_save.patch
# set default password to 'ffol' # set default password to 'ffol'
@ -325,9 +325,10 @@ case "$1" in
if [ "$2" = "help" ] || [ "$2" = "" ]; then if [ "$2" = "help" ] || [ "$2" = "" ]; then
echo "Select a Board-Support-Package:" echo "Select a Board-Support-Package:"
echo echo
echo "Usage: $0 $1 bsp" echo "Usage: $0 $1 <bsp-file>"
echo "available packages:" echo "available packages:"
/bin/ls bsp/*.bsp /bin/ls bsp/*.bsp
echo
else else
if [ ! -f "$2" ]; then if [ ! -f "$2" ]; then
echo "Could not find $2" echo "Could not find $2"
@ -341,9 +342,10 @@ case "$1" in
if [ "$2" = "help" ] || [ "$2" = "" ]; then if [ "$2" = "help" ] || [ "$2" = "" ]; then
echo "Select a Community-File:" echo "Select a Community-File:"
echo echo
echo "Usage: $0 $1 community.cfg" echo "Usage: $0 $1 <community-file>"
echo "community.cfg: " echo "available community-files: "
/bin/ls community/*.cfg /bin/ls community/*.cfg
echo
else else
if [ ! -f "$2" ]; then if [ ! -f "$2" ]; then
echo "Could not find $2" echo "Could not find $2"
@ -356,7 +358,9 @@ case "$1" in
"prepare") "prepare")
if [ "$2" = "help" ] || [ "$2" = "x" ]; then if [ "$2" = "help" ] || [ "$2" = "x" ]; then
echo "This option fetches the sources for the images and configurates the build so that it can be compiled" echo "This option fetches the sources for the images and configurates the build so that it can be compiled"
echo
echo "Usage: $0 $1" echo "Usage: $0 $1"
echo
else else
prepare prepare
fi fi
@ -366,7 +370,9 @@ case "$1" in
echo "This option compiles the firmware" echo "This option compiles the firmware"
echo "Normaly the build uses lower IO and System priorities, " echo "Normaly the build uses lower IO and System priorities, "
echo "you can append \"fast\" option, to use normal user priorities" echo "you can append \"fast\" option, to use normal user priorities"
echo
echo "Usage: $0 $1 [fast|debug]" echo "Usage: $0 $1 [fast|debug]"
echo
else else
build "$2" build "$2"
fi fi
@ -380,13 +386,16 @@ case "$1" in
echo "This open the OpenWRT menuconfig dialog" echo "This open the OpenWRT menuconfig dialog"
echo echo
echo "Usage: $0 $1 openwrt" echo "Usage: $0 $1 openwrt"
echo
;; ;;
esac esac
;; ;;
"clean") "clean")
if [ "$2" = "help" ] || [ "$2" = "x" ]; then if [ "$2" = "help" ] || [ "$2" = "x" ]; then
echo "This option cleans all build files." echo "This option cleans all build files."
echo "$0 $1" echo
echo "Usage: $0 $1"
echo
else else
clean clean
fi fi
@ -394,25 +403,29 @@ case "$1" in
"buildall") "buildall")
if [ "$2" = "help" ] || [ "$2" = "" ]; then if [ "$2" = "help" ] || [ "$2" = "" ]; then
echo "This option builds the firmware for all routers of a given community." echo "This option builds the firmware for all routers of a given community."
echo "Usage: $0 $1 community.cfg [fast]" echo
echo "community.cfg: " echo "Usage: $0 $1 <community-file> [fast]"
echo "available community-files: "
/bin/ls community/*.cfg /bin/ls community/*.cfg
echo
else else
buildall "$2" "$3" buildall "$2" "$3"
fi fi
;; ;;
*) *)
echo "This is the Build Environment Script of the Freifunk Community Franken." echo "This is the Build Environment Script of the Freifunk Community Franken."
echo
echo "Usage: $0 command" echo "Usage: $0 command"
echo "command:" echo "command:"
echo " selectcommunity [communityfile]" echo " selectcommunity <community-file>"
echo " selectbsp [bsp file]" echo " selectbsp <bsp-file>"
echo " prepare" echo " prepare"
echo " config <openwrt>" echo " config openwrt"
echo " build [<fast|debug>]" echo " build [fast|debug]"
echo " buildall <community> [<fast>]" echo " buildall <community-file> [fast]"
echo " clean" echo " clean"
echo "" echo ""
echo "If you need help to one of these options just type $0 command help" echo "If you need help to one of these options just type: $0 <command> help"
echo
;; ;;
esac esac