|
15 | 15 | NON_INTERACTIVE=${NON_INTERACTIVE:-0} |
16 | 16 | fi |
17 | 17 |
|
18 | | -AZTEC_PATH="${AZTEC_PATH:-$HOME/.aztec}" |
19 | | -BIN_PATH=${BIN_PATH:-$AZTEC_PATH/bin} |
| 18 | +aztec_path=$HOME/.aztec |
| 19 | +bin_path=$aztec_path/bin |
20 | 20 |
|
21 | 21 | # For testing you can override the INSTALL_URI to point to a file uri e.g. file:///home/user/aztec-packages/aztec-up/bin |
22 | | -if [ -z "$INSTALL_URI" ]; then |
| 22 | +if [ -z "${INSTALL_URI:-}" ]; then |
23 | 23 | INSTALL_URI=https://install.aztec.network |
24 | | - if [ -z "${VERSION:-}" ]; then |
| 24 | + if [ -n "${VERSION:-}" ]; then |
25 | 25 | INSTALL_URI+="/$VERSION" |
26 | 26 | fi |
27 | 27 | fi |
@@ -108,22 +108,22 @@ function check_toolchains { |
108 | 108 | } |
109 | 109 |
|
110 | 110 | function install_file { |
111 | | - local dest="$AZTEC_PATH/$1" |
| 111 | + local dest="$aztec_path/$1" |
112 | 112 | curl -fsSL "$INSTALL_URI/$1" -o "$dest" |
113 | 113 | echo "Installed: $dest" |
114 | 114 | } |
115 | 115 |
|
116 | 116 | # Copy a file from the install source path to the bin path and make it executable. |
117 | 117 | function install_bin { |
118 | | - local dest="$BIN_PATH/$1" |
| 118 | + local dest="$bin_path/$1" |
119 | 119 | curl -fsSL "$INSTALL_URI/$1" -o "$dest" |
120 | 120 | chmod +x "$dest" |
121 | 121 | echo "Installed: $dest" |
122 | 122 | } |
123 | 123 |
|
124 | 124 | # Updates appropriate shell script to ensure the bin path is in the PATH. |
125 | 125 | function update_path_env_var { |
126 | | - local target_dir=$BIN_PATH |
| 126 | + local target_dir=$bin_path |
127 | 127 | # Check if the target directory is in the user's PATH. |
128 | 128 | if [[ ":$PATH:" == *":$target_dir:"* ]]; then |
129 | 129 | return |
@@ -175,29 +175,34 @@ function install_jq { |
175 | 175 | ;; |
176 | 176 | esac |
177 | 177 |
|
178 | | - curl -Ls "$url_base/$bin" -o $BIN_PATH/jq || return 1 |
179 | | - chmod +x $BIN_PATH/jq |
| 178 | + curl -Ls "$url_base/$bin" -o $bin_path/jq || return 1 |
| 179 | + chmod +x $bin_path/jq |
180 | 180 | } |
181 | 181 |
|
182 | 182 | function install_aztec_up { |
183 | | - rm -rf $BIN_PATH && mkdir -p $BIN_PATH |
| 183 | + set -euo pipefail |
| 184 | + mkdir -p $bin_path |
| 185 | + rm -f $bin_path/* |
184 | 186 | install_bin aztec-up |
185 | 187 | install_file versions |
186 | 188 | update_path_env_var |
187 | 189 | } |
188 | 190 |
|
189 | 191 | function install_noir { |
| 192 | + set -euo pipefail |
190 | 193 | curl -Ls https://raw.githubusercontent.com/noir-lang/noirup/refs/heads/main/install | bash |
191 | | - $HOME/.nargo/bin/noirup -v $(cat $AZTEC_PATH/versions | grep noir | cut -d' ' -f2) |
| 194 | + $HOME/.nargo/bin/noirup -v $(cat $aztec_path/versions | grep noir | cut -d' ' -f2) |
192 | 195 | } |
193 | 196 |
|
194 | 197 | function install_foundry { |
| 198 | + set -euo pipefail |
195 | 199 | curl -L https://foundry.paradigm.xyz | bash |
196 | | - $HOME/.foundry/bin/foundryup -i $(cat $AZTEC_PATH/versions | grep foundry | cut -d' ' -f2) |
| 200 | + $HOME/.foundry/bin/foundryup -i $(cat $aztec_path/versions | grep foundry | cut -d' ' -f2) |
197 | 201 | } |
198 | 202 |
|
199 | 203 | function install_aztec_packages { |
200 | | - local version=$(cat $AZTEC_PATH/versions | grep aztec | cut -d' ' -f2) |
| 204 | + set -euo pipefail |
| 205 | + local version=$(cat $aztec_path/versions | grep aztec | cut -d' ' -f2) |
201 | 206 | npm i -g @aztec/aztec@$version @aztec/cli-wallet@$version @aztec/bb.js@$version |
202 | 207 | } |
203 | 208 |
|
|
0 commit comments