Increase dump length for a packet
[wave300.git] / support / revision_info.sh
blobd818720ec56180f332455a1a55e1ab63ccb7875e
1 #!/bin/sh
3 TARGET_DIR=$1
4 INFO_TYPE=$2
6 test x"$TARGET_DIR" = x"" && TARGET_DIR="."
8 if [ -d "$TARGET_DIR/.hg" ]; then
9 # Under source control => get Mercurial info
11 get_revision() {
12 if hash hg &>/dev/null; then
13 hg identify --id "$1"
14 else
15 echo "unknown"
19 get_branch() {
20 if hash hg &>/dev/null; then
21 hg identify --branch "$1"
22 else
23 echo "unknown"
27 get_fw_api_info() {
28 if hash hg &>/dev/null; then
29 hg identify --id "$1/wireless/shared_mbss_mac"
30 else
31 echo "unknown"
35 else
36 # Source tarball => mark as 'exported' + base version if exists
38 # get base version from 'revision' file if exists BEFORE we output (probaly to the same file)
39 BASE_REVISION="$TARGET_DIR/revision_info"
41 if [ -f "${BASE_REVISION}" ]; then
42 BASE_INFO=$(cat "${BASE_REVISION}" | awk '{ print $1; }')
43 BASE_FW_MBSS_API_INFO=$(cat "${BASE_REVISION}" | awk '{ print $2; }')
46 get_revision() {
47 echo "exported"
50 get_branch() {
51 if [ "$BASE_INFO" ]; then
52 echo "$BASE_INFO"
53 else
54 echo "unknown"
58 get_fw_api_info() {
59 if [ "$BASE_FW_MBSS_API_INFO" ]; then
60 echo "$BASE_FW_MBSS_API_INFO"
61 else
62 echo "unknown"
68 get_info() {
69 echo "$(get_revision "$1").$(get_branch "$1")"
72 SHOW_BASE=0
73 SHOW_FW_MBSS_API=0
74 test x"${INFO_TYPE}" = x"" && SHOW_BASE=1 && SHOW_FW_MBSS_API=1
75 test x"${INFO_TYPE}" = x"base" && SHOW_BASE=1
76 test x"${INFO_TYPE}" = x"fw_mbss_api" && SHOW_FW_MBSS_API=1
78 test x"$SHOW_BASE" = x"1" && INFO="$INFO $(get_info "$TARGET_DIR")"
79 test x"$SHOW_FW_MBSS_API" = x"1" && INFO="$INFO $(get_fw_api_info "$TARGET_DIR")"
81 echo $INFO