|
1 | 1 | # Script to install scenarios file. Pass in language code parameter for a particular language, such as it-it for Italian. |
2 | 2 | set -e |
3 | 3 |
|
4 | | -# TODO: make parameters mandatory |
5 | | -LANG="$1" |
6 | | -RELEASE="$2" |
| 4 | +RELEASE="$1" |
7 | 5 |
|
8 | 6 | # If no release is specified, download the latest release |
9 | 7 | if [ "$RELEASE" == "" ]; then |
10 | | - RELEASE="latest" |
11 | | -fi |
12 | | - |
13 | | -# Set a default scenarios file |
14 | | -SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/scenarios.zip" |
15 | | - |
16 | | -# If the LANG parameter was set, download appropriate script |
17 | | -if [ -n "$LANG" ]; then |
18 | | - # Map the language parameter to the corresponding scenarios file |
19 | | - # If no parameter, download the scenarios from IE |
20 | | - MAIN_LANG_PREFIX="$(echo "$LANG" | head -c2 | tr '[:upper:]' '[:lower:]')" |
21 | | - LANG_ARRAY=("de" "es" "fr" "it" "nl" "pt" "zh" "cs" "hu" "id" "ja" "ko" "pl" "pt" "ru" "sv" "tr") |
22 | | - |
23 | | - if [[ "${LANG_ARRAY[*]}" =~ "$MAIN_LANG_PREFIX" ]]; then |
24 | | - SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/$MAIN_LANG_PREFIX-$MAIN_LANG_PREFIX-scenarios.zip" |
25 | | - if [ "$MAIN_LANG_PREFIX" = "pt" ]; then |
26 | | - if [ "$LANG" = "pt-pt" ]; then |
27 | | - SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/pt-pt-scenarios.zip" |
28 | | - elif [ "$LANG" = "pt-br" ]; then |
29 | | - SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/pt-br-scenarios.zip" |
30 | | - else |
31 | | - SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/pt-pt-scenarios.zip" |
32 | | - fi |
33 | | - fi |
34 | | - if [ "$MAIN_LANG_PREFIX" = "zh" ]; then |
35 | | - if [ "$LANG" = "zh-cn" ]; then |
36 | | - SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/zh-cn-scenarios.zip" |
37 | | - elif [ "$LANG" = "zh-tw" ]; then |
38 | | - SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/zh-tw-scenarios.zip" |
39 | | - else |
40 | | - SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/zh-cn-scenarios.zip" |
41 | | - fi |
42 | | - fi |
43 | | - if [ "$MAIN_LANG_PREFIX" = "cs" ]; then |
44 | | - SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/$MAIN_LANG_PREFIX-cz-scenarios.zip" |
45 | | - fi |
46 | | - if [ "$MAIN_LANG_PREFIX" = "ja" ]; then |
47 | | - SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/$MAIN_LANG_PREFIX-jp-scenarios.zip" |
48 | | - fi |
49 | | - if [ "$MAIN_LANG_PREFIX" = "ko" ]; then |
50 | | - SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/$MAIN_LANG_PREFIX-kr-scenarios.zip" |
51 | | - fi |
52 | | - if [ "$MAIN_LANG_PREFIX" = "sv" ]; then |
53 | | - SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/$MAIN_LANG_PREFIX-se-scenarios.zip" |
54 | | - fi |
55 | | - fi |
| 8 | + RELEASE="latest" |
56 | 9 | fi |
57 | 10 |
|
58 | 11 | # Download the binary |
59 | | -echo "Installing IE & scenarios from the $RELEASE release..." |
60 | | -wget -q -O ie https://github.com/Azure/InnovationEngine/releases/download/$RELEASE/ie > /dev/null |
61 | | -wget -q -O scenarios.zip "$SCENARIOS" > /dev/null |
| 12 | +echo "Installing IE from the $RELEASE release..." |
| 13 | +wget -q -O ie https://github.com/Azure/InnovationEngine/releases/download/"$RELEASE"/ie >/dev/null |
62 | 14 |
|
63 | 15 | # Setup permissions & move to the local bin |
64 | | -chmod +x ie > /dev/null |
65 | | -mkdir -p ~/.local/bin > /dev/null |
66 | | -mv ie ~/.local/bin > /dev/null |
67 | | - |
68 | | -# Unzip the scenarios, overwrite if they already exist. |
69 | | -unzip -o scenarios.zip -d ~ > /dev/null |
70 | | -rm scenarios.zip > /dev/null |
| 16 | +chmod +x ie >/dev/null |
| 17 | +mkdir -p ~/.local/bin >/dev/null |
| 18 | +mv ie ~/.local/bin >/dev/null |
71 | 19 |
|
72 | 20 | # Export the path to IE if it's not already available |
73 | 21 | if [[ !"$PATH" =~ "~/.local/bin" || !"$PATH" =~ "$HOME/.local/bin" ]]; then |
74 | | - export PATH="$PATH:~/.local/bin" |
| 22 | + export PATH="$PATH:~/.local/bin" |
75 | 23 | fi |
76 | 24 |
|
77 | 25 | echo "Done." |
0 commit comments