2323AZTEC_HOME=" ${AZTEC_HOME:- $HOME / .aztec} "
2424shared_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)
3029INSTALL_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+
6993function echo_green {
7094 echo -e " ${g} $1 ${r} "
7195}
@@ -105,8 +129,13 @@ function install_jq {
105129}
106130
107131function 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
0 commit comments