Skip to content

Commit a35138c

Browse files
committed
wip
1 parent ad42667 commit a35138c

File tree

4 files changed

+64
-16
lines changed

4 files changed

+64
-16
lines changed

aztec-up/bin/aztec-install

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ fi
2323
AZTEC_HOME="${AZTEC_HOME:-$HOME/.aztec}"
2424
shared_bin_path="$AZTEC_HOME/bin"
2525

26-
# VERSION can be set externally
27-
VERSION="${VERSION:-latest}"
26+
VERSION="${VERSION:-}"
2827

2928
# Install URI (root, not version-specific)
3029
INSTALL_URI="${INSTALL_URI:-https://install.aztec.network}"
@@ -37,7 +36,7 @@ function print_colored() {
3736
echo "$1" | sed -E "s/(█+)/${b}\1${y}/g"
3837
}
3938

40-
function title() {
39+
function title {
4140
clear
4241
echo
4342
print_colored " █████╗ ███████╗████████╗███████╗ ██████╗"
@@ -66,6 +65,31 @@ function title() {
6665
fi
6766
}
6867

68+
function check_for_old_install {
69+
if [ -f "$AZTEC_HOME/bin/.aztec-run" ]; then
70+
echo_yellow "WARNING: An existing Aztec installation was detected in $AZTEC_HOME."
71+
echo_yellow "You should only proceed if you no longer intend to use older versions of Aztec installed via the old docker-based method!"
72+
echo
73+
echo "Aztec has moved to a native, dockerless installation, using ${bold}${g}aztec-up${r} as a version manager."
74+
echo "The container is still available but is only useful for running node infrastructure, not contract development."
75+
76+
if [ "$NON_INTERACTIVE" -eq 1 ]; then
77+
echo "Remove $AZTEC_HOME and try again."
78+
exit 1
79+
fi
80+
81+
echo "If you continue, the entire $AZTEC_HOME directory will be removed and replaced with the new installation."
82+
echo "You should manually remove old docker images you no longer need."
83+
echo
84+
read -p "Do you wish to continue? (y/n) " -n 1 -r
85+
echo
86+
echo
87+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
88+
exit 1
89+
fi
90+
fi
91+
}
92+
6993
function echo_green {
7094
echo -e "${g}$1${r}"
7195
}
@@ -105,8 +129,13 @@ function install_jq {
105129
}
106130

107131
function install_aztec_up {
108-
# Download aztec-up from root (not version-specific)
109-
curl -fsSL "$INSTALL_URI/aztec-up" -o "$shared_bin_path/aztec-up"
132+
if [ -n "$VERSION" ]; then
133+
# Download aztec-up from version dir (useful for testing).
134+
curl -fsSL "$INSTALL_URI/$VERSION/aztec-up" -o "$shared_bin_path/aztec-up"
135+
else
136+
# Download aztec-up from root (the canonical latest version).
137+
curl -fsSL "$INSTALL_URI/aztec-up" -o "$shared_bin_path/aztec-up"
138+
fi
110139
chmod +x "$shared_bin_path/aztec-up"
111140
}
112141

@@ -132,11 +161,11 @@ function update_path_env_var {
132161
;;
133162
esac
134163

135-
# Check if we already have aztec paths in the profile
164+
# Check if we already have aztec paths in the profile.
136165
if grep -q '\.aztec' "$shell_profile" 2>/dev/null; then
137-
# Remove old aztec PATH entries and add new one
166+
# Remove old aztec PATH entries.
138167
local tmp_file=$(mktemp)
139-
grep -v '\.aztec' "$shell_profile" > "$tmp_file" || true
168+
grep -Ev 'export PATH=.*/\.aztec/' "$shell_profile" > "$tmp_file" || true
140169
mv "$tmp_file" "$shell_profile"
141170
fi
142171

@@ -148,6 +177,8 @@ function main {
148177
# Show title if we're in a terminal.
149178
[ "$NON_INTERACTIVE" -eq 0 ] && title
150179

180+
check_for_old_install
181+
151182
mkdir -p "$shared_bin_path"
152183

153184
# Install jq

aztec-up/bin/aztec-up

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,10 @@ function cmd_use {
150150
local aztecrc_file
151151
if aztecrc_file=$(find_aztecrc); then
152152
version=$(read_aztecrc "$aztecrc_file")
153-
echo_blue "Found .aztecrc: $aztecrc_file"
154153
else
155154
echo "Error: No version specified and no .aztecrc file found."
156155
echo "Usage: aztec-up use <version>"
157-
echo " or: aztec-up use (with .aztecrc file in current or parent directory)"
156+
echo " or: aztec-up use (with .aztecrc file in current or parent directory)"
158157
exit 1
159158
fi
160159
fi
@@ -174,7 +173,7 @@ function cmd_use {
174173

175174
# Update the current symlink
176175
ln -sfn "$AZTEC_HOME/versions/$resolved_version" "$AZTEC_HOME/current"
177-
echo_green "Now using aztec $resolved_version"
176+
echo_green "Using aztec version $resolved_version"
178177
}
179178

180179
# List installed versions and available aliases

aztec-up/bootstrap.sh

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,28 @@ function test {
9999
function release {
100100
echo_header "aztec-up release"
101101
local version=${REF_NAME#v}
102-
local source_dir=./bin
103102

104-
# Always upload version-specific files to version directory
105-
do_or_dryrun aws s3 cp $source_dir/0.0.1/install "s3://install.aztec.network/$version/install"
106-
do_or_dryrun aws s3 cp $source_dir/0.0.1/versions "s3://install.aztec.network/$version/versions"
103+
# Upload version-specific files to version directory.
104+
do_or_dryrun aws s3 cp bin/0.0.1 "s3://install.aztec.network/$version/"
107105

106+
# Upload root installer files to the version directory, which can be useful for testing.
107+
do_or_dryrun aws s3 cp bin/aztec-install "s3://install.aztec.network/$version/aztec-install"
108+
do_or_dryrun aws s3 cp bin/aztec-up "s3://install.aztec.network/$version/aztec-up"
109+
110+
# Update alias to point to new version.
111+
# This has real impact outside of the version fence. i.e. if it's nightly dist tag, it affects nightly installs.
108112
do_or_dryrun aws s3 cp - "s3://install.aztec.network/aliases/$(dist_tag)" <<< "$version"
109-
do_or_dryrun aws s3 cp $source_dir/aliases/index "s3://install.aztec.network/aliases/index"
113+
}
114+
115+
# This is not done by CI.
116+
# It's a manual process, as updating the root installer and alias index requires careful consideration.
117+
function release_aztec_up {
118+
# Update root scripts.
119+
do_or_dryrun aws s3 cp bin/aztec-install "s3://install.aztec.network/aztec-install"
120+
do_or_dryrun aws s3 cp bin/aztec-up "s3://install.aztec.network/aztec-up"
121+
122+
# Update alias list.
123+
do_or_dryrun aws s3 cp bin/aliases/index "s3://install.aztec.network/aliases/index"
110124
}
111125

112126
case "$cmd" in

yarn-project/aztec/scripts/aztec.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ cmd=${1:-}
1212

1313
export AZTEC_SHELL_WRAPPER=1
1414

15+
if [ -f .aztecrc ] && command -v aztec-up &>/dev/null; then
16+
aztec-up use
17+
fi
18+
1519
case $cmd in
1620
test)
1721
export LOG_LEVEL="${LOG_LEVEL:-error}"

0 commit comments

Comments
 (0)