Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1fe79b6

Browse files
yuri-rageHwurzburg
authored andcommitted
dev: added bash utility script for docker
1 parent d6c126f commit 1fe79b6

2 files changed

Lines changed: 61 additions & 0 deletions

File tree

common/source/docs/common-wiki-editing-setup.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,15 @@ This will build a docker image with all package setup to build the wiki and name
122122
123123
docker run --rm -it -v "${PWD}:/ardupilot_wiki" -u "$(id -u):$(id -g)" ardupilot_wiki python3 update.py
124124
125+
#. Alternately, use the bash utility script in the ``ardupilot_wiki`` root directory:
126+
127+
.. code-block:: bash
128+
129+
./docker_update_py.sh # presents a brief menu of build options
130+
131+
# or, to build the copter site with the --fast flag, for example:
132+
./docker_update_py.sh --fast --site copter
133+
125134
That will build the wiki with the ``update.py`` similarly as in `Build the Wiki`_. The `-v` is used to share the content of the current directory, that holds all the documentation, to the container. The `-u` is used to make docker use the same permission as your current user. With those two commands, the resulting build is accessible as in `Check the Results`_
126135

127136
Build the Wiki

docker_update_py.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
# utility script to build the ardupilot_wiki with docker
3+
4+
BOLD='\e[1m'
5+
RED='\e[31m'
6+
GREEN='\e[32m'
7+
YELLOW='\e[33m'
8+
MAGENTA='\e[35m'
9+
NC='\e[0m' # no color
10+
11+
show_menu() {
12+
echo -e "\n${BOLD}${YELLOW}Select ArduPilot Wiki site to build:${NC}\n"
13+
echo -e " ${MAGENTA}1) Copter${NC}"
14+
echo -e " ${MAGENTA}2) Plane${NC}"
15+
echo -e " ${MAGENTA}3) Rover${NC}"
16+
echo -e " ${MAGENTA}4) Dev${NC}"
17+
echo -e " ${MAGENTA}5) All${NC}"
18+
echo -en "\nEnter choice [1-5]: "
19+
read choice
20+
21+
case $choice in
22+
1) site_option="--site copter" ;;
23+
2) site_option="--site plane" ;;
24+
3) site_option="--site rover" ;;
25+
4) site_option="--site dev" ;;
26+
5) site_option="" ;;
27+
*) echo -e "\n${BOLD}${RED}Invalid choice.${NC}" && show_menu ;;
28+
esac
29+
30+
echo -en "\nBuild fast? (Y/n): "
31+
read fast_choice
32+
if [[ -z "$fast_choice" || "$fast_choice" =~ ^([yY][eE][sS]|[yY])$ ]]; then
33+
fast_option="--fast"
34+
else
35+
fast_option=""
36+
fi
37+
38+
echo -e "\nRunning: ${BOLD}${GREEN}update.py $fast_option $site_option${NC}\n"
39+
run_command $fast_option $site_option
40+
}
41+
42+
run_command() {
43+
docker run --rm -it -v "${PWD}:/ardupilot_wiki" -u "$(id -u):$(id -g)" ardupilot_wiki python3 update.py "$@"
44+
}
45+
46+
if [ "$#" -eq 0 ]; then
47+
# if no arguments given, show menu of options for building
48+
show_menu
49+
else
50+
# build with docker using arguments passed via CLI
51+
run_command "$@"
52+
fi

0 commit comments

Comments
 (0)