@@ -101,6 +101,8 @@ rsvm_file_download()
101
101
OPTS=' -s'
102
102
fi
103
103
104
+ # echo $1 $2
105
+
104
106
if [ $( rsvm_check_etag $1 $2 ) = 0 ]
105
107
then
106
108
# not match etag; new download
@@ -124,7 +126,6 @@ rsvm_append_path()
124
126
echo $newpath
125
127
}
126
128
127
- export PATH=$( rsvm_append_path $PATH " $RSVM_DIR /current/dist/bin" )
128
129
export LD_LIBRARY_PATH=$( rsvm_append_path $LD_LIBRARY_PATH " $RSVM_DIR /current/dist/lib" )
129
130
export DYLD_LIBRARY_PATH=$( rsvm_append_path $DYLD_LIBRARY_PATH " $RSVM_DIR /current/dist/lib" )
130
131
export MANPATH=$( rsvm_append_path $MANPATH " $RSVM_DIR /current/dist/share/man" )
@@ -135,6 +136,11 @@ then
135
136
else
136
137
unset RUST_SRC_PATH
137
138
fi
139
+ export CARGO_HOME=" $RSVM_DIR /current/cargo"
140
+ export RUSTUP_HOME=" $RSVM_DIR /current/rustup"
141
+
142
+ export PATH=$( rsvm_append_path $PATH " $RSVM_DIR /current/dist/bin" )
143
+ export PATH=$( rsvm_append_path $PATH " $CARGO_HOME /bin" )
138
144
139
145
rsvm_use ()
140
146
{
@@ -209,6 +215,7 @@ rsvm_install()
209
215
local dirname
210
216
local url_prefix
211
217
local LAST_VERSION
218
+ local RUSTUP_CHANNEL
212
219
213
220
if [ ${1: -3} = ' -rc' ]
214
221
then
@@ -228,13 +235,22 @@ rsvm_install()
228
235
else
229
236
dirname=$1 .` date " +%Y%m%d%H%M%S" `
230
237
fi
238
+ if [[ $1 = " nightly" ]]
239
+ then
240
+ RUSTUP_CHANNEL=$1
241
+ else
242
+ RUSTUP_CHANNEL=" beta"
243
+ fi
231
244
else
232
245
dirname=$1
246
+ RUSTUP_CHANNEL=$1
233
247
fi
234
248
235
249
rsvm_init_folder_structure $dirname
236
250
local SRC=" $RSVM_DIR /versions/$dirname /src"
237
251
local DIST=" $RSVM_DIR /versions/$dirname /dist"
252
+ local CARGO=" $RSVM_DIR /versions/$dirname /cargo"
253
+ local RUSTUP=" $RSVM_DIR /versions/$dirname /rustup"
238
254
239
255
cd $SRC
240
256
@@ -297,6 +313,63 @@ rsvm_install()
297
313
cd " $SRC /rust-$target "
298
314
sh install.sh --prefix=$DIST
299
315
316
+ if [ ! -f $DIST /lib/rustlib/multirust-channel-manifest.toml ]
317
+ then
318
+ echo " Downloading channel manifest ... "
319
+ rsvm_file_download \
320
+ " https://static.rust-lang.org/dist/channel-rust-${RUSTUP_CHANNEL} .toml" \
321
+ " multirust-channel-manifest.toml"
322
+ echo " done"
323
+
324
+ cp multirust-channel-manifest.toml $DIST /lib/rustlib/multirust-channel-manifest.toml
325
+ fi
326
+
327
+ if [ ! -f $DIST /lib/rustlib/multirust-config.toml ]
328
+ then
329
+ cat << EOF > $DIST /lib/rustlib/multirust-config.toml
330
+ config_version = "1"
331
+
332
+ [[components]]
333
+ pkg = "rustc"
334
+ target = "$RSVM_PLATFORM "
335
+
336
+ [[components]]
337
+ pkg = "rust-std"
338
+ target = "$RSVM_PLATFORM "
339
+
340
+ [[components]]
341
+ pkg = "cargo"
342
+ target = "$RSVM_PLATFORM "
343
+
344
+ [[components]]
345
+ pkg = "rust-docs"
346
+ target = "$RSVM_PLATFORM "
347
+ EOF
348
+ fi
349
+
350
+ if [ ! -f $DIST /bin/rustup ]
351
+ then
352
+ echo " Downloading rustup ... "
353
+ rsvm_file_download \
354
+ " https://static.rust-lang.org/rustup/dist/$RSVM_PLATFORM /rustup-init" \
355
+ " rustup"
356
+ echo " done"
357
+
358
+ cp rustup $DIST /bin/rustup
359
+ chmod +x $DIST /bin/rustup
360
+ fi
361
+
362
+ mkdir -p $RUSTUP /toolchains
363
+ ln -s $DIST $RUSTUP /toolchains/${RUSTUP_CHANNEL} -${RSVM_PLATFORM}
364
+ cat << EOF > $RUSTUP /settings.toml
365
+ default_host_triple = "x86_64-unknown-linux-gnu"
366
+ default_toolchain = "nightly-x86_64-unknown-linux-gnu"
367
+ telemetry = false
368
+ version = "12"
369
+
370
+ [overrides]
371
+ EOF
372
+
300
373
echo " "
301
374
echo " And we are done. Have fun using rust $dirname ."
302
375
0 commit comments