Skip to content

Commit e5f22e7

Browse files
committed
handle script arguments
1 parent 89de0e1 commit e5f22e7

1 file changed

Lines changed: 21 additions & 33 deletions

File tree

apply_patches.sh

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,33 @@
33
set -e
44

55
ACTION="apply"
6-
if [[ "$1" == reset ]]; then
7-
ACTION="reset"
8-
shift
9-
fi
10-
116
# Default to single camera DT for JetPack 5.0.2
127
# single - jp5 [default] single cam GMSL board
138
# dual - dual cam GMSL board SC20220126
149
JP5_D4XX_DTSI="tegra194-camera-d4xx-single.dtsi"
15-
if [[ "$1" == "--one-cam" ]]; then
16-
JP5_D4XX_DTSI="tegra194-camera-d4xx-single.dtsi"
17-
shift
18-
elif [[ "$1" == "--dual-cam" ]]; then
19-
JP5_D4XX_DTSI="tegra194-camera-d4xx-dual.dtsi"
20-
shift
21-
elif [[ "$1" == "--max96712-EVB" ]]; then
22-
JP5_D4XX_DTSI="tegra194-camera-d4xx-max96712-EVB.dtsi"
23-
shift
24-
elif [[ "$1" == "--fg12-16ch" ]]; then
25-
JP5_D4XX_DTSI="tegra194-camera-d4xx-fg12-16ch.dtsi"
26-
shift
27-
elif [[ "$1" == "--fg12-16ch-dual" ]]; then
28-
JP5_D4XX_DTSI="tegra194-camera-d4xx-fg12-16ch-dual.dtsi"
10+
while [[ $# -gt 0 ]]; do
11+
if [[ "$1" == "--one-cam" ]]; then
12+
JP5_D4XX_DTSI="tegra194-camera-d4xx-single.dtsi"
13+
elif [[ "$1" == "--dual-cam" ]]; then
14+
JP5_D4XX_DTSI="tegra194-camera-d4xx-dual.dtsi"
15+
elif [[ "$1" == "--max96712-EVB" ]]; then
16+
JP5_D4XX_DTSI="tegra194-camera-d4xx-max96712-EVB.dtsi"
17+
elif [[ "$1" == "--fg12-16ch" ]]; then
18+
JP5_D4XX_DTSI="tegra194-camera-d4xx-fg12-16ch.dtsi"
19+
elif [[ "$1" == "--fg12-16ch-dual" ]]; then
20+
JP5_D4XX_DTSI="tegra194-camera-d4xx-fg12-16ch-dual.dtsi"
21+
elif [[ "$1" == reset ]]; then
22+
ACTION="reset"
23+
elif [[ $1 == "-h" ]]; then
24+
echo Usage:
25+
echo "$0 [--one-cam | --dual-cam | --max96712-EVB | --fg12-16ch | --fg12-16ch-dual ] [reset] [-h]"
26+
echo -e 'reset\t: hard reset (git) to version from jetpack_version file'
27+
echo -e '-h\t: show this help'
28+
break
29+
fi
2930
shift
30-
fi
31-
32-
if [[ "$1" == reset ]]; then
33-
ACTION="reset"
34-
shift
35-
fi
36-
37-
if [[ $1 == "-h" ]]; then
38-
echo Usage:
39-
echo "$0 [--one-cam | --dual-cam | --max96712-EVB | --fg12-16ch | --fg12-16ch-dual ] [reset] [-h]"
40-
echo -e 'reset\t: hard reset (git) to version from jetpack_version file'
41-
echo -e '-h\t: show this help'
42-
fi
31+
done
4332

44-
[[ $# -gt 0 ]] && [[ $1 != "-h" ]] && echo -e too many arguments && exit 1
4533
. scripts/setup-common
4634

4735
# set JP4 devicetree

0 commit comments

Comments
 (0)