@@ -224,49 +224,66 @@ step_msg "validating $CFG_SELF args"
224
224
validate_opt
225
225
226
226
# Sanity check: can we can write to the destination?
227
- mkdir -p " ${CFG_PREFIX} /lib"
227
+ umask 022 && mkdir -p " ${CFG_PREFIX} /lib"
228
+ need_ok " directory creation failed"
228
229
touch " ${CFG_PREFIX} /lib/rust-install-probe" 2> /dev/null
229
230
if [ $? -ne 0 ]
230
231
then
231
232
err " can't write to destination. try again with 'sudo'."
232
233
fi
233
- rm -r " ${CFG_PREFIX} /lib/rust-install-probe"
234
+ rm " ${CFG_PREFIX} /lib/rust-install-probe"
234
235
need_ok " failed to remove install probe"
235
236
236
237
# Sanity check: can we run these binaries?
237
238
" ${CFG_SRC_DIR} /bin/rustc" --version > /dev/null
238
239
need_ok " can't run these binaries on this platform"
239
240
240
241
241
- # First, uninstall from the installation prefix
242
+ # First, uninstall from the installation prefix.
243
+ # Errors are warnings - try to rm everything in the manifest even if some fail.
242
244
# FIXME: Hardcoded 'rustlib' ignores CFG_RUSTLIBDIR
243
245
if [ -f " ${CFG_PREFIX} /lib/rustlib/manifest" ]
244
246
then
247
+ # Iterate through installed manifest and remove files
245
248
while read p; do
246
- msg " uninstall ${CFG_PREFIX} /$p "
247
- rm " ${CFG_PREFIX} /$p "
248
- need_ok " failed to remove file"
249
+ msg " removing ${CFG_PREFIX} /$p "
250
+ if [ -f " ${CFG_PREFIX} /$p " ]
251
+ then
252
+ rm " ${CFG_PREFIX} /$p "
253
+ if [ $? -ne 0 ]
254
+ then
255
+ warn " failed to remove ${CFG_PREFIX} /$p "
256
+ fi
257
+ else
258
+ warn " supposedly installed file ${CFG_PREFIX} /$p does not exist!"
259
+ fi
249
260
done < " ${CFG_PREFIX} /lib/rustlib/manifest"
250
261
251
262
# Remove 'rustlib' directory
252
- msg " uninstall ${CFG_PREFIX} /lib/rustlib"
263
+ msg " removing ${CFG_PREFIX} /lib/rustlib"
253
264
rm -r " ${CFG_PREFIX} /lib/rustlib"
254
- need_ok " failed to remove rustlib"
265
+ if [ $? -ne 0 ]
266
+ then
267
+ warn " failed to remove rustlib"
268
+ fi
255
269
else
256
270
if [ -n " ${CFG_UNINSTALL} " ]
257
271
then
258
- err " unable to find manifest at ${CFG_PREFIX} /lib/rustlib"
259
- exit 0
272
+ err " unable to find installation manifest at ${CFG_PREFIX} /lib/rustlib"
260
273
fi
261
274
fi
262
275
263
276
# If we're only uninstalling then exit
264
277
if [ -n " ${CFG_UNINSTALL} " ]
265
278
then
279
+ echo
280
+ echo " Rust is uninstalled. Have a nice day."
281
+ echo
266
282
exit 0
267
283
fi
268
284
269
- # Iterate through the new manifest and install files
285
+
286
+ # Now install, iterate through the new manifest and copy files
270
287
while read p; do
271
288
272
289
umask 022 && mkdir -p " ${CFG_PREFIX} /$( dirname $p ) "
0 commit comments